Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/vm_machdep.c
Show First 20 Lines • Show All 558 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
void | void | ||||
cpu_copy_thread(struct thread *td, struct thread *td0) | cpu_copy_thread(struct thread *td, struct thread *td0) | ||||
{ | { | ||||
struct pcb *pcb2; | struct pcb *pcb2; | ||||
pcb2 = td->td_pcb; | pcb2 = td->td_pcb; | ||||
/* Ensure that td0's pcb is up to date. */ | |||||
fpuexit(td0); | |||||
if (td0 == curthread) | |||||
update_pcb_bases(td0->td_pcb); | |||||
/* | /* | ||||
* Copy the upcall pcb. This loads kernel regs. | * Copy the upcall pcb. This loads kernel regs. | ||||
* Those not loaded individually below get their default | * Those not loaded individually below get their default | ||||
* values here. | * values here. | ||||
*/ | */ | ||||
if (td0 == curthread) | |||||
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_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, | bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, | ||||
cpu_max_ext_state_size); | 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. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 149 Lines • Show Last 20 Lines |