Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
elf.h
Go to the documentation of this file.
1 #ifndef _ASM_CRIS_ELF_H
2 #define _ASM_CRIS_ELF_H
3 
4 #include <arch/system.h>
5 
6 #define ELF_CORE_EFLAGS EF_CRIS_VARIANT_V32
7 
8 /*
9  * This is used to ensure we don't load something for the wrong architecture.
10  */
11 #define elf_check_arch(x) \
12  ((x)->e_machine == EM_CRIS \
13  && ((((x)->e_flags & EF_CRIS_VARIANT_MASK) == EF_CRIS_VARIANT_V32 \
14  || (((x)->e_flags & EF_CRIS_VARIANT_MASK) == EF_CRIS_VARIANT_COMMON_V10_V32))))
15 
16 /* CRISv32 ELF register definitions. */
17 
18 #include <asm/ptrace.h>
19 
20 /* Explicitly zero out registers to increase determinism. */
21 #define ELF_PLAT_INIT(_r, load_addr) do { \
22  (_r)->r13 = 0; (_r)->r12 = 0; (_r)->r11 = 0; (_r)->r10 = 0; \
23  (_r)->r9 = 0; (_r)->r8 = 0; (_r)->r7 = 0; (_r)->r6 = 0; \
24  (_r)->r5 = 0; (_r)->r4 = 0; (_r)->r3 = 0; (_r)->r2 = 0; \
25  (_r)->r1 = 0; (_r)->r0 = 0; (_r)->mof = 0; (_r)->srp = 0; \
26  (_r)->acr = 0; \
27 } while (0)
28 
29 /*
30  * An executable for which elf_read_implies_exec() returns TRUE will
31  * have the READ_IMPLIES_EXEC personality flag set automatically.
32  */
33 #define elf_read_implies_exec_binary(ex, have_pt_gnu_stack) (!(have_pt_gnu_stack))
34 
35 /*
36  * This is basically a pt_regs with the additional definition
37  * of the stack pointer since it's needed in a core dump.
38  * pr_regs is a elf_gregset_t and should be filled according
39  * to the layout of user_regs_struct.
40  */
41 #define ELF_CORE_COPY_REGS(pr_reg, regs) \
42  pr_reg[0] = regs->r0; \
43  pr_reg[1] = regs->r1; \
44  pr_reg[2] = regs->r2; \
45  pr_reg[3] = regs->r3; \
46  pr_reg[4] = regs->r4; \
47  pr_reg[5] = regs->r5; \
48  pr_reg[6] = regs->r6; \
49  pr_reg[7] = regs->r7; \
50  pr_reg[8] = regs->r8; \
51  pr_reg[9] = regs->r9; \
52  pr_reg[10] = regs->r10; \
53  pr_reg[11] = regs->r11; \
54  pr_reg[12] = regs->r12; \
55  pr_reg[13] = regs->r13; \
56  pr_reg[14] = rdusp(); /* SP */ \
57  pr_reg[15] = regs->acr; /* ACR */ \
58  pr_reg[16] = 0; /* BZ */ \
59  pr_reg[17] = rdvr(); /* VR */ \
60  pr_reg[18] = 0; /* PID */ \
61  pr_reg[19] = regs->srs; /* SRS */ \
62  pr_reg[20] = 0; /* WZ */ \
63  pr_reg[21] = regs->exs; /* EXS */ \
64  pr_reg[22] = regs->eda; /* EDA */ \
65  pr_reg[23] = regs->mof; /* MOF */ \
66  pr_reg[24] = 0; /* DZ */ \
67  pr_reg[25] = 0; /* EBP */ \
68  pr_reg[26] = regs->erp; /* ERP */ \
69  pr_reg[27] = regs->srp; /* SRP */ \
70  pr_reg[28] = 0; /* NRP */ \
71  pr_reg[29] = regs->ccs; /* CCS */ \
72  pr_reg[30] = rdusp(); /* USP */ \
73  pr_reg[31] = regs->spc; /* SPC */ \
74 
75 #endif /* _ASM_CRIS_ELF_H */