Changeset View
Changeset View
Standalone View
Standalone View
head/sys/mips/mips/vm_machdep.c
Show First 20 Lines • Show All 408 Lines • ▼ Show 20 Lines | |||||
* Set that machine state for performing an upcall that starts | * Set that machine state for performing an upcall that starts | ||||
* the entry function with the given argument. | * the entry function with the given argument. | ||||
*/ | */ | ||||
void | void | ||||
cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg, | cpu_set_upcall(struct thread *td, void (*entry)(void *), void *arg, | ||||
stack_t *stack) | stack_t *stack) | ||||
{ | { | ||||
struct trapframe *tf; | struct trapframe *tf; | ||||
register_t sp; | register_t sp, sr; | ||||
sp = (((intptr_t)stack->ss_sp + stack->ss_size) & ~(STACK_ALIGN - 1)) - | sp = (((intptr_t)stack->ss_sp + stack->ss_size) & ~(STACK_ALIGN - 1)) - | ||||
CALLFRAME_SIZ; | CALLFRAME_SIZ; | ||||
/* | /* | ||||
* Set the trap frame to point at the beginning of the uts | * Set the trap frame to point at the beginning of the uts | ||||
* function. | * function. | ||||
*/ | */ | ||||
tf = td->td_frame; | tf = td->td_frame; | ||||
sr = tf->sr; | |||||
bzero(tf, sizeof(struct trapframe)); | bzero(tf, sizeof(struct trapframe)); | ||||
tf->sp = sp; | tf->sp = sp; | ||||
tf->sr = sr; | |||||
tf->pc = (register_t)(intptr_t)entry; | tf->pc = (register_t)(intptr_t)entry; | ||||
/* | /* | ||||
* MIPS ABI requires T9 to be the same as PC | * MIPS ABI requires T9 to be the same as PC | ||||
* in subroutine entry point | * in subroutine entry point | ||||
*/ | */ | ||||
tf->t9 = (register_t)(intptr_t)entry; | tf->t9 = (register_t)(intptr_t)entry; | ||||
tf->a0 = (register_t)(intptr_t)arg; | tf->a0 = (register_t)(intptr_t)arg; | ||||
/* | |||||
* Keep interrupt mask | |||||
*/ | |||||
td->td_frame->sr = MIPS_SR_KSU_USER | MIPS_SR_EXL | MIPS_SR_INT_IE | | |||||
(mips_rd_status() & MIPS_SR_INT_MASK); | |||||
#if defined(__mips_n32) | |||||
td->td_frame->sr |= MIPS_SR_PX; | |||||
#elif defined(__mips_n64) | |||||
td->td_frame->sr |= MIPS_SR_PX | MIPS_SR_UX | MIPS_SR_KX; | |||||
#endif | |||||
/* tf->sr |= (ALL_INT_MASK & idle_mask) | SR_INT_ENAB; */ | |||||
/**XXX the above may now be wrong -- mips2 implements this as panic */ | |||||
/* | /* | ||||
* FREEBSD_DEVELOPERS_FIXME: | * FREEBSD_DEVELOPERS_FIXME: | ||||
* Setup any other CPU-Specific registers (Not MIPS Standard) | * Setup any other CPU-Specific registers (Not MIPS Standard) | ||||
* that are needed. | * that are needed. | ||||
*/ | */ | ||||
} | } | ||||
bool | bool | ||||
▲ Show 20 Lines • Show All 170 Lines • Show Last 20 Lines |