more changes on original files
[linux-2.4.git] / asm-sparc / elf.h
1 /* $Id: elf.h,v 1.22 2000/07/12 01:27:08 davem Exp $ */
2 #ifndef __ASMSPARC_ELF_H
3 #define __ASMSPARC_ELF_H
4
5 /*
6  * ELF register definitions..
7  */
8
9 #include <linux/config.h>
10 #include <asm/ptrace.h>
11 #include <asm/mbus.h>
12
13 /* For the most part we present code dumps in the format
14  * Solaris does.
15  */
16 typedef unsigned long elf_greg_t;
17 #define ELF_NGREG 38
18 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
19
20 /* Format is:
21  *      G0 --> G7
22  *      O0 --> O7
23  *      L0 --> L7
24  *      I0 --> I7
25  *      PSR, PC, nPC, Y, WIM, TBR
26  */
27 #define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs)       \
28 do {    unsigned long *dest = &(__elf_regs[0]);         \
29         struct pt_regs *src = (__pt_regs);              \
30         unsigned long *sp;                              \
31         memcpy(&dest[0], &src->u_regs[0],               \
32                sizeof(unsigned long) * 16);             \
33         /* Don't try this at home kids... */            \
34         set_fs(USER_DS);                                \
35         sp = (unsigned long *) src->u_regs[14];         \
36         copy_from_user(&dest[16], sp,                   \
37                        sizeof(unsigned long) * 16);     \
38         set_fs(KERNEL_DS);                              \
39         dest[32] = src->psr;                            \
40         dest[33] = src->pc;                             \
41         dest[34] = src->npc;                            \
42         dest[35] = src->y;                              \
43         dest[36] = dest[37] = 0; /* XXX */              \
44 } while(0);
45
46 typedef struct {
47         union {
48                 unsigned long   pr_regs[32];
49                 double          pr_dregs[16];
50         } pr_fr;
51         unsigned long __unused;
52         unsigned long   pr_fsr;
53         unsigned char   pr_qcnt;
54         unsigned char   pr_q_entrysize;
55         unsigned char   pr_en;
56         unsigned int    pr_q[64];
57 } elf_fpregset_t;
58
59 /*
60  * This is used to ensure we don't load something for the wrong architecture.
61  */
62 #define elf_check_arch(x) ((x)->e_machine == EM_SPARC)
63
64 /*
65  * These are used to set parameters in the core dumps.
66  */
67 #define ELF_ARCH        EM_SPARC
68 #define ELF_CLASS       ELFCLASS32
69 #define ELF_DATA        ELFDATA2MSB
70
71 #define USE_ELF_CORE_DUMP
72 #ifndef CONFIG_SUN4
73 #define ELF_EXEC_PAGESIZE       4096
74 #else
75 #define ELF_EXEC_PAGESIZE       8192
76 #endif
77
78
79 /* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
80    use of this is to invoke "./ld.so someprog" to test out a new version of
81    the loader.  We need to make sure that it is out of the way of the program
82    that it will "exec", and that there is sufficient room for the brk.  */
83
84 #define ELF_ET_DYN_BASE         (TASK_UNMAPPED_BASE)
85
86 /* This yields a mask that user programs can use to figure out what
87    instruction set this cpu supports.  This can NOT be done in userspace
88    on Sparc.  */
89
90 /* Sun4c has none of the capabilities, most sun4m's have them all.
91  * XXX This is gross, set some global variable at boot time. -DaveM
92  */
93 #define ELF_HWCAP       ((ARCH_SUN4C_SUN4) ? 0 : \
94                          (HWCAP_SPARC_FLUSH | HWCAP_SPARC_STBAR | \
95                           HWCAP_SPARC_SWAP | \
96                           ((srmmu_modtype != Cypress && \
97                             srmmu_modtype != Cypress_vE && \
98                             srmmu_modtype != Cypress_vD) ? \
99                            HWCAP_SPARC_MULDIV : 0)))
100
101 /* This yields a string that ld.so will use to load implementation
102    specific libraries for optimization.  This is more specific in
103    intent than poking at uname or /proc/cpuinfo. */
104
105 #define ELF_PLATFORM    (NULL)
106
107 #ifdef __KERNEL__
108 #define SET_PERSONALITY(ex, ibcs2) set_personality((ibcs2)?PER_SVR4:PER_LINUX)
109 #endif
110
111 #endif /* !(__ASMSPARC_ELF_H) */