Import 2.3.18pre1
[davej-history.git] / include / asm-sparc64 / elf.h
blob6fc6c3c03f601dd8bb926e732e4c4e99f8083b58
1 /* $Id: elf.h,v 1.21 1999/08/04 07:04:23 jj Exp $ */
2 #ifndef __ASM_SPARC64_ELF_H
3 #define __ASM_SPARC64_ELF_H
5 /*
6 * ELF register definitions..
7 */
9 #include <asm/ptrace.h>
10 #ifdef __KERNEL__
11 #include <asm/processor.h>
12 #endif
15 * These are used to set parameters in the core dumps.
17 #ifndef ELF_ARCH
18 #define ELF_ARCH EM_SPARCV9
19 #define ELF_CLASS ELFCLASS64
20 #define ELF_DATA ELFDATA2MSB
22 typedef unsigned long elf_greg_t;
24 #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
25 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
27 typedef struct {
28 unsigned long pr_regs[32];
29 unsigned long pr_fsr;
30 unsigned long pr_gsr;
31 unsigned long pr_fprs;
32 } elf_fpregset_t;
33 #endif
36 * This is used to ensure we don't load something for the wrong architecture.
38 #ifndef elf_check_arch
39 #define elf_check_arch(x) ((x) == ELF_ARCH) /* Might be EM_SPARCV9 or EM_SPARC */
40 #endif
42 #define USE_ELF_CORE_DUMP
43 #define ELF_EXEC_PAGESIZE 8192
45 /* This is the location that an ET_DYN program is loaded if exec'ed. Typical
46 use of this is to invoke "./ld.so someprog" to test out a new version of
47 the loader. We need to make sure that it is out of the way of the program
48 that it will "exec", and that there is sufficient room for the brk. */
50 #ifndef ELF_ET_DYN_BASE
51 #define ELF_ET_DYN_BASE 0xfffff80000000000UL
52 #endif
55 /* This yields a mask that user programs can use to figure out what
56 instruction set this cpu supports. */
58 /* On Ultra, we support all of the v8 capabilities. */
59 #define ELF_HWCAP (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \
60 HWCAP_SPARC_SWAP | HWCAP_SPARC_MULDIV | \
61 HWCAP_SPARC_V9)
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. */
67 #define ELF_PLATFORM (NULL)
69 #ifdef __KERNEL__
70 #define SET_PERSONALITY(ex, ibcs2) \
71 do { unsigned char flags = current->thread.flags; \
72 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
73 flags |= SPARC_FLAG_32BIT; \
74 else \
75 flags &= ~SPARC_FLAG_32BIT; \
76 if (flags != current->thread.flags) { \
77 unsigned long pgd_cache = 0UL; \
78 if (flags & SPARC_FLAG_32BIT) \
79 pgd_cache = \
80 pgd_val(current->mm->pgd[0])<<11UL; \
81 __asm__ __volatile__( \
82 "stxa\t%0, [%1] %2" \
83 : /* no outputs */ \
84 : "r" (pgd_cache), \
85 "r" (TSB_REG), \
86 "i" (ASI_DMMU)); \
87 current->thread.flags = flags; \
88 } \
90 if (ibcs2) \
91 current->personality = PER_SVR4; \
92 else if (current->personality != PER_LINUX32) \
93 current->personality = PER_LINUX; \
94 } while (0)
95 #endif
97 #endif /* !(__ASM_SPARC64_ELF_H) */