Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/elf_machdep.c
Show All 29 Lines | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/kernel.h> | #include <sys/kernel.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/exec.h> | #include <sys/exec.h> | ||||
#include <sys/imgact.h> | #include <sys/imgact.h> | ||||
#include <sys/linker.h> | #include <sys/linker.h> | ||||
#include <sys/proc.h> | #include <sys/proc.h> | ||||
#include <sys/reg.h> | |||||
#include <sys/sysent.h> | #include <sys/sysent.h> | ||||
#include <sys/imgact_elf.h> | #include <sys/imgact_elf.h> | ||||
#include <sys/syscall.h> | #include <sys/syscall.h> | ||||
#include <sys/signalvar.h> | #include <sys/signalvar.h> | ||||
#include <sys/vnode.h> | #include <sys/vnode.h> | ||||
#include <vm/vm.h> | #include <vm/vm.h> | ||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
▲ Show 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | struct sysentvec elf64_freebsd_sysvec_la48 = { | ||||
.sv_shared_page_base = SHAREDPAGE_LA48, | .sv_shared_page_base = SHAREDPAGE_LA48, | ||||
.sv_shared_page_len = PAGE_SIZE, | .sv_shared_page_len = PAGE_SIZE, | ||||
.sv_schedtail = NULL, | .sv_schedtail = NULL, | ||||
.sv_thread_detach = NULL, | .sv_thread_detach = NULL, | ||||
.sv_trap = NULL, | .sv_trap = NULL, | ||||
.sv_onexec_old = exec_onexec_old, | .sv_onexec_old = exec_onexec_old, | ||||
.sv_onexit = exit_onexit, | .sv_onexit = exit_onexit, | ||||
.sv_set_fork_retval = x86_set_fork_retval, | .sv_set_fork_retval = x86_set_fork_retval, | ||||
.sv_regset_begin = SET_BEGIN(__elfN(regset)), | |||||
.sv_regset_end = SET_LIMIT(__elfN(regset)), | |||||
}; | }; | ||||
struct sysentvec elf64_freebsd_sysvec_la57 = { | struct sysentvec elf64_freebsd_sysvec_la57 = { | ||||
.sv_size = SYS_MAXSYSCALL, | .sv_size = SYS_MAXSYSCALL, | ||||
.sv_table = sysent, | .sv_table = sysent, | ||||
.sv_transtrap = NULL, | .sv_transtrap = NULL, | ||||
.sv_fixup = __elfN(freebsd_fixup), | .sv_fixup = __elfN(freebsd_fixup), | ||||
.sv_sendsig = sendsig, | .sv_sendsig = sendsig, | ||||
Show All 26 Lines | struct sysentvec elf64_freebsd_sysvec_la57 = { | ||||
.sv_shared_page_base = SHAREDPAGE_LA57, | .sv_shared_page_base = SHAREDPAGE_LA57, | ||||
.sv_shared_page_len = PAGE_SIZE, | .sv_shared_page_len = PAGE_SIZE, | ||||
.sv_schedtail = NULL, | .sv_schedtail = NULL, | ||||
.sv_thread_detach = NULL, | .sv_thread_detach = NULL, | ||||
.sv_trap = NULL, | .sv_trap = NULL, | ||||
.sv_onexec_old = exec_onexec_old, | .sv_onexec_old = exec_onexec_old, | ||||
.sv_onexit = exit_onexit, | .sv_onexit = exit_onexit, | ||||
.sv_set_fork_retval= x86_set_fork_retval, | .sv_set_fork_retval= x86_set_fork_retval, | ||||
.sv_regset_begin = SET_BEGIN(__elfN(regset)), | |||||
.sv_regset_end = SET_LIMIT(__elfN(regset)), | |||||
}; | }; | ||||
static void | static void | ||||
amd64_init_sysvecs(void *arg) | amd64_init_sysvecs(void *arg) | ||||
{ | { | ||||
amd64_lower_shared_page(&elf64_freebsd_sysvec_la48); | amd64_lower_shared_page(&elf64_freebsd_sysvec_la48); | ||||
if (la57) { | if (la57) { | ||||
exec_sysvec_init(&elf64_freebsd_sysvec_la57); | exec_sysvec_init(&elf64_freebsd_sysvec_la57); | ||||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | if (use_xsave) { | ||||
if (dst != NULL) { | if (dst != NULL) { | ||||
fpugetregs(td); | fpugetregs(td); | ||||
len += elf64_populate_note(NT_X86_XSTATE, | len += elf64_populate_note(NT_X86_XSTATE, | ||||
get_pcb_user_save_td(td), dst, | get_pcb_user_save_td(td), dst, | ||||
cpu_max_ext_state_size, &buf); | cpu_max_ext_state_size, &buf); | ||||
*(uint64_t *)((char *)buf + X86_XSTATE_XCR0_OFFSET) = | *(uint64_t *)((char *)buf + X86_XSTATE_XCR0_OFFSET) = | ||||
xsave_mask; | xsave_mask; | ||||
} else | } else | ||||
len += elf64_populate_note(NT_X86_XSTATE, NULL, NULL, | len += elf64_populate_note(NT_X86_XSTATE, NULL, NULL, | ||||
kib: I believe you can do the assignment in fpu,c where cpu_max_ext_state_size is calculated, there… | |||||
Done Inline ActionsI'm planning on splitting this out into a new review. I kept it in for some context on how the KPI should be used. andrew: I'm planning on splitting this out into a new review. I kept it in for some context on how the… | |||||
cpu_max_ext_state_size, NULL); | cpu_max_ext_state_size, NULL); | ||||
} | } | ||||
*off = len; | *off = len; | ||||
} | } | ||||
bool | bool | ||||
elf_is_ifunc_reloc(Elf_Size r_info) | elf_is_ifunc_reloc(Elf_Size r_info) | ||||
Not Done Inline ActionsThis looks strange, I see that it matches the note behavior but still. If !use_xsave, you would return x87+XMM state, which is strict subset of XSAVE state. kib: This looks strange, I see that it matches the note behavior but still. If !use_xsave, you… | |||||
{ | { | ||||
return (ELF_R_TYPE(r_info) == R_X86_64_IRELATIVE); | return (ELF_R_TYPE(r_info) == R_X86_64_IRELATIVE); | ||||
} | } | ||||
/* Process one elf relocation with addend. */ | /* Process one elf relocation with addend. */ | ||||
static int | static int | ||||
elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data, | elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data, | ||||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |
I believe you can do the assignment in fpu,c where cpu_max_ext_state_size is calculated, there is no need in SYSINIT.