Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/machdep.c
Show First 20 Lines • Show All 542 Lines • ▼ Show 20 Lines | |||||
ptrace_clear_single_step(struct thread *td) | ptrace_clear_single_step(struct thread *td) | ||||
{ | { | ||||
td->td_frame->tf_spsr &= ~PSR_SS; | td->td_frame->tf_spsr &= ~PSR_SS; | ||||
td->td_pcb->pcb_flags &= ~PCB_SINGLE_STEP; | td->td_pcb->pcb_flags &= ~PCB_SINGLE_STEP; | ||||
return (0); | return (0); | ||||
} | } | ||||
/* | |||||
* Reset the FP state to avoid leaking state from the parent process across | |||||
* execve() (and to ensure that we get a consitent floating point environment | |||||
* in every new process). | |||||
*/ | |||||
void | void | ||||
exec_reset_vfp_state(struct thread *td, struct pcb *pcb) | |||||
andrew: This should be in `vfp.c` and should probably call `vfp_discard` to ensure the hardware state… | |||||
arichardsonAuthorUnsubmitted Done Inline ActionsI just tried moving it to vfp.c but that makes things really ugly if I want to handle !VFP cases. Can't I just add #ifdef VFP vfp_discard(td); #endif to the end of this function? arichardson: I just tried moving it to vfp.c but that makes things really ugly if I want to handle !VFP… | |||||
{ | |||||
bzero(&pcb->pcb_fpustate.vfp_regs, sizeof(pcb->pcb_fpustate.vfp_regs)); | |||||
KASSERT(pcb->pcb_fpusaved == &pcb->pcb_fpustate, | |||||
("pcb_fpusaved should point to pcb_fpustate.")); | |||||
pcb->pcb_fpustate.vfp_fpcr = initial_fpcr; | |||||
pcb->pcb_fpustate.vfp_fpsr = 0; | |||||
pcb->pcb_vfpcpu = UINT_MAX; | |||||
pcb->pcb_fpflags = 0; | |||||
} | |||||
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 *tf = td->td_frame; | struct trapframe *tf = td->td_frame; | ||||
struct pcb *pcb = td->td_pcb; | |||||
memset(tf, 0, sizeof(struct trapframe)); | memset(tf, 0, sizeof(struct trapframe)); | ||||
tf->tf_x[0] = stack; | tf->tf_x[0] = stack; | ||||
tf->tf_sp = STACKALIGN(stack); | tf->tf_sp = STACKALIGN(stack); | ||||
tf->tf_lr = imgp->entry_addr; | tf->tf_lr = imgp->entry_addr; | ||||
tf->tf_elr = imgp->entry_addr; | tf->tf_elr = imgp->entry_addr; | ||||
exec_reset_vfp_state(td, pcb); | |||||
/* FIXME: Shouldn't we also reset pcb_dbg_regs? */ | |||||
/* XXX: should exec clear single-step in pcb_flags? */ | |||||
} | } | ||||
/* Sanity check these are the same size, they will be memcpy'd to and fro */ | /* Sanity check these are the same size, they will be memcpy'd to and fro */ | ||||
CTASSERT(sizeof(((struct trapframe *)0)->tf_x) == | CTASSERT(sizeof(((struct trapframe *)0)->tf_x) == | ||||
sizeof((struct gpregs *)0)->gp_x); | sizeof((struct gpregs *)0)->gp_x); | ||||
CTASSERT(sizeof(((struct trapframe *)0)->tf_x) == | CTASSERT(sizeof(((struct trapframe *)0)->tf_x) == | ||||
sizeof((struct reg *)0)->x); | sizeof((struct reg *)0)->x); | ||||
▲ Show 20 Lines • Show All 892 Lines • Show Last 20 Lines |
This should be in vfp.c and should probably call vfp_discard to ensure the hardware state is updated if it's enabled.