summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-01-24 21:59:25 +0000
committerjhb <jhb@FreeBSD.org>2001-01-24 21:59:25 +0000
commitaf00dc8eef26d6f9d2b9d3cd92429a0db97e0b3c (patch)
tree1a65f27d40bfb7ed1d2518d205618e42ea64e92b /sys
parent222035d6b123a02eab80f14e5165f2cf38dfda82 (diff)
downloadFreeBSD-src-af00dc8eef26d6f9d2b9d3cd92429a0db97e0b3c.zip
FreeBSD-src-af00dc8eef26d6f9d2b9d3cd92429a0db97e0b3c.tar.gz
- Change fork_exit() to take a pointer to a trapframe as its 3rd argument
instead of a trapframe directly. (Requested by bde.) - Convert the alpha switch_trampoline to call fork_exit() and use the MI fork_return() instead of child_return(). - Axe child_return().
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/alpha/swtch.s16
-rw-r--r--sys/alpha/alpha/trap.c25
-rw-r--r--sys/alpha/alpha/vm_machdep.c4
-rw-r--r--sys/amd64/amd64/exception.S3
-rw-r--r--sys/amd64/amd64/exception.s3
-rw-r--r--sys/i386/i386/exception.s3
-rw-r--r--sys/kern/kern_fork.c4
-rw-r--r--sys/powerpc/aim/vm_machdep.c4
-rw-r--r--sys/powerpc/powerpc/vm_machdep.c4
-rw-r--r--sys/sys/proc.h7
10 files changed, 24 insertions, 49 deletions
diff --git a/sys/alpha/alpha/swtch.s b/sys/alpha/alpha/swtch.s
index aff4d42..f456aa1 100644
--- a/sys/alpha/alpha/swtch.s
+++ b/sys/alpha/alpha/swtch.s
@@ -206,18 +206,16 @@ Lcs7:
*
* Arrange for a function to be invoked neatly, after a cpu_switch().
*
- * Invokes the function specified by the s0 register with the return
- * address specified by the s1 register and with one argument, a
- * pointer to the executing process's proc structure.
+ * Invokes fork_exit() passing in three arguments: a callout function,
+ * a pointer to the executing process's proc structure, and a trapframe
+ * pointer.
*/
LEAF(switch_trampoline, 0)
- MTX_EXIT(sched_lock)
- ldiq a0, ALPHA_PSL_IPL_0 /* drop IPL to zero */
- call_pal PAL_OSF1_swpipl
- mov s0, pv
mov s1, ra
- mov s2, a0
- jmp zero, (pv)
+ mov s0, a0
+ mov s2, a1
+ mov sp, a2
+ jmp zero, fork_exit
END(switch_trampoline)
diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c
index 31f5591..f6d1f84 100644
--- a/sys/alpha/alpha/trap.c
+++ b/sys/alpha/alpha/trap.c
@@ -752,31 +752,6 @@ syscall(code, framep)
}
/*
- * Process the tail end of a fork() for the child.
- */
-void
-child_return(p)
- struct proc *p;
-{
-
- /*
- * Return values in the frame set by cpu_fork().
- */
-
- userret(p, p->p_md.md_tf, 0);
-#ifdef KTRACE
- if (KTRPOINT(p, KTR_SYSRET)) {
- if (!mtx_owned(&Giant))
- mtx_enter(&Giant, MTX_DEF);
- ktrsysret(p->p_tracep, SYS_fork, 0, 0);
- }
-#endif
-
- if (mtx_owned(&Giant))
- mtx_exit(&Giant, MTX_DEF);
-}
-
-/*
* Process an asynchronous software trap.
* This is relatively easy.
*/
diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c
index c60f971..c5c8cd5 100644
--- a/sys/alpha/alpha/vm_machdep.c
+++ b/sys/alpha/alpha/vm_machdep.c
@@ -196,7 +196,7 @@ cpu_fork(p1, p2, flags)
p2tf->tf_regs[FRAME_A4] = 1; /* is child (FreeBSD) */
/*
- * Arrange for continuation at child_return(), which
+ * Arrange for continuation at fork_return(), which
* will return to exception_return(). Note that the child
* process doesn't stay in the kernel for long!
*
@@ -204,7 +204,7 @@ cpu_fork(p1, p2, flags)
*/
up->u_pcb.pcb_hw.apcb_ksp = (u_int64_t)p2tf;
up->u_pcb.pcb_context[0] =
- (u_int64_t)child_return; /* s0: pc */
+ (u_int64_t)fork_return; /* s0: pc */
up->u_pcb.pcb_context[1] =
(u_int64_t)exception_return; /* s1: ra */
up->u_pcb.pcb_context[2] = (u_long) p2; /* s2: a0 */
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index 54d7f82..d3bce3b 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -289,10 +289,11 @@ IDTVEC(int0x80_syscall)
jmp _doreti
ENTRY(fork_trampoline)
+ pushl %esp /* trapframe pointer */
pushl %ebx /* arg1 */
pushl %esi /* function */
call _fork_exit
- addl $8,%esp
+ addl $12,%esp
/* cut from syscall */
/*
diff --git a/sys/amd64/amd64/exception.s b/sys/amd64/amd64/exception.s
index 54d7f82..d3bce3b 100644
--- a/sys/amd64/amd64/exception.s
+++ b/sys/amd64/amd64/exception.s
@@ -289,10 +289,11 @@ IDTVEC(int0x80_syscall)
jmp _doreti
ENTRY(fork_trampoline)
+ pushl %esp /* trapframe pointer */
pushl %ebx /* arg1 */
pushl %esi /* function */
call _fork_exit
- addl $8,%esp
+ addl $12,%esp
/* cut from syscall */
/*
diff --git a/sys/i386/i386/exception.s b/sys/i386/i386/exception.s
index 54d7f82..d3bce3b 100644
--- a/sys/i386/i386/exception.s
+++ b/sys/i386/i386/exception.s
@@ -289,10 +289,11 @@ IDTVEC(int0x80_syscall)
jmp _doreti
ENTRY(fork_trampoline)
+ pushl %esp /* trapframe pointer */
pushl %ebx /* arg1 */
pushl %esi /* function */
call _fork_exit
- addl $8,%esp
+ addl $12,%esp
/* cut from syscall */
/*
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 4785a70..8ad189e 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -645,7 +645,7 @@ void
fork_exit(callout, arg, frame)
void *callout(void *, struct trapframe *);
void *arg;
- struct trapframe frame;
+ struct trapframe *frame;
{
struct proc *p;
@@ -666,7 +666,7 @@ fork_exit(callout, arg, frame)
* have this call a non-return function to stay in kernel mode.
* initproc has its own fork handler, but it does return.
*/
- (*callout)(arg, &frame);
+ (*callout)(arg, frame);
/*
* Check if a kernel thread misbehaved and returned from its main
diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c
index c60f971..c5c8cd5 100644
--- a/sys/powerpc/aim/vm_machdep.c
+++ b/sys/powerpc/aim/vm_machdep.c
@@ -196,7 +196,7 @@ cpu_fork(p1, p2, flags)
p2tf->tf_regs[FRAME_A4] = 1; /* is child (FreeBSD) */
/*
- * Arrange for continuation at child_return(), which
+ * Arrange for continuation at fork_return(), which
* will return to exception_return(). Note that the child
* process doesn't stay in the kernel for long!
*
@@ -204,7 +204,7 @@ cpu_fork(p1, p2, flags)
*/
up->u_pcb.pcb_hw.apcb_ksp = (u_int64_t)p2tf;
up->u_pcb.pcb_context[0] =
- (u_int64_t)child_return; /* s0: pc */
+ (u_int64_t)fork_return; /* s0: pc */
up->u_pcb.pcb_context[1] =
(u_int64_t)exception_return; /* s1: ra */
up->u_pcb.pcb_context[2] = (u_long) p2; /* s2: a0 */
diff --git a/sys/powerpc/powerpc/vm_machdep.c b/sys/powerpc/powerpc/vm_machdep.c
index c60f971..c5c8cd5 100644
--- a/sys/powerpc/powerpc/vm_machdep.c
+++ b/sys/powerpc/powerpc/vm_machdep.c
@@ -196,7 +196,7 @@ cpu_fork(p1, p2, flags)
p2tf->tf_regs[FRAME_A4] = 1; /* is child (FreeBSD) */
/*
- * Arrange for continuation at child_return(), which
+ * Arrange for continuation at fork_return(), which
* will return to exception_return(). Note that the child
* process doesn't stay in the kernel for long!
*
@@ -204,7 +204,7 @@ cpu_fork(p1, p2, flags)
*/
up->u_pcb.pcb_hw.apcb_ksp = (u_int64_t)p2tf;
up->u_pcb.pcb_context[0] =
- (u_int64_t)child_return; /* s0: pc */
+ (u_int64_t)fork_return; /* s0: pc */
up->u_pcb.pcb_context[1] =
(u_int64_t)exception_return; /* s1: ra */
up->u_pcb.pcb_context[2] = (u_long) p2; /* s2: a0 */
diff --git a/sys/sys/proc.h b/sys/sys/proc.h
index 9a26541..b988887 100644
--- a/sys/sys/proc.h
+++ b/sys/sys/proc.h
@@ -48,9 +48,7 @@
#include <sys/queue.h>
#include <sys/rtprio.h> /* For struct rtprio. */
#include <sys/signal.h>
-#ifdef _KERNEL
-#include <machine/frame.h>
-#else
+#ifndef _KERNEL
#include <sys/time.h> /* For structs itimerval, timeval. */
#endif
#include <sys/ucred.h>
@@ -496,6 +494,7 @@ extern struct vm_zone *proc_zone;
#define PPQ (128 / NQS) /* Priorities per queue. */
struct mtx;
+struct trapframe;
struct proc *pfind __P((pid_t)); /* Find process by id. */
struct pgrp *pgfind __P((pid_t)); /* Find process group by id. */
@@ -507,7 +506,7 @@ void faultin __P((struct proc *p));
void fixjobc __P((struct proc *p, struct pgrp *pgrp, int entering));
int fork1 __P((struct proc *, int, struct proc **));
void fork_exit __P((void *(void *, struct trapframe *), void *,
- struct trapframe));
+ struct trapframe *));
void fork_return __P((struct proc *, struct trapframe *));
int inferior __P((struct proc *p));
int leavepgrp __P((struct proc *p));
OpenPOWER on IntegriCloud