diff options
-rw-r--r-- | arch/sparc64/kernel/binfmt_elf32.c | 31 | ||||
-rw-r--r-- | include/asm-sparc64/elf.h | 30 |
2 files changed, 9 insertions, 52 deletions
diff --git a/arch/sparc64/kernel/binfmt_elf32.c b/arch/sparc64/kernel/binfmt_elf32.c index 1587a29a4b0e..d141300e76b7 100644 --- a/arch/sparc64/kernel/binfmt_elf32.c +++ b/arch/sparc64/kernel/binfmt_elf32.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * binfmt_elf32.c: Support 32-bit Sparc ELF binaries on Ultra. | 2 | * binfmt_elf32.c: Support 32-bit Sparc ELF binaries on Ultra. |
3 | * | 3 | * |
4 | * Copyright (C) 1995, 1996, 1997, 1998 David S. Miller (davem@davemloft.net) | 4 | * Copyright (C) 1995, 1996, 1997, 1998, 2008 David S. Miller (davem@davemloft.net) |
5 | * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz) | 5 | * Copyright (C) 1995, 1996, 1997, 1998 Jakub Jelinek (jj@ultra.linux.cz) |
6 | */ | 6 | */ |
7 | 7 | ||
@@ -9,13 +9,6 @@ | |||
9 | #define ELF_CLASS ELFCLASS32 | 9 | #define ELF_CLASS ELFCLASS32 |
10 | #define ELF_DATA ELFDATA2MSB; | 10 | #define ELF_DATA ELFDATA2MSB; |
11 | 11 | ||
12 | /* For the most part we present code dumps in the format | ||
13 | * Solaris does. | ||
14 | */ | ||
15 | typedef unsigned int elf_greg_t; | ||
16 | #define ELF_NGREG 38 | ||
17 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
18 | |||
19 | /* Format is: | 12 | /* Format is: |
20 | * G0 --> G7 | 13 | * G0 --> G7 |
21 | * O0 --> O7 | 14 | * O0 --> O7 |
@@ -23,25 +16,9 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | |||
23 | * I0 --> I7 | 16 | * I0 --> I7 |
24 | * PSR, PC, nPC, Y, WIM, TBR | 17 | * PSR, PC, nPC, Y, WIM, TBR |
25 | */ | 18 | */ |
26 | #include <asm/psrcompat.h> | 19 | typedef unsigned int elf_greg_t; |
27 | #define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \ | 20 | #define ELF_NGREG 38 |
28 | do { unsigned int *dest = &(__elf_regs[0]); \ | 21 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; |
29 | struct pt_regs *src = (__pt_regs); \ | ||
30 | unsigned int __user *sp; \ | ||
31 | int i; \ | ||
32 | for(i = 0; i < 16; i++) \ | ||
33 | dest[i] = (unsigned int) src->u_regs[i];\ | ||
34 | /* Don't try this at home kids... */ \ | ||
35 | sp = (unsigned int __user *) (src->u_regs[14] & \ | ||
36 | 0x00000000fffffffc); \ | ||
37 | for(i = 0; i < 16; i++) \ | ||
38 | __get_user(dest[i+16], &sp[i]); \ | ||
39 | dest[32] = tstate_to_psr(src->tstate); \ | ||
40 | dest[33] = (unsigned int) src->tpc; \ | ||
41 | dest[34] = (unsigned int) src->tnpc; \ | ||
42 | dest[35] = src->y; \ | ||
43 | dest[36] = dest[37] = 0; /* XXX */ \ | ||
44 | } while(0); | ||
45 | 22 | ||
46 | typedef struct { | 23 | typedef struct { |
47 | union { | 24 | union { |
diff --git a/include/asm-sparc64/elf.h b/include/asm-sparc64/elf.h index 8653e8665009..217d768cf7dd 100644 --- a/include/asm-sparc64/elf.h +++ b/include/asm-sparc64/elf.h | |||
@@ -72,6 +72,8 @@ | |||
72 | #define HWCAP_SPARC_BLKINIT 64 | 72 | #define HWCAP_SPARC_BLKINIT 64 |
73 | #define HWCAP_SPARC_N2 128 | 73 | #define HWCAP_SPARC_N2 128 |
74 | 74 | ||
75 | #define CORE_DUMP_USE_REGSET | ||
76 | |||
75 | /* | 77 | /* |
76 | * These are used to set parameters in the core dumps. | 78 | * These are used to set parameters in the core dumps. |
77 | */ | 79 | */ |
@@ -80,10 +82,6 @@ | |||
80 | #define ELF_CLASS ELFCLASS64 | 82 | #define ELF_CLASS ELFCLASS64 |
81 | #define ELF_DATA ELFDATA2MSB | 83 | #define ELF_DATA ELFDATA2MSB |
82 | 84 | ||
83 | typedef unsigned long elf_greg_t; | ||
84 | |||
85 | #define ELF_NGREG 36 | ||
86 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | ||
87 | /* Format of 64-bit elf_gregset_t is: | 85 | /* Format of 64-bit elf_gregset_t is: |
88 | * G0 --> G7 | 86 | * G0 --> G7 |
89 | * O0 --> O7 | 87 | * O0 --> O7 |
@@ -94,24 +92,9 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; | |||
94 | * TNPC | 92 | * TNPC |
95 | * Y | 93 | * Y |
96 | */ | 94 | */ |
97 | #define ELF_CORE_COPY_REGS(__elf_regs, __pt_regs) \ | 95 | typedef unsigned long elf_greg_t; |
98 | do { unsigned long *dest = &(__elf_regs[0]); \ | 96 | #define ELF_NGREG 36 |
99 | struct pt_regs *src = (__pt_regs); \ | 97 | typedef elf_greg_t elf_gregset_t[ELF_NGREG]; |
100 | unsigned long __user *sp; \ | ||
101 | int i; \ | ||
102 | for(i = 0; i < 16; i++) \ | ||
103 | dest[i] = src->u_regs[i]; \ | ||
104 | /* Don't try this at home kids... */ \ | ||
105 | sp = (unsigned long __user *) \ | ||
106 | ((src->u_regs[14] + STACK_BIAS) \ | ||
107 | & 0xfffffffffffffff8UL); \ | ||
108 | for(i = 0; i < 16; i++) \ | ||
109 | __get_user(dest[i+16], &sp[i]); \ | ||
110 | dest[32] = src->tstate; \ | ||
111 | dest[33] = src->tpc; \ | ||
112 | dest[34] = src->tnpc; \ | ||
113 | dest[35] = src->y; \ | ||
114 | } while (0); | ||
115 | 98 | ||
116 | typedef struct { | 99 | typedef struct { |
117 | unsigned long pr_regs[32]; | 100 | unsigned long pr_regs[32]; |
@@ -121,9 +104,6 @@ typedef struct { | |||
121 | } elf_fpregset_t; | 104 | } elf_fpregset_t; |
122 | #endif | 105 | #endif |
123 | 106 | ||
124 | #define ELF_CORE_COPY_TASK_REGS(__tsk, __elf_regs) \ | ||
125 | ({ ELF_CORE_COPY_REGS((*(__elf_regs)), task_pt_regs(__tsk)); 1; }) | ||
126 | |||
127 | /* | 107 | /* |
128 | * This is used to ensure we don't load something for the wrong architecture. | 108 | * This is used to ensure we don't load something for the wrong architecture. |
129 | */ | 109 | */ |