ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-arm / elf.h
1 #ifndef __ASMARM_ELF_H
2 #define __ASMARM_ELF_H
3
4 /*
5  * ELF register definitions..
6  */
7
8 #include <asm/ptrace.h>
9 #include <asm/user.h>
10 #include <asm/procinfo.h>
11
12 typedef unsigned long elf_greg_t;
13 typedef unsigned long elf_freg_t[3];
14
15 #define EM_ARM  40
16 #define EF_ARM_APCS26 0x08
17
18 #define R_ARM_NONE      0
19 #define R_ARM_PC24      1
20 #define R_ARM_ABS32     2
21
22 #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
23 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
24
25 typedef struct user_fp elf_fpregset_t;
26
27 /*
28  * This is used to ensure we don't load something for the wrong architecture.
29  */
30 #define elf_check_arch(x) ( ((x)->e_machine == EM_ARM) && (ELF_PROC_OK((x))) )
31
32 /*
33  * These are used to set parameters in the core dumps.
34  */
35 #define ELF_CLASS       ELFCLASS32
36 #ifdef __ARMEB__
37 #define ELF_DATA        ELFDATA2MSB;
38 #else
39 #define ELF_DATA        ELFDATA2LSB;
40 #endif
41 #define ELF_ARCH        EM_ARM
42
43 #define USE_ELF_CORE_DUMP
44 #define ELF_EXEC_PAGESIZE       4096
45
46 /* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
47    use of this is to invoke "./ld.so someprog" to test out a new version of
48    the loader.  We need to make sure that it is out of the way of the program
49    that it will "exec", and that there is sufficient room for the brk.  */
50
51 #define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
52
53 /* When the program starts, a1 contains a pointer to a function to be 
54    registered with atexit, as per the SVR4 ABI.  A value of 0 means we 
55    have no such handler.  */
56 #define ELF_PLAT_INIT(_r, load_addr)    (_r)->ARM_r0 = 0
57
58 /* This yields a mask that user programs can use to figure out what
59    instruction set this cpu supports. */
60
61 #define ELF_HWCAP       (elf_hwcap)
62
63 /* This yields a string that ld.so will use to load implementation
64    specific libraries for optimization.  This is more specific in
65    intent than poking at uname or /proc/cpuinfo. */
66
67 /* For now we just provide a fairly general string that describes the
68    processor family.  This could be made more specific later if someone
69    implemented optimisations that require it.  26-bit CPUs give you
70    "v1l" for ARM2 (no SWP) and "v2l" for anything else (ARM1 isn't
71    supported).  32-bit CPUs give you "v3[lb]" for anything based on an
72    ARM6 or ARM7 core and "armv4[lb]" for anything based on a StrongARM-1
73    core.  */
74
75 #define ELF_PLATFORM_SIZE 8
76 extern char elf_platform[];
77 #define ELF_PLATFORM    (elf_platform)
78
79 #ifdef __KERNEL__
80
81 /*
82  * 32-bit code is always OK.  Some cpus can do 26-bit, some can't.
83  */
84 #define ELF_PROC_OK(x)  (ELF_THUMB_OK(x) && ELF_26BIT_OK(x))
85
86 #define ELF_THUMB_OK(x) \
87         (( (elf_hwcap & HWCAP_THUMB) && ((x)->e_entry & 1) == 1) || \
88          ((x)->e_entry & 3) == 0)
89
90 #define ELF_26BIT_OK(x) \
91         (( (elf_hwcap & HWCAP_26BIT) && (x)->e_flags & EF_ARM_APCS26) || \
92           ((x)->e_flags & EF_ARM_APCS26) == 0)
93
94 /* Old NetWinder binaries were compiled in such a way that the iBCS
95    heuristic always trips on them.  Until these binaries become uncommon
96    enough not to care, don't trust the `ibcs' flag here.  In any case
97    there is no other ELF system currently supported by iBCS.
98    @@ Could print a warning message to encourage users to upgrade.  */
99 #define SET_PERSONALITY(ex,ibcs2) \
100         set_personality(((ex).e_flags&EF_ARM_APCS26 ?PER_LINUX :PER_LINUX_32BIT))
101
102 #endif
103
104 #endif