Changeset View
Changeset View
Standalone View
Standalone View
head/sys/i386/i386/vm_machdep.c
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
#include <sys/bio.h> | #include <sys/bio.h> | ||||
#include <sys/buf.h> | #include <sys/buf.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/ktr.h> | #include <sys/ktr.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/mbuf.h> | #include <sys/mbuf.h> | ||||
#include <sys/mutex.h> | #include <sys/mutex.h> | ||||
#include <sys/pioctl.h> | |||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/sysent.h> | #include <sys/sysent.h> | ||||
#include <sys/sf_buf.h> | #include <sys/sf_buf.h> | ||||
#include <sys/smp.h> | #include <sys/smp.h> | ||||
#include <sys/sched.h> | #include <sys/sched.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/unistd.h> | #include <sys/unistd.h> | ||||
#include <sys/vnode.h> | #include <sys/vnode.h> | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | td2->td_frame = (struct trapframe *)((caddr_t)td2->td_pcb - | ||||
VM86_STACK_SPACE) - 1; | VM86_STACK_SPACE) - 1; | ||||
bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); | bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); | ||||
td2->td_frame->tf_eax = 0; /* Child returns zero */ | td2->td_frame->tf_eax = 0; /* Child returns zero */ | ||||
td2->td_frame->tf_eflags &= ~PSL_C; /* success */ | td2->td_frame->tf_eflags &= ~PSL_C; /* success */ | ||||
td2->td_frame->tf_edx = 1; | td2->td_frame->tf_edx = 1; | ||||
/* | /* | ||||
* If the parent process has the trap bit set (i.e. a debugger had | * If the parent process has the trap bit set (i.e. a debugger | ||||
* single stepped the process to the system call), we need to clear | * had single stepped the process to the system call), we need | ||||
* the trap flag from the new frame unless the debugger had set PF_FORK | * to clear the trap flag from the new frame. | ||||
* on the parent. Otherwise, the child will receive a (likely | |||||
* unexpected) SIGTRAP when it executes the first instruction after | |||||
* returning to userland. | |||||
*/ | */ | ||||
if ((p1->p_pfsflags & PF_FORK) == 0) | |||||
td2->td_frame->tf_eflags &= ~PSL_T; | td2->td_frame->tf_eflags &= ~PSL_T; | ||||
/* | /* | ||||
* Set registers for trampoline to user mode. Leave space for the | * Set registers for trampoline to user mode. Leave space for the | ||||
* return address on stack. These are the kernel mode register values. | * return address on stack. These are the kernel mode register values. | ||||
*/ | */ | ||||
pcb2->pcb_cr3 = pmap_get_cr3(vmspace_pmap(p2->p_vmspace)); | pcb2->pcb_cr3 = pmap_get_cr3(vmspace_pmap(p2->p_vmspace)); | ||||
pcb2->pcb_edi = 0; | pcb2->pcb_edi = 0; | ||||
pcb2->pcb_esi = (int)fork_return; /* fork_trampoline argument */ | pcb2->pcb_esi = (int)fork_return; /* fork_trampoline argument */ | ||||
▲ Show 20 Lines • Show All 453 Lines • Show Last 20 Lines |