Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/vm_machdep.c
Show First 20 Lines • Show All 569 Lines • ▼ Show 20 Lines | cpu_copy_thread(struct thread *td, struct thread *td0) | ||||
* values here. | * values here. | ||||
*/ | */ | ||||
if (td0 == curthread) | if (td0 == curthread) | ||||
update_pcb_bases(td0->td_pcb); | update_pcb_bases(td0->td_pcb); | ||||
bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); | bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); | ||||
clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | | clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | | ||||
PCB_KERNFPU); | PCB_KERNFPU); | ||||
pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); | pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); | ||||
bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, | |||||
cpu_max_ext_state_size); | |||||
set_pcb_flags_raw(pcb2, PCB_FULL_IRET); | set_pcb_flags_raw(pcb2, PCB_FULL_IRET); | ||||
/* | /* | ||||
* Create a new fresh stack for the new thread. | * Create a new fresh stack for the new thread. | ||||
*/ | */ | ||||
bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); | bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); | ||||
/* If the current thread has the trap bit set (i.e. a debugger had | /* If the current thread has the trap bit set (i.e. a debugger had | ||||
Show All 11 Lines | cpu_copy_thread(struct thread *td, struct thread *td0) | ||||
pcb2->pcb_r12 = (register_t)fork_return; /* trampoline arg */ | pcb2->pcb_r12 = (register_t)fork_return; /* trampoline arg */ | ||||
pcb2->pcb_rbp = 0; | pcb2->pcb_rbp = 0; | ||||
pcb2->pcb_rsp = (register_t)td->td_frame - sizeof(void *); /* trampoline arg */ | pcb2->pcb_rsp = (register_t)td->td_frame - sizeof(void *); /* trampoline arg */ | ||||
pcb2->pcb_rbx = (register_t)td; /* trampoline arg */ | pcb2->pcb_rbx = (register_t)td; /* trampoline arg */ | ||||
pcb2->pcb_rip = (register_t)fork_trampoline; | pcb2->pcb_rip = (register_t)fork_trampoline; | ||||
/* | /* | ||||
* If we didn't copy the pcb, we'd need to do the following registers: | * If we didn't copy the pcb, we'd need to do the following registers: | ||||
* pcb2->pcb_dr*: cloned above. | * pcb2->pcb_dr*: cloned above. | ||||
* pcb2->pcb_savefpu: cloned above. | |||||
* pcb2->pcb_onfault: cloned above (always NULL here?). | * pcb2->pcb_onfault: cloned above (always NULL here?). | ||||
* pcb2->pcb_[fg]sbase: cloned above | * pcb2->pcb_[fg]sbase: cloned above | ||||
*/ | */ | ||||
/* Setup to release spin count in fork_exit(). */ | /* Setup to release spin count in fork_exit(). */ | ||||
td->td_md.md_spinlock_count = 1; | td->td_md.md_spinlock_count = 1; | ||||
td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; | td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; | ||||
pmap_thread_init_invl_gen(td); | pmap_thread_init_invl_gen(td); | ||||
▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines |