]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
C6X: add support to build with BINFMT_ELF_FDPIC
authorMark Salter <msalter@redhat.com>
Mon, 23 Apr 2012 14:02:08 +0000 (10:02 -0400)
committerMark Salter <msalter@redhat.com>
Tue, 15 May 2012 13:17:34 +0000 (09:17 -0400)
C6x userspace supports a shared library mechanism called DSBT for systems with
no MMU. DSBT is similar to FDPIC in allowing shared text segments and private
copies of data segments without an MMU. Both methods access data using a base
register and offset. With FDPIC, the caller of an external function sets up the
base register for the callee. With DSBT, the called function sets up its own
base register. Other details differ but both userspaces need the same thing
from the kernel loader: a map of where each ELF segment was loaded. The FDPIC
loader already provides this, so DSBT just uses it.

This patch enables BINFMT_ELF_FDPIC by default for C6X and provides the
necessary architecture hooks for the generic loader.

Signed-off-by: Mark Salter <msalter@redhat.com>
arch/c6x/include/asm/elf.h
arch/c6x/include/asm/mmu.h
arch/c6x/include/asm/ptrace.h
fs/Kconfig.binfmt

index d57865ba2c442691dab9627e74a24a2ae188cacb..f4552db20b4a64f23733985c8bc98338270e5e54 100644 (file)
@@ -30,7 +30,19 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
  */
 #define elf_check_arch(x) ((x)->e_machine == EM_TI_C6000)
 
-#define elf_check_const_displacement(x) (1)
+#define elf_check_fdpic(x) (1)
+#define elf_check_const_displacement(x) (0)
+
+#define ELF_FDPIC_PLAT_INIT(_regs, _exec_map, _interp_map, _dynamic_addr) \
+do {                                                           \
+       _regs->b4       = (_exec_map);                          \
+       _regs->a6       = (_interp_map);                        \
+       _regs->b6       = (_dynamic_addr);                      \
+} while (0)
+
+#define ELF_FDPIC_CORE_EFLAGS  0
+
+#define ELF_CORE_COPY_FPREGS(...) 0 /* No FPU regs to copy */
 
 /*
  * These are used to set parameters in the core dumps.
index 41592bf160676cb6dc7b0c875277de73dc76a66f..4467e770a1ce42e42c096ca49791b9946ba2fdb8 100644 (file)
 
 typedef struct {
        unsigned long           end_brk;
+#ifdef CONFIG_BINFMT_ELF_FDPIC
+       unsigned long   exec_fdpic_loadmap;
+       unsigned long   interp_fdpic_loadmap;
+#endif
 } mm_context_t;
 
 #endif /* _ASM_C6X_MMU_H */
index 21e8d7931fe7cd9d5b54da50f07051192dc9feb9..b04ff5964258bea32365c1edc15157a8aa04174f 100644 (file)
 #define PT_DP     PT_B14  /* Data Segment Pointer (B14) */
 #define PT_SP     PT_B15  /* Stack Pointer (B15)  */
 
+#define PTRACE_GETFDPIC                31      /* get the ELF fdpic loadmap address */
+
+#define PTRACE_GETFDPIC_EXEC   0       /* [addr] request the executable loadmap */
+#define PTRACE_GETFDPIC_INTERP 1       /* [addr] request the interpreter loadmap */
+
 #ifndef __ASSEMBLY__
 
 #ifdef _BIG_ENDIAN
index e95d1b64082cae708f3213a453ea3275f6afbb57..02257420274966b6f0085f20b148e1fe582bc865 100644 (file)
@@ -33,7 +33,7 @@ config ARCH_BINFMT_ELF_RANDOMIZE_PIE
 config BINFMT_ELF_FDPIC
        bool "Kernel support for FDPIC ELF binaries"
        default y
-       depends on (FRV || BLACKFIN || (SUPERH32 && !MMU))
+       depends on (FRV || BLACKFIN || (SUPERH32 && !MMU) || C6X)
        help
          ELF FDPIC binaries are based on ELF, but allow the individual load
          segments of a binary to be located in memory independently of each