Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/machdep.c
Show First 20 Lines • Show All 576 Lines • ▼ Show 20 Lines | |||||
freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) | freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) | ||||
{ | { | ||||
return sys_sigreturn(td, (struct sigreturn_args *)uap); | return sys_sigreturn(td, (struct sigreturn_args *)uap); | ||||
} | } | ||||
#endif | #endif | ||||
/* | /* | ||||
* Reset the hardware debug registers if they were in use. | |||||
* They won't have any meaning for the newly exec'd process. | |||||
*/ | |||||
void | |||||
x86_clear_dbregs(struct pcb *pcb) | |||||
{ | |||||
if ((pcb->pcb_flags & PCB_DBREGS) == 0) | |||||
return; | |||||
pcb->pcb_dr0 = 0; | |||||
pcb->pcb_dr1 = 0; | |||||
pcb->pcb_dr2 = 0; | |||||
pcb->pcb_dr3 = 0; | |||||
pcb->pcb_dr6 = 0; | |||||
pcb->pcb_dr7 = 0; | |||||
if (pcb == curpcb) { | |||||
/* | |||||
* Clear the debug registers on the running CPU, | |||||
* otherwise they will end up affecting the next | |||||
* process we switch to. | |||||
*/ | |||||
reset_dbregs(); | |||||
} | |||||
clear_pcb_flags(pcb, PCB_DBREGS); | |||||
} | |||||
/* | |||||
* Reset registers to default values on exec. | * Reset registers to default values on exec. | ||||
*/ | */ | ||||
void | void | ||||
exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) | exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) | ||||
{ | { | ||||
struct trapframe *regs; | struct trapframe *regs; | ||||
struct pcb *pcb; | struct pcb *pcb; | ||||
register_t saved_rflags; | register_t saved_rflags; | ||||
Show All 19 Lines | exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) | ||||
regs->tf_ss = _udatasel; | regs->tf_ss = _udatasel; | ||||
regs->tf_cs = _ucodesel; | regs->tf_cs = _ucodesel; | ||||
regs->tf_ds = _udatasel; | regs->tf_ds = _udatasel; | ||||
regs->tf_es = _udatasel; | regs->tf_es = _udatasel; | ||||
regs->tf_fs = _ufssel; | regs->tf_fs = _ufssel; | ||||
regs->tf_gs = _ugssel; | regs->tf_gs = _ugssel; | ||||
regs->tf_flags = TF_HASSEGS; | regs->tf_flags = TF_HASSEGS; | ||||
/* | x86_clear_dbregs(pcb); | ||||
* Reset the hardware debug registers if they were in use. | |||||
* They won't have any meaning for the newly exec'd process. | |||||
*/ | |||||
if (pcb->pcb_flags & PCB_DBREGS) { | |||||
pcb->pcb_dr0 = 0; | |||||
pcb->pcb_dr1 = 0; | |||||
pcb->pcb_dr2 = 0; | |||||
pcb->pcb_dr3 = 0; | |||||
pcb->pcb_dr6 = 0; | |||||
pcb->pcb_dr7 = 0; | |||||
if (pcb == curpcb) { | |||||
/* | |||||
* Clear the debug registers on the running | |||||
* CPU, otherwise they will end up affecting | |||||
* the next process we switch to. | |||||
*/ | |||||
reset_dbregs(); | |||||
} | |||||
clear_pcb_flags(pcb, PCB_DBREGS); | |||||
} | |||||
/* | /* | ||||
* Drop the FP state if we hold it, so that the process gets a | * Drop the FP state if we hold it, so that the process gets a | ||||
* clean FP state if it uses the FPU again. | * clean FP state if it uses the FPU again. | ||||
*/ | */ | ||||
fpstate_drop(td); | fpstate_drop(td); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,149 Lines • Show Last 20 Lines |