Changeset View
Changeset View
Standalone View
Standalone View
sys/arm64/arm64/machdep.c
Show First 20 Lines • Show All 423 Lines • ▼ Show 20 Lines | get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret) | ||||
} | } | ||||
memcpy(&mcp->mc_gpregs.gp_x[1], &tf->tf_x[1], | memcpy(&mcp->mc_gpregs.gp_x[1], &tf->tf_x[1], | ||||
sizeof(mcp->mc_gpregs.gp_x[1]) * (nitems(mcp->mc_gpregs.gp_x) - 1)); | sizeof(mcp->mc_gpregs.gp_x[1]) * (nitems(mcp->mc_gpregs.gp_x) - 1)); | ||||
mcp->mc_gpregs.gp_sp = tf->tf_sp; | mcp->mc_gpregs.gp_sp = tf->tf_sp; | ||||
mcp->mc_gpregs.gp_lr = tf->tf_lr; | mcp->mc_gpregs.gp_lr = tf->tf_lr; | ||||
mcp->mc_gpregs.gp_elr = tf->tf_elr; | mcp->mc_gpregs.gp_elr = tf->tf_elr; | ||||
mcp->mc_gpregs.gp_esr = tf->tf_esr; | |||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
set_mcontext(struct thread *td, mcontext_t *mcp) | set_mcontext(struct thread *td, mcontext_t *mcp) | ||||
{ | { | ||||
struct trapframe *tf = td->td_frame; | struct trapframe *tf = td->td_frame; | ||||
uint32_t spsr; | uint32_t spsr; | ||||
spsr = mcp->mc_gpregs.gp_spsr; | spsr = mcp->mc_gpregs.gp_spsr; | ||||
if ((spsr & PSR_M_MASK) != PSR_M_EL0t || | if ((spsr & PSR_M_MASK) != PSR_M_EL0t || | ||||
(spsr & (PSR_AARCH32 | PSR_F | PSR_I | PSR_A | PSR_D)) != 0) | (spsr & (PSR_AARCH32 | PSR_F | PSR_I | PSR_A | PSR_D)) != 0) | ||||
return (EINVAL); | return (EINVAL); | ||||
memcpy(tf->tf_x, mcp->mc_gpregs.gp_x, sizeof(tf->tf_x)); | memcpy(tf->tf_x, mcp->mc_gpregs.gp_x, sizeof(tf->tf_x)); | ||||
tf->tf_sp = mcp->mc_gpregs.gp_sp; | tf->tf_sp = mcp->mc_gpregs.gp_sp; | ||||
tf->tf_lr = mcp->mc_gpregs.gp_lr; | tf->tf_lr = mcp->mc_gpregs.gp_lr; | ||||
tf->tf_elr = mcp->mc_gpregs.gp_elr; | tf->tf_elr = mcp->mc_gpregs.gp_elr; | ||||
tf->tf_esr = mcp->mc_gpregs.gp_esr; | |||||
tf->tf_spsr = mcp->mc_gpregs.gp_spsr; | tf->tf_spsr = mcp->mc_gpregs.gp_spsr; | ||||
return (0); | return (0); | ||||
} | } | ||||
static void | static void | ||||
get_fpcontext(struct thread *td, mcontext_t *mcp) | get_fpcontext(struct thread *td, mcontext_t *mcp) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 794 Lines • Show Last 20 Lines |