MOXA linux-2.6.x / linux-2.6.19-uc1 from UC-7110-LX-BOOTLOADER-1.9_VERSION-4.2.tgz
[linux-2.6.19-moxart.git] / include / asm-nios2nommu / elf.h
blob94b2ac0b20bda3e464e18d50dfa6503ed6122804
1 #ifndef __NIOS2_ELF_H
2 #define __NIOS2_ELF_H
4 /*--------------------------------------------------------------------
6 * include/asm-nios2nommu/elf.h
8 * Nio2 ELF relocation types
10 * Derived from M68knommu
12 * Copyright (C) 2004 Microtronix Datacom Ltd
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * Jan/20/2004 dgt NiosII
25 * Mar/18/2004 xwt NiosII relocation types added
27 ---------------------------------------------------------------------*/
29 #include <asm/ptrace.h>
30 #include <asm/user.h>
32 #define R_NIOS2_NONE 0
33 #define R_NIOS2_S16 1
34 #define R_NIOS2_U16 2
35 #define R_NIOS2_PCREL16 3
36 #define R_NIOS2_CALL26 4
37 #define R_NIOS2_IMM5 5
38 #define R_NIOS2_CACHE_OPX 6
39 #define R_NIOS2_IMM6 7
40 #define R_NIOS2_IMM8 8
41 #define R_NIOS2_HI16 9
42 #define R_NIOS2_LO16 10
43 #define R_NIOS2_HIADJ16 11
44 #define R_NIOS2_BFD_RELOC_32 12
45 #define R_NIOS2_BFD_RELOC_16 13
46 #define R_NIOS2_BFD_RELOC_8 14
47 #define R_NIOS2_GPREL 15
48 #define R_NIOS2_GNU_VTINHERIT 16
49 #define R_NIOS2_GNU_VTENTRY 17
50 #define R_NIOS2_UJMP 18
51 #define R_NIOS2_CJMP 19
52 #define R_NIOS2_CALLR 20
53 #define R_NIOS2_ALIGN 21
54 /* Keep this the last entry. */
55 #define R_NIOS2_NUM 22
57 typedef unsigned long elf_greg_t;
59 #define ELF_NGREG (sizeof (struct user_regs_struct) / sizeof(elf_greg_t))
60 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
62 typedef unsigned long elf_fpregset_t;
65 * This is used to ensure we don't load something for the wrong architecture.
67 #define elf_check_arch(x) \
68 ((x)->e_machine == EM_ALTERA_NIOS2)
71 * These are used to set parameters in the core dumps.
73 #define ELF_CLASS ELFCLASS32
74 #define ELF_DATA ELFDATA2LSB
75 #define ELF_ARCH EM_ALTERA_NIOS2
77 #define ELF_PLAT_INIT(_r, load_addr) _r->a1 = 0
79 #define USE_ELF_CORE_DUMP
80 #define ELF_EXEC_PAGESIZE 4096
82 /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
83 use of this is to invoke "./ld.so someprog" to test out a new version of
84 the loader. We need to make sure that it is out of the way of the program
85 that it will "exec", and that there is sufficient room for the brk. */
87 #define ELF_ET_DYN_BASE 0xD0000000UL
89 /* regs is struct pt_regs, pr_reg is elf_gregset_t (which is
90 now struct_user_regs, they are different) */
92 #define ELF_CORE_COPY_REGS(pr_reg, regs) \
93 /* Bleech. */ \
94 pr_reg[0] = regs->r1; \
95 pr_reg[1] = regs->r2; \
96 pr_reg[2] = regs->r3; \
97 pr_reg[3] = regs->r4; \
98 pr_reg[4] = regs->r5; \
99 pr_reg[5] = regs->r6; \
100 pr_reg[6] = regs->r7; \
101 pr_reg[7] = regs->r8; \
102 pr_reg[8] = regs->r9; \
103 pr_reg[9] = regs->r10; \
104 pr_reg[10] = regs->r11; \
105 pr_reg[11] = regs->r12; \
106 pr_reg[12] = regs->r13; \
107 pr_reg[13] = regs->r14; \
108 pr_reg[14] = regs->r15; \
109 pr_reg[23] = regs->sp; \
110 pr_reg[26] = regs->estatus; \
112 struct switch_stack *sw = ((struct switch_stack *)regs) - 1; \
113 pr_reg[15] = sw->r16; \
114 pr_reg[16] = sw->r17; \
115 pr_reg[17] = sw->r18; \
116 pr_reg[18] = sw->r19; \
117 pr_reg[19] = sw->r20; \
118 pr_reg[20] = sw->r21; \
119 pr_reg[21] = sw->r22; \
120 pr_reg[22] = sw->r23; \
121 pr_reg[24] = sw->fp; \
122 pr_reg[25] = sw->gp; \
125 /* This yields a mask that user programs can use to figure out what
126 instruction set this cpu supports. */
128 #define ELF_HWCAP (0)
130 /* This yields a string that ld.so will use to load implementation
131 specific libraries for optimization. This is more specific in
132 intent than poking at uname or /proc/cpuinfo. */
134 #define ELF_PLATFORM (NULL)
136 #ifdef __KERNEL__
137 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
138 #endif
140 #endif