Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 1 | #ifndef __ASMSPARC_ELF_H |
| 2 | #define __ASMSPARC_ELF_H |
| 3 | |
| 4 | /* |
| 5 | * ELF register definitions.. |
| 6 | */ |
| 7 | |
| 8 | #include <asm/ptrace.h> |
| 9 | |
| 10 | /* |
| 11 | * Sparc section types |
| 12 | */ |
| 13 | #define STT_REGISTER 13 |
| 14 | |
| 15 | /* |
| 16 | * Sparc ELF relocation types |
| 17 | */ |
| 18 | #define R_SPARC_NONE 0 |
| 19 | #define R_SPARC_8 1 |
| 20 | #define R_SPARC_16 2 |
| 21 | #define R_SPARC_32 3 |
| 22 | #define R_SPARC_DISP8 4 |
| 23 | #define R_SPARC_DISP16 5 |
| 24 | #define R_SPARC_DISP32 6 |
| 25 | #define R_SPARC_WDISP30 7 |
| 26 | #define R_SPARC_WDISP22 8 |
| 27 | #define R_SPARC_HI22 9 |
| 28 | #define R_SPARC_22 10 |
| 29 | #define R_SPARC_13 11 |
| 30 | #define R_SPARC_LO10 12 |
| 31 | #define R_SPARC_GOT10 13 |
| 32 | #define R_SPARC_GOT13 14 |
| 33 | #define R_SPARC_GOT22 15 |
| 34 | #define R_SPARC_PC10 16 |
| 35 | #define R_SPARC_PC22 17 |
| 36 | #define R_SPARC_WPLT30 18 |
| 37 | #define R_SPARC_COPY 19 |
| 38 | #define R_SPARC_GLOB_DAT 20 |
| 39 | #define R_SPARC_JMP_SLOT 21 |
| 40 | #define R_SPARC_RELATIVE 22 |
| 41 | #define R_SPARC_UA32 23 |
| 42 | #define R_SPARC_PLT32 24 |
| 43 | #define R_SPARC_HIPLT22 25 |
| 44 | #define R_SPARC_LOPLT10 26 |
| 45 | #define R_SPARC_PCPLT32 27 |
| 46 | #define R_SPARC_PCPLT22 28 |
| 47 | #define R_SPARC_PCPLT10 29 |
| 48 | #define R_SPARC_10 30 |
| 49 | #define R_SPARC_11 31 |
| 50 | #define R_SPARC_64 32 |
| 51 | #define R_SPARC_OLO10 33 |
| 52 | #define R_SPARC_WDISP16 40 |
| 53 | #define R_SPARC_WDISP19 41 |
| 54 | #define R_SPARC_7 43 |
| 55 | #define R_SPARC_5 44 |
| 56 | #define R_SPARC_6 45 |
| 57 | |
| 58 | /* Bits present in AT_HWCAP, primarily for Sparc32. */ |
| 59 | |
| 60 | #define HWCAP_SPARC_FLUSH 1 /* CPU supports flush instruction. */ |
| 61 | #define HWCAP_SPARC_STBAR 2 |
| 62 | #define HWCAP_SPARC_SWAP 4 |
| 63 | #define HWCAP_SPARC_MULDIV 8 |
| 64 | #define HWCAP_SPARC_V9 16 |
| 65 | #define HWCAP_SPARC_ULTRA3 32 |
| 66 | |
| 67 | #define CORE_DUMP_USE_REGSET |
| 68 | |
| 69 | /* Format is: |
| 70 | * G0 --> G7 |
| 71 | * O0 --> O7 |
| 72 | * L0 --> L7 |
| 73 | * I0 --> I7 |
| 74 | * PSR, PC, nPC, Y, WIM, TBR |
| 75 | */ |
| 76 | typedef unsigned long elf_greg_t; |
| 77 | #define ELF_NGREG 38 |
| 78 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; |
| 79 | |
| 80 | typedef struct { |
| 81 | union { |
| 82 | unsigned long pr_regs[32]; |
| 83 | double pr_dregs[16]; |
| 84 | } pr_fr; |
| 85 | unsigned long __unused; |
| 86 | unsigned long pr_fsr; |
| 87 | unsigned char pr_qcnt; |
| 88 | unsigned char pr_q_entrysize; |
| 89 | unsigned char pr_en; |
| 90 | unsigned int pr_q[64]; |
| 91 | } elf_fpregset_t; |
| 92 | |
| 93 | #include <asm/mbus.h> |
| 94 | |
| 95 | /* |
| 96 | * This is used to ensure we don't load something for the wrong architecture. |
| 97 | */ |
| 98 | #define elf_check_arch(x) ((x)->e_machine == EM_SPARC) |
| 99 | |
| 100 | /* |
| 101 | * These are used to set parameters in the core dumps. |
| 102 | */ |
| 103 | #define ELF_ARCH EM_SPARC |
| 104 | #define ELF_CLASS ELFCLASS32 |
| 105 | #define ELF_DATA ELFDATA2MSB |
| 106 | |
| 107 | #define USE_ELF_CORE_DUMP |
Adrian Bunk | 5110bd2 | 2008-08-31 20:59:37 -0700 | [diff] [blame] | 108 | |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 109 | #define ELF_EXEC_PAGESIZE 4096 |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 110 | |
| 111 | |
| 112 | /* This is the location that an ET_DYN program is loaded if exec'ed. Typical |
| 113 | use of this is to invoke "./ld.so someprog" to test out a new version of |
| 114 | the loader. We need to make sure that it is out of the way of the program |
| 115 | that it will "exec", and that there is sufficient room for the brk. */ |
| 116 | |
| 117 | #define ELF_ET_DYN_BASE (TASK_UNMAPPED_BASE) |
| 118 | |
| 119 | /* This yields a mask that user programs can use to figure out what |
| 120 | instruction set this cpu supports. This can NOT be done in userspace |
| 121 | on Sparc. */ |
| 122 | |
| 123 | /* Sun4c has none of the capabilities, most sun4m's have them all. |
| 124 | * XXX This is gross, set some global variable at boot time. -DaveM |
| 125 | */ |
Adrian Bunk | 5110bd2 | 2008-08-31 20:59:37 -0700 | [diff] [blame] | 126 | #define ELF_HWCAP ((ARCH_SUN4C) ? 0 : \ |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 127 | (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \ |
| 128 | HWCAP_SPARC_SWAP | \ |
| 129 | ((srmmu_modtype != Cypress && \ |
| 130 | srmmu_modtype != Cypress_vE && \ |
| 131 | srmmu_modtype != Cypress_vD) ? \ |
| 132 | HWCAP_SPARC_MULDIV : 0))) |
| 133 | |
| 134 | /* This yields a string that ld.so will use to load implementation |
| 135 | specific libraries for optimization. This is more specific in |
| 136 | intent than poking at uname or /proc/cpuinfo. */ |
| 137 | |
| 138 | #define ELF_PLATFORM (NULL) |
| 139 | |
Martin Schwidefsky | 0b59268 | 2008-10-16 15:39:57 +0200 | [diff] [blame] | 140 | #define SET_PERSONALITY(ex) set_personality(PER_LINUX) |
Sam Ravnborg | f5e706a | 2008-07-17 21:55:51 -0700 | [diff] [blame] | 141 | |
| 142 | #endif /* !(__ASMSPARC_ELF_H) */ |