Changeset View
Changeset View
Standalone View
Standalone View
head/sys/mips/mips/pm_machdep.c
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
#include <sys/ptrace.h> | #include <sys/ptrace.h> | ||||
#include <sys/syslog.h> | #include <sys/syslog.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include <vm/vm_map.h> | #include <vm/vm_map.h> | ||||
#include <vm/vm_extern.h> | #include <vm/vm_extern.h> | ||||
#include <sys/user.h> | #include <sys/user.h> | ||||
#include <sys/uio.h> | #include <sys/uio.h> | ||||
#include <machine/abi.h> | |||||
#include <machine/cpuinfo.h> | #include <machine/cpuinfo.h> | ||||
#include <machine/reg.h> | #include <machine/reg.h> | ||||
#include <machine/md_var.h> | #include <machine/md_var.h> | ||||
#include <machine/sigframe.h> | #include <machine/sigframe.h> | ||||
#include <machine/tls.h> | #include <machine/tls.h> | ||||
#include <machine/vmparam.h> | #include <machine/vmparam.h> | ||||
#include <sys/vnode.h> | #include <sys/vnode.h> | ||||
#include <fs/pseudofs/pseudofs.h> | #include <fs/pseudofs/pseudofs.h> | ||||
▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | bcopy((void *)&td->td_frame->f0, | ||||
sizeof(sf.sf_uc.uc_mcontext.mc_fpregs)); | sizeof(sf.sf_uc.uc_mcontext.mc_fpregs)); | ||||
} | } | ||||
/* Allocate and validate space for the signal handler context. */ | /* Allocate and validate space for the signal handler context. */ | ||||
if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && | if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && | ||||
SIGISMEMBER(psp->ps_sigonstack, sig)) { | SIGISMEMBER(psp->ps_sigonstack, sig)) { | ||||
sfp = (struct sigframe *)(((uintptr_t)td->td_sigstk.ss_sp + | sfp = (struct sigframe *)(((uintptr_t)td->td_sigstk.ss_sp + | ||||
td->td_sigstk.ss_size - sizeof(struct sigframe)) | td->td_sigstk.ss_size - sizeof(struct sigframe)) | ||||
& ~(sizeof(__int64_t) - 1)); | & ~(STACK_ALIGN - 1)); | ||||
} else | } else | ||||
sfp = (struct sigframe *)((vm_offset_t)(regs->sp - | sfp = (struct sigframe *)((vm_offset_t)(regs->sp - | ||||
sizeof(struct sigframe)) & ~(sizeof(__int64_t) - 1)); | sizeof(struct sigframe)) & ~(STACK_ALIGN - 1)); | ||||
/* Build the argument list for the signal handler. */ | /* Build the argument list for the signal handler. */ | ||||
regs->a0 = sig; | regs->a0 = sig; | ||||
regs->a2 = (register_t)(intptr_t)&sfp->sf_uc; | regs->a2 = (register_t)(intptr_t)&sfp->sf_uc; | ||||
if (SIGISMEMBER(psp->ps_siginfo, sig)) { | if (SIGISMEMBER(psp->ps_siginfo, sig)) { | ||||
/* Signal handler installed with SA_SIGINFO. */ | /* Signal handler installed with SA_SIGINFO. */ | ||||
regs->a1 = (register_t)(intptr_t)&sfp->sf_si; | regs->a1 = (register_t)(intptr_t)&sfp->sf_si; | ||||
/* sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; */ | /* sf.sf_ahu.sf_action = (__siginfohandler_t *)catcher; */ | ||||
▲ Show 20 Lines • Show All 256 Lines • ▼ Show 20 Lines | |||||
* code by the MIPS elf abi). | * code by the MIPS elf abi). | ||||
*/ | */ | ||||
void | void | ||||
exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) | exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) | ||||
{ | { | ||||
bzero((caddr_t)td->td_frame, sizeof(struct trapframe)); | bzero((caddr_t)td->td_frame, sizeof(struct trapframe)); | ||||
/* | td->td_frame->sp = ((register_t)stack) & ~(STACK_ALIGN - 1); | ||||
* The stack pointer has to be aligned to accommodate the largest | |||||
* datatype at minimum. This probably means it should be 16-byte | |||||
* aligned, but for now we're 8-byte aligning it. | |||||
*/ | |||||
td->td_frame->sp = ((register_t) stack) & ~(sizeof(__int64_t) - 1); | |||||
/* | /* | ||||
* If we're running o32 or n32 programs but have 64-bit registers, | * If we're running o32 or n32 programs but have 64-bit registers, | ||||
* GCC may use stack-relative addressing near the top of user | * GCC may use stack-relative addressing near the top of user | ||||
* address space that, due to sign extension, will yield an | * address space that, due to sign extension, will yield an | ||||
* invalid address. For instance, if sp is 0x7fffff00 then GCC | * invalid address. For instance, if sp is 0x7fffff00 then GCC | ||||
* might do something like this to load a word from 0x7ffffff0: | * might do something like this to load a word from 0x7ffffff0: | ||||
* | * | ||||
▲ Show 20 Lines • Show All 77 Lines • Show Last 20 Lines |