diff options
author | phk <phk@FreeBSD.org> | 1996-04-25 06:20:19 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1996-04-25 06:20:19 +0000 |
commit | ec76275a92ea39884a03d86d510a9b25a33a5011 (patch) | |
tree | 1c0baa9fea83594ab8aede539cfdcb5433056ad2 /sys/amd64 | |
parent | 09153e86b5c58abbbe807cf1ecb9d89581bb9d5c (diff) | |
download | FreeBSD-src-ec76275a92ea39884a03d86d510a9b25a33a5011.zip FreeBSD-src-ec76275a92ea39884a03d86d510a9b25a33a5011.tar.gz |
Fix cpu_fork for real.
Suggested by: bde
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/cpu_switch.S | 6 | ||||
-rw-r--r-- | sys/amd64/amd64/machdep.c | 5 | ||||
-rw-r--r-- | sys/amd64/amd64/swtch.s | 6 | ||||
-rw-r--r-- | sys/amd64/amd64/vm_machdep.c | 13 | ||||
-rw-r--r-- | sys/amd64/include/pcb.h | 4 |
5 files changed, 14 insertions, 20 deletions
diff --git a/sys/amd64/amd64/cpu_switch.S b/sys/amd64/amd64/cpu_switch.S index 960c2cf..8a20aa9 100644 --- a/sys/amd64/amd64/cpu_switch.S +++ b/sys/amd64/amd64/cpu_switch.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.32 1996/04/13 11:24:13 bde Exp $ + * $Id: swtch.s,v 1.33 1996/04/18 21:34:26 phk Exp $ */ #include "apm.h" @@ -461,6 +461,7 @@ swtch_com: 2: #endif + movl $0,%eax sti ret @@ -476,9 +477,6 @@ ENTRY(savectx) movl (%esp),%eax movl %eax,PCB_EIP(%ecx) - movl 8(%esp), %eax /* In parent we put zero */ - movl $0,(%eax) - movl %ebx,PCB_EBX(%ecx) movl %esp,PCB_ESP(%ecx) movl %ebp,PCB_EBP(%ecx) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index d1ce2e8..4d99fb2 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.181 1996/04/06 01:06:04 davidg Exp $ + * $Id: machdep.c,v 1.182 1996/04/19 07:27:57 phk Exp $ */ #include "npx.h" @@ -936,8 +936,7 @@ boot(howto) } else { if (howto & RB_DUMP) { if (!cold) { - int foo; - savectx(&dumppcb, &foo); + savectx(&dumppcb); dumppcb.pcb_ptd = rcr3(); dumpsys(); } diff --git a/sys/amd64/amd64/swtch.s b/sys/amd64/amd64/swtch.s index 960c2cf..8a20aa9 100644 --- a/sys/amd64/amd64/swtch.s +++ b/sys/amd64/amd64/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.32 1996/04/13 11:24:13 bde Exp $ + * $Id: swtch.s,v 1.33 1996/04/18 21:34:26 phk Exp $ */ #include "apm.h" @@ -461,6 +461,7 @@ swtch_com: 2: #endif + movl $0,%eax sti ret @@ -476,9 +477,6 @@ ENTRY(savectx) movl (%esp),%eax movl %eax,PCB_EIP(%ecx) - movl 8(%esp), %eax /* In parent we put zero */ - movl $0,(%eax) - movl %ebx,PCB_EBX(%ecx) movl %esp,PCB_ESP(%ecx) movl %ebp,PCB_EBP(%ecx) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 42b1140..cfd2ddd 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/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.58 1996/04/07 17:39:28 bde Exp $ + * $Id: vm_machdep.c,v 1.59 1996/04/18 21:34:28 phk Exp $ */ #include "npx.h" @@ -563,6 +563,7 @@ cpu_fork(p1, p2) { struct pcb *pcb2 = &p2->p_addr->u_pcb; int sp, offset; + volatile int retval; /* * Copy pcb and stack from proc p1 to p2. @@ -578,6 +579,7 @@ cpu_fork(p1, p2) __asm __volatile("movl %%esp,%0" : "=r" (sp)); offset = sp - (int)kstack; + retval = 1; /* return 1 in child */ bcopy((caddr_t)kstack + offset, (caddr_t)p2->p_addr + offset, (unsigned) ctob(UPAGES) - offset); p2->p_md.md_regs = p1->p_md.md_regs; @@ -585,12 +587,9 @@ cpu_fork(p1, p2) *pcb2 = p1->p_addr->u_pcb; pcb2->pcb_cr3 = vtophys(p2->p_vmspace->vm_pmap.pm_pdir); - /* - * Returns (0) in parent, (1) in child. - */ - sp = 1; - savectx(pcb2,&sp); - return (sp); + retval = 0; /* return 0 in parent */ + savectx(pcb2); + return (retval); } void diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h index b833b9b..519730f 100644 --- a/sys/amd64/include/pcb.h +++ b/sys/amd64/include/pcb.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)pcb.h 5.10 (Berkeley) 5/12/91 - * $Id: pcb.h,v 1.12 1996/04/18 21:34:53 phk Exp $ + * $Id: pcb.h,v 1.13 1996/04/19 07:28:04 phk Exp $ */ #ifndef _I386_PCB_H_ @@ -79,7 +79,7 @@ struct md_coredump { #ifdef KERNEL extern struct pcb *curpcb; /* our current running pcb */ -void savectx __P((struct pcb*, int *)); +int savectx __P((struct pcb*)); #endif #endif /* _I386_PCB_H_ */ |