1 /* $Id: elf.h,v 1.1.1.1 2005/04/11 02:50:57 jack Exp $ */
2 #ifndef __ASM_SPARC64_ELF_H
3 #define __ASM_SPARC64_ELF_H
6 * ELF register definitions..
9 #include <asm/ptrace.h>
11 #include <asm/processor.h>
15 * These are used to set parameters in the core dumps.
18 #define ELF_ARCH EM_SPARCV9
19 #define ELF_CLASS ELFCLASS64
20 #define ELF_DATA ELFDATA2MSB
22 typedef unsigned long elf_greg_t;
25 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
26 /* Format of 64-bit elf_gregset_t is:
36 #include <asm/psrcompat.h>
37 #define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \
38 do { unsigned long *dest = &(__elf_regs[0]); \
39 struct pt_regs *src = (__pt_regs); \
42 for(i = 0; i < 16; i++) \
43 dest[i] = src->u_regs[i]; \
44 /* Don't try this at home kids... */ \
46 sp = (unsigned long *) \
47 ((src->u_regs[14] + STACK_BIAS) \
48 & 0xfffffffffffffff8UL); \
49 for(i = 0; i < 16; i++) \
50 __get_user(dest[i+16], &sp[i]); \
52 dest[32] = src->tstate; \
53 dest[33] = src->tpc; \
54 dest[34] = src->tnpc; \
59 unsigned long pr_regs[32];
62 unsigned long pr_fprs;
67 * This is used to ensure we don't load something for the wrong architecture.
69 #ifndef elf_check_arch
70 #define elf_check_arch(x) ((x)->e_machine == ELF_ARCH) /* Might be EM_SPARCV9 or EM_SPARC */
73 #define USE_ELF_CORE_DUMP
74 #define ELF_EXEC_PAGESIZE PAGE_SIZE
76 /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
77 use of this is to invoke "./ld.so someprog" to test out a new version of
78 the loader. We need to make sure that it is out of the way of the program
79 that it will "exec", and that there is sufficient room for the brk. */
81 #ifndef ELF_ET_DYN_BASE
82 #define ELF_ET_DYN_BASE 0x0000010000000000UL
86 /* This yields a mask that user programs can use to figure out what
87 instruction set this cpu supports. */
89 /* On Ultra, we support all of the v8 capabilities. */
90 #define ELF_HWCAP ((HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \
91 HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | \
93 ((tlb_type == cheetah || tlb_type == cheetah_plus) ? \
94 HWCAP_SPARC_ULTRA3 : 0))
96 /* This yields a string that ld.so will use to load implementation
97 specific libraries for optimization. This is more specific in
98 intent than poking at uname or /proc/cpuinfo. */
100 #define ELF_PLATFORM (NULL)
103 #define SET_PERSONALITY(ex, ibcs2) \
104 do { unsigned char flags = current->thread.flags; \
105 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
106 flags |= SPARC_FLAG_32BIT; \
108 flags &= ~SPARC_FLAG_32BIT; \
109 if (flags != current->thread.flags) { \
110 /* flush_thread will update pgd cache */\
111 current->thread.flags |= SPARC_FLAG_ABI_PENDING; \
113 current->thread.flags &= ~SPARC_FLAG_ABI_PENDING; \
116 set_personality(PER_SVR4); \
117 else if (current->personality != PER_LINUX32) \
118 set_personality(PER_LINUX); \
122 #endif /* !(__ASM_SPARC64_ELF_H) */