mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-11-20 00:26:39 +08:00
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>
This commit is contained in:
parent
153d5f2e57
commit
742fa54a62
@ -192,9 +192,9 @@ struct rt_sigframe
|
||||
char retcode[8];
|
||||
};
|
||||
|
||||
#define COPY(x) { \
|
||||
unsigned int reg; \
|
||||
err |= __get_user(reg, &sc->e ##x); \
|
||||
#define COPY(x) { \
|
||||
unsigned int reg; \
|
||||
err |= __get_user(reg, &sc->x); \
|
||||
regs->x = reg; \
|
||||
}
|
||||
|
||||
@ -248,7 +248,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
|
||||
err |= __get_user(regs->ss, &sc->ss);
|
||||
regs->ss |= 3;
|
||||
|
||||
err |= __get_user(tmpflags, &sc->eflags);
|
||||
err |= __get_user(tmpflags, &sc->flags);
|
||||
regs->flags = (regs->flags & ~0x40DD5) | (tmpflags & 0x40DD5);
|
||||
/* disable syscall checks */
|
||||
regs->orig_ax = -1;
|
||||
@ -268,7 +268,7 @@ static int ia32_restore_sigcontext(struct pt_regs *regs,
|
||||
}
|
||||
}
|
||||
|
||||
err |= __get_user(tmp, &sc->eax);
|
||||
err |= __get_user(tmp, &sc->ax);
|
||||
*peax = tmp;
|
||||
|
||||
return err;
|
||||
@ -361,21 +361,21 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
|
||||
__asm__("movl %%es,%0" : "=r"(tmp): "0"(tmp));
|
||||
err |= __put_user(tmp, (unsigned int __user *)&sc->es);
|
||||
|
||||
err |= __put_user((u32)regs->di, &sc->edi);
|
||||
err |= __put_user((u32)regs->si, &sc->esi);
|
||||
err |= __put_user((u32)regs->bp, &sc->ebp);
|
||||
err |= __put_user((u32)regs->sp, &sc->esp);
|
||||
err |= __put_user((u32)regs->bx, &sc->ebx);
|
||||
err |= __put_user((u32)regs->dx, &sc->edx);
|
||||
err |= __put_user((u32)regs->cx, &sc->ecx);
|
||||
err |= __put_user((u32)regs->ax, &sc->eax);
|
||||
err |= __put_user((u32)regs->di, &sc->di);
|
||||
err |= __put_user((u32)regs->si, &sc->si);
|
||||
err |= __put_user((u32)regs->bp, &sc->bp);
|
||||
err |= __put_user((u32)regs->sp, &sc->sp);
|
||||
err |= __put_user((u32)regs->bx, &sc->bx);
|
||||
err |= __put_user((u32)regs->dx, &sc->dx);
|
||||
err |= __put_user((u32)regs->cx, &sc->cx);
|
||||
err |= __put_user((u32)regs->ax, &sc->ax);
|
||||
err |= __put_user((u32)regs->cs, &sc->cs);
|
||||
err |= __put_user((u32)regs->ss, &sc->ss);
|
||||
err |= __put_user(current->thread.trap_no, &sc->trapno);
|
||||
err |= __put_user(current->thread.error_code, &sc->err);
|
||||
err |= __put_user((u32)regs->ip, &sc->eip);
|
||||
err |= __put_user((u32)regs->flags, &sc->eflags);
|
||||
err |= __put_user((u32)regs->sp, &sc->esp_at_signal);
|
||||
err |= __put_user((u32)regs->ip, &sc->ip);
|
||||
err |= __put_user((u32)regs->flags, &sc->flags);
|
||||
err |= __put_user((u32)regs->sp, &sc->sp_at_signal);
|
||||
|
||||
tmp = save_i387_ia32(current, fpstate, regs, 0);
|
||||
if (tmp < 0)
|
||||
|
@ -38,15 +38,15 @@ void foo(void);
|
||||
|
||||
void foo(void)
|
||||
{
|
||||
OFFSET(IA32_SIGCONTEXT_eax, sigcontext, eax);
|
||||
OFFSET(IA32_SIGCONTEXT_ebx, sigcontext, ebx);
|
||||
OFFSET(IA32_SIGCONTEXT_ecx, sigcontext, ecx);
|
||||
OFFSET(IA32_SIGCONTEXT_edx, sigcontext, edx);
|
||||
OFFSET(IA32_SIGCONTEXT_esi, sigcontext, esi);
|
||||
OFFSET(IA32_SIGCONTEXT_edi, sigcontext, edi);
|
||||
OFFSET(IA32_SIGCONTEXT_ebp, sigcontext, ebp);
|
||||
OFFSET(IA32_SIGCONTEXT_esp, sigcontext, esp);
|
||||
OFFSET(IA32_SIGCONTEXT_eip, sigcontext, eip);
|
||||
OFFSET(IA32_SIGCONTEXT_ax, sigcontext, ax);
|
||||
OFFSET(IA32_SIGCONTEXT_bx, sigcontext, bx);
|
||||
OFFSET(IA32_SIGCONTEXT_cx, sigcontext, cx);
|
||||
OFFSET(IA32_SIGCONTEXT_dx, sigcontext, dx);
|
||||
OFFSET(IA32_SIGCONTEXT_si, sigcontext, si);
|
||||
OFFSET(IA32_SIGCONTEXT_di, sigcontext, di);
|
||||
OFFSET(IA32_SIGCONTEXT_bp, sigcontext, bp);
|
||||
OFFSET(IA32_SIGCONTEXT_sp, sigcontext, sp);
|
||||
OFFSET(IA32_SIGCONTEXT_ip, sigcontext, ip);
|
||||
BLANK();
|
||||
|
||||
OFFSET(CPUINFO_x86, cpuinfo_x86, x86);
|
||||
|
@ -63,15 +63,15 @@ int main(void)
|
||||
#undef ENTRY
|
||||
#ifdef CONFIG_IA32_EMULATION
|
||||
#define ENTRY(entry) DEFINE(IA32_SIGCONTEXT_ ## entry, offsetof(struct sigcontext_ia32, entry))
|
||||
ENTRY(eax);
|
||||
ENTRY(ebx);
|
||||
ENTRY(ecx);
|
||||
ENTRY(edx);
|
||||
ENTRY(esi);
|
||||
ENTRY(edi);
|
||||
ENTRY(ebp);
|
||||
ENTRY(esp);
|
||||
ENTRY(eip);
|
||||
ENTRY(ax);
|
||||
ENTRY(bx);
|
||||
ENTRY(cx);
|
||||
ENTRY(dx);
|
||||
ENTRY(si);
|
||||
ENTRY(di);
|
||||
ENTRY(bp);
|
||||
ENTRY(sp);
|
||||
ENTRY(ip);
|
||||
BLANK();
|
||||
#undef ENTRY
|
||||
DEFINE(IA32_RT_SIGFRAME_sigcontext,
|
||||
|
@ -105,7 +105,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax
|
||||
/* Always make any pending restarted system calls return -EINTR */
|
||||
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
||||
|
||||
#define COPY(x) err |= __get_user(regs->x, &sc->e ## x)
|
||||
#define COPY(x) err |= __get_user(regs->x, &sc->x)
|
||||
|
||||
#define COPY_SEG(seg) \
|
||||
{ unsigned short tmp; \
|
||||
@ -144,7 +144,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax
|
||||
|
||||
{
|
||||
unsigned int tmpflags;
|
||||
err |= __get_user(tmpflags, &sc->eflags);
|
||||
err |= __get_user(tmpflags, &sc->flags);
|
||||
regs->flags = (regs->flags & ~FIX_EFLAGS) | (tmpflags & FIX_EFLAGS);
|
||||
regs->orig_ax = -1; /* disable syscall checks */
|
||||
}
|
||||
@ -165,7 +165,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, int *peax
|
||||
}
|
||||
}
|
||||
|
||||
err |= __get_user(*peax, &sc->eax);
|
||||
err |= __get_user(*peax, &sc->ax);
|
||||
return err;
|
||||
|
||||
badframe:
|
||||
@ -256,20 +256,20 @@ setup_sigcontext(struct sigcontext __user *sc, struct _fpstate __user *fpstate,
|
||||
|
||||
err |= __put_user(regs->es, (unsigned int __user *)&sc->es);
|
||||
err |= __put_user(regs->ds, (unsigned int __user *)&sc->ds);
|
||||
err |= __put_user(regs->di, &sc->edi);
|
||||
err |= __put_user(regs->si, &sc->esi);
|
||||
err |= __put_user(regs->bp, &sc->ebp);
|
||||
err |= __put_user(regs->sp, &sc->esp);
|
||||
err |= __put_user(regs->bx, &sc->ebx);
|
||||
err |= __put_user(regs->dx, &sc->edx);
|
||||
err |= __put_user(regs->cx, &sc->ecx);
|
||||
err |= __put_user(regs->ax, &sc->eax);
|
||||
err |= __put_user(regs->di, &sc->di);
|
||||
err |= __put_user(regs->si, &sc->si);
|
||||
err |= __put_user(regs->bp, &sc->bp);
|
||||
err |= __put_user(regs->sp, &sc->sp);
|
||||
err |= __put_user(regs->bx, &sc->bx);
|
||||
err |= __put_user(regs->dx, &sc->dx);
|
||||
err |= __put_user(regs->cx, &sc->cx);
|
||||
err |= __put_user(regs->ax, &sc->ax);
|
||||
err |= __put_user(current->thread.trap_no, &sc->trapno);
|
||||
err |= __put_user(current->thread.error_code, &sc->err);
|
||||
err |= __put_user(regs->ip, &sc->eip);
|
||||
err |= __put_user(regs->ip, &sc->ip);
|
||||
err |= __put_user(regs->cs, (unsigned int __user *)&sc->cs);
|
||||
err |= __put_user(regs->flags, &sc->eflags);
|
||||
err |= __put_user(regs->sp, &sc->esp_at_signal);
|
||||
err |= __put_user(regs->flags, &sc->flags);
|
||||
err |= __put_user(regs->sp, &sc->sp_at_signal);
|
||||
err |= __put_user(regs->ss, (unsigned int __user *)&sc->ss);
|
||||
|
||||
tmp = save_i387(fpstate);
|
||||
|
@ -62,11 +62,10 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned
|
||||
/* Always make any pending restarted system calls return -EINTR */
|
||||
current_thread_info()->restart_block.fn = do_no_restart_syscall;
|
||||
|
||||
#define COPYR(x) err |= __get_user(regs->x, &sc->r ## x)
|
||||
#define COPY(x) err |= __get_user(regs->x, &sc->x)
|
||||
|
||||
COPYR(di); COPYR(si); COPYR(bp); COPYR(sp); COPYR(bx);
|
||||
COPYR(dx); COPYR(cx); COPYR(ip);
|
||||
COPY(di); COPY(si); COPY(bp); COPY(sp); COPY(bx);
|
||||
COPY(dx); COPY(cx); COPY(ip);
|
||||
COPY(r8);
|
||||
COPY(r9);
|
||||
COPY(r10);
|
||||
@ -87,7 +86,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned
|
||||
|
||||
{
|
||||
unsigned int tmpflags;
|
||||
err |= __get_user(tmpflags, &sc->eflags);
|
||||
err |= __get_user(tmpflags, &sc->flags);
|
||||
regs->flags = (regs->flags & ~0x40DD5) | (tmpflags & 0x40DD5);
|
||||
regs->orig_ax = -1; /* disable syscall checks */
|
||||
}
|
||||
@ -109,7 +108,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc, unsigned
|
||||
}
|
||||
}
|
||||
|
||||
err |= __get_user(*prax, &sc->rax);
|
||||
err |= __get_user(*prax, &sc->ax);
|
||||
return err;
|
||||
|
||||
badframe:
|
||||
@ -166,14 +165,14 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned lo
|
||||
err |= __put_user(0, &sc->gs);
|
||||
err |= __put_user(0, &sc->fs);
|
||||
|
||||
err |= __put_user(regs->di, &sc->rdi);
|
||||
err |= __put_user(regs->si, &sc->rsi);
|
||||
err |= __put_user(regs->bp, &sc->rbp);
|
||||
err |= __put_user(regs->sp, &sc->rsp);
|
||||
err |= __put_user(regs->bx, &sc->rbx);
|
||||
err |= __put_user(regs->dx, &sc->rdx);
|
||||
err |= __put_user(regs->cx, &sc->rcx);
|
||||
err |= __put_user(regs->ax, &sc->rax);
|
||||
err |= __put_user(regs->di, &sc->di);
|
||||
err |= __put_user(regs->si, &sc->si);
|
||||
err |= __put_user(regs->bp, &sc->bp);
|
||||
err |= __put_user(regs->sp, &sc->sp);
|
||||
err |= __put_user(regs->bx, &sc->bx);
|
||||
err |= __put_user(regs->dx, &sc->dx);
|
||||
err |= __put_user(regs->cx, &sc->cx);
|
||||
err |= __put_user(regs->ax, &sc->ax);
|
||||
err |= __put_user(regs->r8, &sc->r8);
|
||||
err |= __put_user(regs->r9, &sc->r9);
|
||||
err |= __put_user(regs->r10, &sc->r10);
|
||||
@ -184,8 +183,8 @@ setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, unsigned lo
|
||||
err |= __put_user(regs->r15, &sc->r15);
|
||||
err |= __put_user(me->thread.trap_no, &sc->trapno);
|
||||
err |= __put_user(me->thread.error_code, &sc->err);
|
||||
err |= __put_user(regs->ip, &sc->rip);
|
||||
err |= __put_user(regs->flags, &sc->eflags);
|
||||
err |= __put_user(regs->ip, &sc->ip);
|
||||
err |= __put_user(regs->flags, &sc->flags);
|
||||
err |= __put_user(mask, &sc->oldmask);
|
||||
err |= __put_user(me->thread.cr2, &sc->cr2);
|
||||
|
||||
|
@ -92,27 +92,27 @@ __kernel_rt_sigreturn:
|
||||
.sleb128 offset; /* offset */ \
|
||||
1:
|
||||
|
||||
do_cfa_expr(IA32_SIGCONTEXT_esp+4)
|
||||
do_expr(0, IA32_SIGCONTEXT_eax+4)
|
||||
do_expr(1, IA32_SIGCONTEXT_ecx+4)
|
||||
do_expr(2, IA32_SIGCONTEXT_edx+4)
|
||||
do_expr(3, IA32_SIGCONTEXT_ebx+4)
|
||||
do_expr(5, IA32_SIGCONTEXT_ebp+4)
|
||||
do_expr(6, IA32_SIGCONTEXT_esi+4)
|
||||
do_expr(7, IA32_SIGCONTEXT_edi+4)
|
||||
do_expr(8, IA32_SIGCONTEXT_eip+4)
|
||||
do_cfa_expr(IA32_SIGCONTEXT_sp+4)
|
||||
do_expr(0, IA32_SIGCONTEXT_ax+4)
|
||||
do_expr(1, IA32_SIGCONTEXT_cx+4)
|
||||
do_expr(2, IA32_SIGCONTEXT_dx+4)
|
||||
do_expr(3, IA32_SIGCONTEXT_bx+4)
|
||||
do_expr(5, IA32_SIGCONTEXT_bp+4)
|
||||
do_expr(6, IA32_SIGCONTEXT_si+4)
|
||||
do_expr(7, IA32_SIGCONTEXT_di+4)
|
||||
do_expr(8, IA32_SIGCONTEXT_ip+4)
|
||||
|
||||
.byte 0x42 /* DW_CFA_advance_loc 2 -- nop; popl eax. */
|
||||
|
||||
do_cfa_expr(IA32_SIGCONTEXT_esp)
|
||||
do_expr(0, IA32_SIGCONTEXT_eax)
|
||||
do_expr(1, IA32_SIGCONTEXT_ecx)
|
||||
do_expr(2, IA32_SIGCONTEXT_edx)
|
||||
do_expr(3, IA32_SIGCONTEXT_ebx)
|
||||
do_expr(5, IA32_SIGCONTEXT_ebp)
|
||||
do_expr(6, IA32_SIGCONTEXT_esi)
|
||||
do_expr(7, IA32_SIGCONTEXT_edi)
|
||||
do_expr(8, IA32_SIGCONTEXT_eip)
|
||||
do_cfa_expr(IA32_SIGCONTEXT_sp)
|
||||
do_expr(0, IA32_SIGCONTEXT_ax)
|
||||
do_expr(1, IA32_SIGCONTEXT_cx)
|
||||
do_expr(2, IA32_SIGCONTEXT_dx)
|
||||
do_expr(3, IA32_SIGCONTEXT_bx)
|
||||
do_expr(5, IA32_SIGCONTEXT_bp)
|
||||
do_expr(6, IA32_SIGCONTEXT_si)
|
||||
do_expr(7, IA32_SIGCONTEXT_di)
|
||||
do_expr(8, IA32_SIGCONTEXT_ip)
|
||||
|
||||
.align 4
|
||||
.LENDFDEDLSI1:
|
||||
@ -129,15 +129,15 @@ __kernel_rt_sigreturn:
|
||||
slightly less complicated than the above, since we don't
|
||||
modify the stack pointer in the process. */
|
||||
|
||||
do_cfa_expr(IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_esp)
|
||||
do_expr(0, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_eax)
|
||||
do_expr(1, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ecx)
|
||||
do_expr(2, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_edx)
|
||||
do_expr(3, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ebx)
|
||||
do_expr(5, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ebp)
|
||||
do_expr(6, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_esi)
|
||||
do_expr(7, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_edi)
|
||||
do_expr(8, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_eip)
|
||||
do_cfa_expr(IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_sp)
|
||||
do_expr(0, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ax)
|
||||
do_expr(1, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_cx)
|
||||
do_expr(2, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_dx)
|
||||
do_expr(3, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_bx)
|
||||
do_expr(5, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_bp)
|
||||
do_expr(6, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_si)
|
||||
do_expr(7, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_di)
|
||||
do_expr(8, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ip)
|
||||
|
||||
.align 4
|
||||
.LENDFDEDLSI2:
|
||||
|
@ -63,20 +63,20 @@ struct sigcontext {
|
||||
unsigned short fs, __fsh;
|
||||
unsigned short es, __esh;
|
||||
unsigned short ds, __dsh;
|
||||
unsigned long edi;
|
||||
unsigned long esi;
|
||||
unsigned long ebp;
|
||||
unsigned long esp;
|
||||
unsigned long ebx;
|
||||
unsigned long edx;
|
||||
unsigned long ecx;
|
||||
unsigned long eax;
|
||||
unsigned long di;
|
||||
unsigned long si;
|
||||
unsigned long bp;
|
||||
unsigned long sp;
|
||||
unsigned long bx;
|
||||
unsigned long dx;
|
||||
unsigned long cx;
|
||||
unsigned long ax;
|
||||
unsigned long trapno;
|
||||
unsigned long err;
|
||||
unsigned long eip;
|
||||
unsigned long ip;
|
||||
unsigned short cs, __csh;
|
||||
unsigned long eflags;
|
||||
unsigned long esp_at_signal;
|
||||
unsigned long flags;
|
||||
unsigned long sp_at_signal;
|
||||
unsigned short ss, __ssh;
|
||||
struct _fpstate __user * fpstate;
|
||||
unsigned long oldmask;
|
||||
@ -111,16 +111,16 @@ struct sigcontext {
|
||||
unsigned long r13;
|
||||
unsigned long r14;
|
||||
unsigned long r15;
|
||||
unsigned long rdi;
|
||||
unsigned long rsi;
|
||||
unsigned long rbp;
|
||||
unsigned long rbx;
|
||||
unsigned long rdx;
|
||||
unsigned long rax;
|
||||
unsigned long rcx;
|
||||
unsigned long rsp;
|
||||
unsigned long rip;
|
||||
unsigned long eflags; /* RFLAGS */
|
||||
unsigned long di;
|
||||
unsigned long si;
|
||||
unsigned long bp;
|
||||
unsigned long bx;
|
||||
unsigned long dx;
|
||||
unsigned long ax;
|
||||
unsigned long cx;
|
||||
unsigned long sp;
|
||||
unsigned long ip;
|
||||
unsigned long flags;
|
||||
unsigned short cs;
|
||||
unsigned short gs;
|
||||
unsigned short fs;
|
||||
|
@ -48,20 +48,20 @@ struct sigcontext_ia32 {
|
||||
unsigned short fs, __fsh;
|
||||
unsigned short es, __esh;
|
||||
unsigned short ds, __dsh;
|
||||
unsigned int edi;
|
||||
unsigned int esi;
|
||||
unsigned int ebp;
|
||||
unsigned int esp;
|
||||
unsigned int ebx;
|
||||
unsigned int edx;
|
||||
unsigned int ecx;
|
||||
unsigned int eax;
|
||||
unsigned int di;
|
||||
unsigned int si;
|
||||
unsigned int bp;
|
||||
unsigned int sp;
|
||||
unsigned int bx;
|
||||
unsigned int dx;
|
||||
unsigned int cx;
|
||||
unsigned int ax;
|
||||
unsigned int trapno;
|
||||
unsigned int err;
|
||||
unsigned int eip;
|
||||
unsigned int ip;
|
||||
unsigned short cs, __csh;
|
||||
unsigned int eflags;
|
||||
unsigned int esp_at_signal;
|
||||
unsigned int flags;
|
||||
unsigned int sp_at_signal;
|
||||
unsigned short ss, __ssh;
|
||||
unsigned int fpstate; /* really (struct _fpstate_ia32 *) */
|
||||
unsigned int oldmask;
|
||||
|
Loading…
Reference in New Issue
Block a user