Small code clean up, and make the normal cases a few cycles faster.
This commit is contained in:
parent
838dfaa454
commit
df96b74ad3
|
@ -36,7 +36,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.90 1994/03/06 17:20:08 mycroft Exp $
|
||||
* $Id: machdep.c,v 1.91 1994/03/24 21:50:33 mycroft Exp $
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
@ -411,7 +411,7 @@ sendsig(catcher, sig, mask, code)
|
|||
- sizeof(struct sigframe));
|
||||
ps->ps_onstack = 1;
|
||||
} else {
|
||||
fp = (struct sigframe *)(tf->tf_esp - sizeof(struct sigframe));
|
||||
fp = (struct sigframe *)tf->tf_esp - 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -427,19 +427,19 @@ sendsig(catcher, sig, mask, code)
|
|||
*/
|
||||
frame.sf_sc.sc_onstack = oonstack;
|
||||
frame.sf_sc.sc_mask = mask;
|
||||
frame.sf_sc.sc_ebp = tf->tf_ebp;
|
||||
frame.sf_sc.sc_esp = tf->tf_esp;
|
||||
frame.sf_sc.sc_eip = tf->tf_eip;
|
||||
frame.sf_sc.sc_efl = tf->tf_eflags;
|
||||
frame.sf_sc.sc_eax = tf->tf_eax;
|
||||
frame.sf_sc.sc_ebx = tf->tf_ebx;
|
||||
frame.sf_sc.sc_ecx = tf->tf_ecx;
|
||||
frame.sf_sc.sc_edx = tf->tf_edx;
|
||||
frame.sf_sc.sc_esi = tf->tf_esi;
|
||||
frame.sf_sc.sc_edi = tf->tf_edi;
|
||||
frame.sf_sc.sc_cs = tf->tf_cs;
|
||||
frame.sf_sc.sc_ds = tf->tf_ds;
|
||||
frame.sf_sc.sc_es = tf->tf_es;
|
||||
frame.sf_sc.sc_ds = tf->tf_ds;
|
||||
frame.sf_sc.sc_edi = tf->tf_edi;
|
||||
frame.sf_sc.sc_esi = tf->tf_esi;
|
||||
frame.sf_sc.sc_ebp = tf->tf_ebp;
|
||||
frame.sf_sc.sc_ebx = tf->tf_ebx;
|
||||
frame.sf_sc.sc_edx = tf->tf_edx;
|
||||
frame.sf_sc.sc_ecx = tf->tf_ecx;
|
||||
frame.sf_sc.sc_eax = tf->tf_eax;
|
||||
frame.sf_sc.sc_eip = tf->tf_eip;
|
||||
frame.sf_sc.sc_cs = tf->tf_cs;
|
||||
frame.sf_sc.sc_efl = tf->tf_eflags;
|
||||
frame.sf_sc.sc_esp = tf->tf_esp;
|
||||
frame.sf_sc.sc_ss = tf->tf_ss;
|
||||
|
||||
if (copyout(&frame, fp, sizeof(frame)) != 0) {
|
||||
|
@ -554,19 +554,19 @@ sigreturn(p, uap, retval)
|
|||
/*
|
||||
* Restore signal context.
|
||||
*/
|
||||
tf->tf_ebp = context.sc_ebp;
|
||||
tf->tf_esp = context.sc_esp;
|
||||
tf->tf_eip = context.sc_eip;
|
||||
tf->tf_eflags = eflags;
|
||||
tf->tf_eax = context.sc_eax;
|
||||
tf->tf_ebx = context.sc_ebx;
|
||||
tf->tf_ecx = context.sc_ecx;
|
||||
tf->tf_edx = context.sc_edx;
|
||||
tf->tf_esi = context.sc_esi;
|
||||
tf->tf_edi = context.sc_edi;
|
||||
tf->tf_cs = context.sc_cs;
|
||||
tf->tf_ds = context.sc_ds;
|
||||
tf->tf_es = context.sc_es;
|
||||
tf->tf_ds = context.sc_ds;
|
||||
tf->tf_edi = context.sc_edi;
|
||||
tf->tf_esi = context.sc_esi;
|
||||
tf->tf_ebp = context.sc_ebp;
|
||||
tf->tf_ebx = context.sc_ebx;
|
||||
tf->tf_edx = context.sc_edx;
|
||||
tf->tf_ecx = context.sc_ecx;
|
||||
tf->tf_eax = context.sc_eax;
|
||||
tf->tf_eip = context.sc_eip;
|
||||
tf->tf_cs = context.sc_cs;
|
||||
tf->tf_eflags = eflags;
|
||||
tf->tf_esp = context.sc_esp;
|
||||
tf->tf_ss = context.sc_ss;
|
||||
|
||||
return(EJUSTRETURN);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)trap.c 7.4 (Berkeley) 5/13/91
|
||||
* $Id: trap.c,v 1.29 1994/02/15 07:18:46 cgd Exp $
|
||||
* $Id: trap.c,v 1.30 1994/03/24 21:50:35 mycroft Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -473,11 +473,8 @@ syscall(frame)
|
|||
code = frame.tf_eax;
|
||||
p->p_regs = (int *)&frame;
|
||||
params = (caddr_t)frame.tf_esp + sizeof(int);
|
||||
opc = frame.tf_eip;
|
||||
|
||||
/*
|
||||
* Reconstruct pc, assuming lcall $X,y is 7 bytes, as it is always.
|
||||
*/
|
||||
opc = frame.tf_eip - 7;
|
||||
if (code == 0) { /* indir */
|
||||
code = fuword(params);
|
||||
params += sizeof(int);
|
||||
|
@ -488,8 +485,6 @@ syscall(frame)
|
|||
callp = &sysent[code];
|
||||
if ((i = callp->sy_narg * sizeof(int)) &&
|
||||
(error = copyin(params, (caddr_t)args, (u_int)i))) {
|
||||
frame.tf_eax = error;
|
||||
frame.tf_eflags |= PSL_C; /* carry bit */
|
||||
#ifdef SYSCALL_DEBUG
|
||||
scdebug_call(p, code, callp->sy_narg, args);
|
||||
#endif
|
||||
|
@ -497,7 +492,7 @@ syscall(frame)
|
|||
if (KTRPOINT(p, KTR_SYSCALL))
|
||||
ktrsyscall(p->p_tracep, code, callp->sy_narg, &args);
|
||||
#endif
|
||||
goto done;
|
||||
goto lose;
|
||||
}
|
||||
#ifdef SYSCALL_DEBUG
|
||||
scdebug_call(p, code, callp->sy_narg, args);
|
||||
|
@ -509,20 +504,28 @@ syscall(frame)
|
|||
rval[0] = 0;
|
||||
rval[1] = frame.tf_edx;
|
||||
error = (*callp->sy_call)(p, args, rval);
|
||||
if (error == ERESTART)
|
||||
frame.tf_eip = opc;
|
||||
else if (error != EJUSTRETURN)
|
||||
if (error) {
|
||||
frame.tf_eax = error;
|
||||
frame.tf_eflags |= PSL_C; /* carry bit */
|
||||
} else {
|
||||
frame.tf_eax = rval[0];
|
||||
frame.tf_edx = rval[1];
|
||||
frame.tf_eflags &= ~PSL_C; /* carry bit */
|
||||
}
|
||||
/* else if (error == EJUSTRETURN) */
|
||||
switch (error) {
|
||||
case 0:
|
||||
frame.tf_eax = rval[0];
|
||||
frame.tf_edx = rval[1];
|
||||
frame.tf_eflags &= ~PSL_C; /* carry bit */
|
||||
break;
|
||||
case ERESTART:
|
||||
/*
|
||||
* Reconstruct pc, assuming lcall $X,y is 7 bytes, as it is
|
||||
* always.
|
||||
*/
|
||||
frame.tf_eip = opc - 7;
|
||||
break;
|
||||
case EJUSTRETURN:
|
||||
/* nothing to do */
|
||||
done:
|
||||
break;
|
||||
default:
|
||||
lose:
|
||||
frame.tf_eax = error;
|
||||
frame.tf_eflags |= PSL_C; /* carry bit */
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* Reinitialize proc pointer `p' as it may be different
|
||||
* if this is a child returning from fork syscall.
|
||||
|
|
Loading…
Reference in New Issue