Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/ia32/ia32_signal.c
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
#include <machine/segments.h> | #include <machine/segments.h> | ||||
#include <machine/specialreg.h> | #include <machine/specialreg.h> | ||||
#include <machine/frame.h> | #include <machine/frame.h> | ||||
#include <machine/md_var.h> | #include <machine/md_var.h> | ||||
#include <machine/pcb.h> | #include <machine/pcb.h> | ||||
#include <machine/cpufunc.h> | #include <machine/cpufunc.h> | ||||
#include <machine/trap.h> | #include <machine/trap.h> | ||||
#include "vdso_ia32_offsets.h" | |||||
extern const char _binary_elf_vdso32_so_1_start[]; | |||||
extern const char _binary_elf_vdso32_so_1_end[]; | |||||
extern char _binary_elf_vdso32_so_1_size; | |||||
#ifdef COMPAT_FREEBSD4 | #ifdef COMPAT_FREEBSD4 | ||||
static void freebsd4_ia32_sendsig(sig_t, ksiginfo_t *, sigset_t *); | static void freebsd4_ia32_sendsig(sig_t, ksiginfo_t *, sigset_t *); | ||||
#endif | #endif | ||||
static void | static void | ||||
ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, | ia32_get_fpcontext(struct thread *td, struct ia32_mcontext *mcp, | ||||
char **xfpusave, size_t *xfpusave_len) | char **xfpusave, size_t *xfpusave_len) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 319 Lines • ▼ Show 20 Lines | |||||
#ifdef DEBUG | #ifdef DEBUG | ||||
printf("process %ld has trashed its stack\n", (long)p->p_pid); | printf("process %ld has trashed its stack\n", (long)p->p_pid); | ||||
#endif | #endif | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
sigexit(td, SIGILL); | sigexit(td, SIGILL); | ||||
} | } | ||||
regs->tf_rsp = (uintptr_t)fp; | regs->tf_rsp = (uintptr_t)fp; | ||||
regs->tf_rip = p->p_sysent->sv_psstrings - sz_ia32_osigcode; | regs->tf_rip = p->p_sysent->sv_psstrings - | ||||
(_binary_elf_vdso32_so_1_end - _binary_elf_vdso32_so_1_start) + | |||||
VDSO_IA32_OSIGCODE_OFFSET; | |||||
regs->tf_rflags &= ~(PSL_T | PSL_D); | regs->tf_rflags &= ~(PSL_T | PSL_D); | ||||
regs->tf_cs = _ucode32sel; | regs->tf_cs = _ucode32sel; | ||||
regs->tf_ds = _udatasel; | regs->tf_ds = _udatasel; | ||||
regs->tf_es = _udatasel; | regs->tf_es = _udatasel; | ||||
regs->tf_fs = _udatasel; | regs->tf_fs = _udatasel; | ||||
regs->tf_ss = _udatasel; | regs->tf_ss = _udatasel; | ||||
set_pcb_flags(td->td_pcb, PCB_FULL_IRET); | set_pcb_flags(td->td_pcb, PCB_FULL_IRET); | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | |||||
#ifdef DEBUG | #ifdef DEBUG | ||||
printf("process %ld has trashed its stack\n", (long)p->p_pid); | printf("process %ld has trashed its stack\n", (long)p->p_pid); | ||||
#endif | #endif | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
sigexit(td, SIGILL); | sigexit(td, SIGILL); | ||||
} | } | ||||
regs->tf_rsp = (uintptr_t)sfp; | regs->tf_rsp = (uintptr_t)sfp; | ||||
regs->tf_rip = p->p_sysent->sv_sigcode_base + sz_ia32_sigcode - | regs->tf_rip = p->p_sysent->sv_sigcode_base + | ||||
sz_freebsd4_ia32_sigcode; | VDSO_FREEBSD4_IA32_SIGCODE_OFFSET - VDSO_IA32_SIGCODE_OFFSET; | ||||
regs->tf_rflags &= ~(PSL_T | PSL_D); | regs->tf_rflags &= ~(PSL_T | PSL_D); | ||||
regs->tf_cs = _ucode32sel; | regs->tf_cs = _ucode32sel; | ||||
regs->tf_ss = _udatasel; | regs->tf_ss = _udatasel; | ||||
regs->tf_ds = _udatasel; | regs->tf_ds = _udatasel; | ||||
regs->tf_es = _udatasel; | regs->tf_es = _udatasel; | ||||
set_pcb_flags(td->td_pcb, PCB_FULL_IRET); | set_pcb_flags(td->td_pcb, PCB_FULL_IRET); | ||||
/* leave user %fs and %gs untouched */ | /* leave user %fs and %gs untouched */ | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
▲ Show 20 Lines • Show All 417 Lines • Show Last 20 Lines |