diff options
author | dg <dg@FreeBSD.org> | 1996-01-23 02:39:24 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1996-01-23 02:39:24 +0000 |
commit | 4332d58d94a2d1f0d1e9a1426d73892031273a1e (patch) | |
tree | 5a00b617415f818e7680cf98dac10c8c21949ba5 /sys/i386 | |
parent | 94f23f688431298cd7527b86677c0d4d4eb2713c (diff) | |
download | FreeBSD-src-4332d58d94a2d1f0d1e9a1426d73892031273a1e.zip FreeBSD-src-4332d58d94a2d1f0d1e9a1426d73892031273a1e.tar.gz |
Simplified savectx() a little and fixed a bug that caused it to return
garbage in the child process rather than "1" like it is supposed to.
Reviewed by: bde
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/machdep.c | 4 | ||||
-rw-r--r-- | sys/i386/i386/swtch.s | 29 | ||||
-rw-r--r-- | sys/i386/i386/vm_machdep.c | 4 | ||||
-rw-r--r-- | sys/i386/include/pcb.h | 4 |
4 files changed, 14 insertions, 27 deletions
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 950cbc2..ffb0793 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.170 1996/01/19 03:57:38 dyson Exp $ + * $Id: machdep.c,v 1.171 1996/01/21 20:57:03 joerg Exp $ */ #include "npx.h" @@ -927,7 +927,7 @@ boot(howto) } else { if (howto & RB_DUMP) { if (!cold) { - savectx(&dumppcb, 0); + savectx(&dumppcb); dumppcb.pcb_ptd = rcr3(); dumpsys(); } diff --git a/sys/i386/i386/swtch.s b/sys/i386/i386/swtch.s index bcc809d..fdaacd2 100644 --- a/sys/i386/i386/swtch.s +++ b/sys/i386/i386/swtch.s @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: swtch.s,v 1.24 1995/12/21 19:20:58 davidg Exp $ + * $Id: swtch.s,v 1.25 1996/01/03 21:41:29 wollman Exp $ */ #include "npx.h" /* for NNPX */ @@ -506,14 +506,18 @@ ENTRY(mvesp) ret /* - * savectx(pcb, altreturn) - * Update pcb, saving current processor state and arranging - * for alternate return ala longjmp in cpu_switch if altreturn is true. + * savectx(pcb) + * Update pcb, saving current processor state. */ ENTRY(savectx) + /* PCB */ movl 4(%esp),%ecx + + /* caller's return address - child won't execute this routine */ movl (%esp),%eax movl %eax,PCB_EIP(%ecx) + + movl $1,PCB_EAX(%ecx) /* return 1 in child */ movl %ebx,PCB_EBX(%ecx) movl %esp,PCB_ESP(%ecx) movl %ebp,PCB_EBP(%ecx) @@ -555,25 +559,8 @@ ENTRY(savectx) call _bcopy addl $12,%esp popl %ecx -1: #endif /* NNPX > 0 */ - cmpl $0,8(%esp) - je 1f - movl %esp,%edx /* relocate current sp relative to pcb */ - subl $_kstack,%edx /* (sp is relative to kstack): */ - addl %edx,%ecx /* pcb += sp - kstack; */ - movl %eax,(%ecx) /* write return pc at (relocated) sp@ */ - -/* this mess deals with replicating register state gcc hides */ - movl 12(%esp),%eax - movl %eax,12(%ecx) - movl 16(%esp),%eax - movl %eax,16(%ecx) - movl 20(%esp),%eax - movl %eax,20(%ecx) - movl 24(%esp),%eax - movl %eax,24(%ecx) 1: xorl %eax,%eax /* return 0 */ ret diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index cc79caa..a8edbbd 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -38,7 +38,7 @@ * * from: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - * $Id: vm_machdep.c,v 1.50 1996/01/05 20:12:23 wollman Exp $ + * $Id: vm_machdep.c,v 1.51 1996/01/19 03:57:43 dyson Exp $ */ #include "npx.h" @@ -591,7 +591,7 @@ cpu_fork(p1, p2) * Arrange for a non-local goto when the new process * is started, to resume here, returning nonzero from setjmp. */ - if (savectx(&up->u_pcb, 1)) { + if (savectx(&up->u_pcb)) { /* * Return 1 in child. */ diff --git a/sys/i386/include/pcb.h b/sys/i386/include/pcb.h index e058ca6..f8ea0dc 100644 --- a/sys/i386/include/pcb.h +++ b/sys/i386/include/pcb.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)pcb.h 5.10 (Berkeley) 5/12/91 - * $Id: pcb.h,v 1.8 1994/12/03 10:02:55 bde Exp $ + * $Id: pcb.h,v 1.9 1995/08/17 11:30:03 davidg Exp $ */ #ifndef _I386_PCB_H_ @@ -80,7 +80,7 @@ struct md_coredump { #ifdef KERNEL extern struct pcb *curpcb; /* our current running pcb */ -int savectx __P((struct pcb*,int)); +int savectx __P((struct pcb*)); #endif #endif /* _I386_PCB_H_ */ |