aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-01-30 07:30:56 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:30:56 -0500
commit742fa54a62be6a263df14a553bf832724471dfbe (patch)
tree991589593b078eb2ede035f511e4b85b11b95a9c /arch/x86/kernel
parent153d5f2e5787c74e9cbb6b6687c9b04be1b59893 (diff)
x86: use generic register names in struct sigcontext
Switch struct sigcontext (defined in <asm/sigcontext*.h>) to using register names withut e- or r-prefixes for both 32- and 64-bit x86. This is intended as a preliminary step in unifying this code between architectures. Signed-off-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/asm-offsets_32.c18
-rw-r--r--arch/x86/kernel/asm-offsets_64.c18
-rw-r--r--arch/x86/kernel/signal_32.c28
-rw-r--r--arch/x86/kernel/signal_64.c29
4 files changed, 46 insertions, 47 deletions
diff --git a/arch/x86/kernel/asm-offsets_32.c b/arch/x86/kernel/asm-offsets_32.c
index a3a8be7618d1..4fc24a61f431 100644
--- a/arch/x86/kernel/asm-offsets_32.c
+++ b/arch/x86/kernel/asm-offsets_32.c
@@ -38,15 +38,15 @@ void foo(void);
38 38
39void foo(void) 39void foo(void)
40{ 40{
41 OFFSET(IA32_SIGCONTEXT_eax, sigcontext, eax); 41 OFFSET(IA32_SIGCONTEXT_ax, sigcontext, ax);
42 OFFSET(IA32_SIGCONTEXT_ebx, sigcontext, ebx); 42 OFFSET(IA32_SIGCONTEXT_bx, sigcontext, bx);
43 OFFSET(IA32_SIGCONTEXT_ecx, sigcontext, ecx); 43 OFFSET(IA32_SIGCONTEXT_cx, sigcontext, cx);
44 OFFSET(IA32_SIGCONTEXT_edx, sigcontext, edx); 44 OFFSET(IA32_SIGCONTEXT_dx, sigcontext, dx);
45 OFFSET(IA32_SIGCONTEXT_esi, sigcontext, esi); 45 OFFSET(IA32_SIGCONTEXT_si, sigcontext, si);
46 OFFSET(IA32_SIGCONTEXT_edi, sigcontext, edi); 46 OFFSET(IA32_SIGCONTEXT_di, sigcontext, di);
47 OFFSET(IA32_SIGCONTEXT_ebp, sigcontext, ebp); 47 OFFSET(IA32_SIGCONTEXT_bp, sigcontext, bp);
48 OFFSET(IA32_SIGCONTEXT_esp, sigcontext, esp); 48 OFFSET(IA32_SIGCONTEXT_sp, sigcontext, sp);
49 OFFSET(IA32_SIGCONTEXT_eip, sigcontext, eip); 49 OFFSET(IA32_SIGCONTEXT_ip, sigcontext, ip);
50 BLANK(); 50 BLANK();
51 51
52 OFFSET(CPUINFO_x86, cpuinfo_x86, x86); 52 OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
diff --git a/arch/x86/kernel/asm-offsets_64.c b/arch/x86/kernel/asm-offsets_64.c
index 2e918ebf21d3..a05428764314 100644
--- a/arch/x86/kernel/asm-offsets_64.c
+++ b/arch/x86/kernel/asm-offsets_64.c
@@ -63,15 +63,15 @@ int main(void)
63#undef ENTRY 63#undef ENTRY
64#ifdef CONFIG_IA32_EMULATION 64#ifdef CONFIG_IA32_EMULATION
65#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry)) 65#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
66 ENTRY(eax); 66 ENTRY(ax);
67 ENTRY(ebx); 67 ENTRY(bx);
68 ENTRY(ecx); 68 ENTRY(cx);
69 ENTRY(edx); 69 ENTRY(dx);
70 ENTRY(esi); 70 ENTRY(si);
71 ENTRY(edi); 71 ENTRY(di);
72 ENTRY(ebp); 72 ENTRY(bp);
73 ENTRY(esp); 73 ENTRY(sp);
74 ENTRY(eip); 74 ENTRY(ip);
75 BLANK(); 75 BLANK();
76#undef ENTRY 76#undef ENTRY
77 DEFINE(IA32_RT_SIGFRAME_sigcontext, 77 DEFINE(IA32_RT_SIGFRAME_sigcontext,
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index 40fd3515ccf1..64cb3c05de69 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -105,7 +105,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax
105 /* Always make any pending restarted system calls return -EINTR */ 105 /* Always make any pending restarted system calls return -EINTR */
106 current_thread_info()->restart_block.fn = do_no_restart_syscall; 106 current_thread_info()->restart_block.fn = do_no_restart_syscall;
107 107
108#define COPY(x) err |= __get_user(regs->x, &sc->e ## x) 108#define COPY(x) err |= __get_user(regs->x, &sc->x)
109 109
110#define COPY_SEG(seg) \ 110#define COPY_SEG(seg) \
111 { unsigned short tmp; \ 111 { unsigned short tmp; \
@@ -144,7 +144,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax
144 144
145 { 145 {
146 unsigned int tmpflags; 146 unsigned int tmpflags;
147 err |= __get_user(tmpflags, &sc->eflags); 147 err |= __get_user(tmpflags, &sc->flags);
148 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS); 148 regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
149 regs->orig_ax = -1; /* disable syscall checks */ 149 regs->orig_ax = -1; /* disable syscall checks */
150 } 150 }
@@ -165,7 +165,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax
165 } 165 }
166 } 166 }
167 167
168 err |= __get_user(*peax, &sc->eax); 168 err |= __get_user(*peax, &sc->ax);
169 return err; 169 return err;
170 170
171badframe: 171badframe:
@@ -256,20 +256,20 @@ setup_sigcontext(struct sigcontext __user *sc, struct _fpstate __user *fpstate,
256 256
257 err |= __put_user(regs->es, (unsigned int __user *)&sc->es); 257 err |= __put_user(regs->es, (unsigned int __user *)&sc->es);
258 err |= __put_user(regs->ds, (unsigned int __user *)&sc->ds); 258 err |= __put_user(regs->ds, (unsigned int __user *)&sc->ds);
259 err |= __put_user(regs->di, &sc->edi); 259 err |= __put_user(regs->di, &sc->di);
260 err |= __put_user(regs->si, &sc->esi); 260 err |= __put_user(regs->si, &sc->si);
261 err |= __put_user(regs->bp, &sc->ebp); 261 err |= __put_user(regs->bp, &sc->bp);
262 err |= __put_user(regs->sp, &sc->esp); 262 err |= __put_user(regs->sp, &sc->sp);
263 err |= __put_user(regs->bx, &sc->ebx); 263 err |= __put_user(regs->bx, &sc->bx);
264 err |= __put_user(regs->dx, &sc->edx); 264 err |= __put_user(regs->dx, &sc->dx);
265 err |= __put_user(regs->cx, &sc->ecx); 265 err |= __put_user(regs->cx, &sc->cx);
266 err |= __put_user(regs->ax, &sc->eax); 266 err |= __put_user(regs->ax, &sc->ax);
267 err |= __put_user(current->thread.trap_no, &sc->trapno); 267 err |= __put_user(current->thread.trap_no, &sc->trapno);
268 err |= __put_user(current->thread.error_code, &sc->err); 268 err |= __put_user(current->thread.error_code, &sc->err);
269 err |= __put_user(regs->ip, &sc->eip); 269 err |= __put_user(regs->ip, &sc->ip);
270 err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs); 270 err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs);
271 err |= __put_user(regs->flags, &sc->eflags); 271 err |= __put_user(regs->flags, &sc->flags);
272 err |= __put_user(regs->sp, &sc->esp_at_signal); 272 err |= __put_user(regs->sp, &sc->sp_at_signal);
273 err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss); 273 err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss);
274 274
275 tmp = save_i387(fpstate); 275 tmp = save_i387(fpstate);
diff --git a/arch/x86/kernel/signal_64.c b/arch/x86/kernel/signal_64.c
index 4b228fd83b31..1c9bca56fb55 100644
--- a/arch/x86/kernel/signal_64.c
+++ b/arch/x86/kernel/signal_64.c
@@ -62,11 +62,10 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned
62 /* Always make any pending restarted system calls return -EINTR */ 62 /* Always make any pending restarted system calls return -EINTR */
63 current_thread_info()->restart_block.fn = do_no_restart_syscall; 63 current_thread_info()->restart_block.fn = do_no_restart_syscall;
64 64
65#define COPYR(x) err |= __get_user(regs->x, &sc->r ## x)
66#define COPY(x) err |= __get_user(regs->x, &sc->x) 65#define COPY(x) err |= __get_user(regs->x, &sc->x)
67 66
68 COPYR(di); COPYR(si); COPYR(bp); COPYR(sp); COPYR(bx); 67 COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
69 COPYR(dx); COPYR(cx); COPYR(ip); 68 COPY(dx); COPY(cx); COPY(ip);
70 COPY(r8); 69 COPY(r8);
71 COPY(r9); 70 COPY(r9);
72 COPY(r10); 71 COPY(r10);
@@ -87,7 +86,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned
87 86
88 { 87 {
89 unsigned int tmpflags; 88 unsigned int tmpflags;
90 err |= __get_user(tmpflags, &sc->eflags); 89 err |= __get_user(tmpflags, &sc->flags);
91 regs->flags = (regs->flags & ~0x40DD5) | (tmpflags & 0x40DD5); 90 regs->flags = (regs->flags & ~0x40DD5) | (tmpflags & 0x40DD5);
92 regs->orig_ax = -1; /* disable syscall checks */ 91 regs->orig_ax = -1; /* disable syscall checks */
93 } 92 }
@@ -109,7 +108,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned
109 } 108 }
110 } 109 }
111 110
112 err |= __get_user(*prax, &sc->rax); 111 err |= __get_user(*prax, &sc->ax);
113 return err; 112 return err;
114 113
115badframe: 114badframe:
@@ -166,14 +165,14 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned lo
166 err |= __put_user(0, &sc->gs); 165 err |= __put_user(0, &sc->gs);
167 err |= __put_user(0, &sc->fs); 166 err |= __put_user(0, &sc->fs);
168 167
169 err |= __put_user(regs->di, &sc->rdi); 168 err |= __put_user(regs->di, &sc->di);
170 err |= __put_user(regs->si, &sc->rsi); 169 err |= __put_user(regs->si, &sc->si);
171 err |= __put_user(regs->bp, &sc->rbp); 170 err |= __put_user(regs->bp, &sc->bp);
172 err |= __put_user(regs->sp, &sc->rsp); 171 err |= __put_user(regs->sp, &sc->sp);
173 err |= __put_user(regs->bx, &sc->rbx); 172 err |= __put_user(regs->bx, &sc->bx);
174 err |= __put_user(regs->dx, &sc->rdx); 173 err |= __put_user(regs->dx, &sc->dx);
175 err |= __put_user(regs->cx, &sc->rcx); 174 err |= __put_user(regs->cx, &sc->cx);
176 err |= __put_user(regs->ax, &sc->rax); 175 err |= __put_user(regs->ax, &sc->ax);
177 err |= __put_user(regs->r8, &sc->r8); 176 err |= __put_user(regs->r8, &sc->r8);
178 err |= __put_user(regs->r9, &sc->r9); 177 err |= __put_user(regs->r9, &sc->r9);
179 err |= __put_user(regs->r10, &sc->r10); 178 err |= __put_user(regs->r10, &sc->r10);
@@ -184,8 +183,8 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned lo
184 err |= __put_user(regs->r15, &sc->r15); 183 err |= __put_user(regs->r15, &sc->r15);
185 err |= __put_user(me->thread.trap_no, &sc->trapno); 184 err |= __put_user(me->thread.trap_no, &sc->trapno);
186 err |= __put_user(me->thread.error_code, &sc->err); 185 err |= __put_user(me->thread.error_code, &sc->err);
187 err |= __put_user(regs->ip, &sc->rip); 186 err |= __put_user(regs->ip, &sc->ip);
188 err |= __put_user(regs->flags, &sc->eflags); 187 err |= __put_user(regs->flags, &sc->flags);
189 err |= __put_user(mask, &sc->oldmask); 188 err |= __put_user(mask, &sc->oldmask);
190 err |= __put_user(me->thread.cr2, &sc->cr2); 189 err |= __put_user(me->thread.cr2, &sc->cr2);
191 190