<machine/signal.h>
. use netbsd sigframe, sigcontext struct . netbsd sigframe *contains* sigcontext; use that directly in kernel sigsend . drop two fields from minix x86 stackframe.h (process context) that were unused, retadr and st use in-sigframe sigcontext Change-Id: Ib59d699596dc3a78163dee59f19730482fdddf11
This commit is contained in:
@@ -37,22 +37,51 @@ int do_sigreturn(struct proc * caller, message * m_ptr)
|
||||
|
||||
#if defined(__i386__)
|
||||
/* Restore user bits of psw from sc, maintain system bits from proc. */
|
||||
sc.sc_psw = (sc.sc_psw & X86_FLAGS_USER) |
|
||||
sc.sc_eflags = (sc.sc_eflags & X86_FLAGS_USER) |
|
||||
(rp->p_reg.psw & ~X86_FLAGS_USER);
|
||||
#endif
|
||||
|
||||
#if defined(__i386__)
|
||||
/* Don't panic kernel if user gave bad selectors. */
|
||||
sc.sc_cs = rp->p_reg.cs;
|
||||
sc.sc_ds = rp->p_reg.ds;
|
||||
sc.sc_es = rp->p_reg.es;
|
||||
sc.sc_ss = rp->p_reg.ss;
|
||||
sc.sc_fs = rp->p_reg.fs;
|
||||
sc.sc_gs = rp->p_reg.gs;
|
||||
/* Write back registers we allow to be restored, i.e.
|
||||
* not the segment ones.
|
||||
*/
|
||||
rp->p_reg.di = sc.sc_edi;
|
||||
rp->p_reg.si = sc.sc_esi;
|
||||
rp->p_reg.fp = sc.sc_ebp;
|
||||
rp->p_reg.bx = sc.sc_ebx;
|
||||
rp->p_reg.dx = sc.sc_edx;
|
||||
rp->p_reg.cx = sc.sc_ecx;
|
||||
rp->p_reg.retreg = sc.sc_eax;
|
||||
rp->p_reg.pc = sc.sc_eip;
|
||||
rp->p_reg.psw = sc.sc_eflags;
|
||||
rp->p_reg.sp = sc.sc_esp;
|
||||
#endif
|
||||
|
||||
#if defined(__arm__)
|
||||
rp->p_reg.psr = sc.sc_spsr;
|
||||
rp->p_reg.retreg = sc.sc_r0;
|
||||
rp->p_reg.r1 = sc.sc_r1;
|
||||
rp->p_reg.r2 = sc.sc_r2;
|
||||
rp->p_reg.r3 = sc.sc_r3;
|
||||
rp->p_reg.r4 = sc.sc_r4;
|
||||
rp->p_reg.r5 = sc.sc_r5;
|
||||
rp->p_reg.r6 = sc.sc_r6;
|
||||
rp->p_reg.r7 = sc.sc_r7;
|
||||
rp->p_reg.r8 = sc.sc_r8;
|
||||
rp->p_reg.r9 = sc.sc_r9;
|
||||
rp->p_reg.r10 = sc.sc_r10;
|
||||
rp->p_reg.fp = sc.sc_r11;
|
||||
rp->p_reg.r12 = sc.sc_r12;
|
||||
rp->p_reg.sp = sc.sc_usr_sp;
|
||||
rp->p_reg.lr = sc.sc_usr_lr;
|
||||
rp->p_reg.pc = sc.sc_pc;
|
||||
#endif
|
||||
|
||||
/* Restore the registers. */
|
||||
arch_proc_setcontext(rp, &sc.sc_regs, 1, sc.trap_style);
|
||||
arch_proc_setcontext(rp, &rp->p_reg, 1, sc.trap_style);
|
||||
|
||||
if(sc.sc_magic != SC_MAGIC) { printf("kernel sigreturn: corrupt signal context\n"); }
|
||||
|
||||
#if defined(__i386__)
|
||||
if (sc.sc_flags & MF_FPU_INITIALIZED)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user