File: /usr/src/linux/include/asm-sparc64/elf.h

1     /* $Id: elf.h,v 1.30 2001/08/30 23:35:38 kanoj Exp $ */
2     #ifndef __ASM_SPARC64_ELF_H
3     #define __ASM_SPARC64_ELF_H
4     
5     /*
6      * ELF register definitions..
7      */
8     
9     #include <asm/ptrace.h>
10     #ifdef __KERNEL__
11     #include <asm/processor.h>
12     #endif
13     
14     /*
15      * These are used to set parameters in the core dumps.
16      */
17     #ifndef ELF_ARCH
18     #define ELF_ARCH		EM_SPARCV9
19     #define ELF_CLASS		ELFCLASS64
20     #define ELF_DATA		ELFDATA2MSB
21     
22     typedef unsigned long elf_greg_t;
23     
24     #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
25     typedef elf_greg_t elf_gregset_t[ELF_NGREG];
26     
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
34     
35     /*
36      * This is used to ensure we don't load something for the wrong architecture.
37      */
38     #ifndef elf_check_arch
39     #define elf_check_arch(x) ((x)->e_machine == ELF_ARCH)	/* Might be EM_SPARCV9 or EM_SPARC */
40     #endif
41     
42     #define USE_ELF_CORE_DUMP
43     #define ELF_EXEC_PAGESIZE	PAGE_SIZE
44     
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.  */
49     
50     #ifndef ELF_ET_DYN_BASE
51     #define ELF_ET_DYN_BASE         0x0000010000000000UL
52     #endif
53     
54     
55     /* This yields a mask that user programs can use to figure out what
56        instruction set this cpu supports.  */
57     
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) | \
62     			 ((tlb_type == cheetah) ? HWCAP_SPARC_ULTRA3 : 0))
63     
64     /* This yields a string that ld.so will use to load implementation
65        specific libraries for optimization.  This is more specific in
66        intent than poking at uname or /proc/cpuinfo.  */
67     
68     #define ELF_PLATFORM	(NULL)
69     
70     #ifdef __KERNEL__
71     #define SET_PERSONALITY(ex, ibcs2)			\
72     do {	unsigned char flags = current->thread.flags;	\
73     	if ((ex).e_ident[EI_CLASS] == ELFCLASS32)	\
74     		flags |= SPARC_FLAG_32BIT;		\
75     	else						\
76     		flags &= ~SPARC_FLAG_32BIT;		\
77     	if (flags != current->thread.flags) {		\
78     		unsigned long pgd_cache = 0UL;		\
79     		if (flags & SPARC_FLAG_32BIT) {		\
80     		  pgd_t *pgd0 = &current->mm->pgd[0];	\
81     		  if (pgd_none (*pgd0)) {		\
82     		    pmd_t *page = pmd_alloc_one_fast(NULL, 0);	\
83     		    if (!page)				\
84     		      page = pmd_alloc_one(NULL, 0);	\
85                         pgd_set(pgd0, page);		\
86     		  }					\
87     		  pgd_cache = pgd_val(*pgd0) << 11UL;	\
88     		}					\
89     		__asm__ __volatile__(			\
90     			"stxa\t%0, [%1] %2\n\t"		\
91     			"membar #Sync"			\
92     			: /* no outputs */		\
93     			: "r" (pgd_cache),		\
94     			  "r" (TSB_REG),		\
95     			  "i" (ASI_DMMU));		\
96     		current->thread.flags = flags;		\
97     	}						\
98     							\
99     	if (ibcs2)					\
100     		set_personality(PER_SVR4);		\
101     	else if (current->personality != PER_LINUX32)	\
102     		set_personality(PER_LINUX);		\
103     } while (0)
104     #endif
105     
106     #endif /* !(__ASM_SPARC64_ELF_H) */
107