Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/linux/linux_sysvec.c
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | |||||
SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); | SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); | ||||
static int linux_copyout_strings(struct image_params *imgp, | static int linux_copyout_strings(struct image_params *imgp, | ||||
uintptr_t *stack_base); | uintptr_t *stack_base); | ||||
static int linux_fixup_elf(uintptr_t *stack_base, | static int linux_fixup_elf(uintptr_t *stack_base, | ||||
struct image_params *iparams); | struct image_params *iparams); | ||||
static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); | static bool linux_trans_osrel(const Elf_Note *note, int32_t *osrel); | ||||
static void linux_vdso_install(void *param); | static void linux_vdso_install(const void *param); | ||||
static void linux_vdso_deinstall(void *param); | static void linux_vdso_deinstall(const void *param); | ||||
static void linux_vdso_reloc(char *mapping, Elf_Addr offset); | static void linux_vdso_reloc(char *mapping, Elf_Addr offset); | ||||
static void linux_set_syscall_retval(struct thread *td, int error); | static void linux_set_syscall_retval(struct thread *td, int error); | ||||
static int linux_fetch_syscall_args(struct thread *td); | static int linux_fetch_syscall_args(struct thread *td); | ||||
static void linux_exec_setregs(struct thread *td, struct image_params *imgp, | static void linux_exec_setregs(struct thread *td, struct image_params *imgp, | ||||
uintptr_t stack); | uintptr_t stack); | ||||
static void linux_exec_sysvec_init(void *param); | static void linux_exec_sysvec_init(void *param); | ||||
static int linux_on_exec_vmspace(struct proc *p, struct image_params *imgp); | static int linux_on_exec_vmspace(struct proc *p, struct image_params *imgp); | ||||
static int linux_vsyscall(struct thread *td); | static int linux_vsyscall(struct thread *td); | ||||
▲ Show 20 Lines • Show All 692 Lines • ▼ Show 20 Lines | linux_exec_sysvec_init(void *param) | ||||
*ktsc_selector = linux_vdso_tsc_selector_idx(); | *ktsc_selector = linux_vdso_tsc_selector_idx(); | ||||
if (bootverbose) | if (bootverbose) | ||||
printf("Linux x86-64 vDSO tsc_selector: %lu\n", *ktsc_selector); | printf("Linux x86-64 vDSO tsc_selector: %lu\n", *ktsc_selector); | ||||
} | } | ||||
SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC, SI_ORDER_ANY, | SYSINIT(elf_linux_exec_sysvec_init, SI_SUB_EXEC, SI_ORDER_ANY, | ||||
linux_exec_sysvec_init, &elf_linux_sysvec); | linux_exec_sysvec_init, &elf_linux_sysvec); | ||||
static void | static void | ||||
linux_vdso_install(void *param) | linux_vdso_install(const void *param) | ||||
{ | { | ||||
char *vdso_start = &_binary_linux_vdso_so_o_start; | char *vdso_start = &_binary_linux_vdso_so_o_start; | ||||
char *vdso_end = &_binary_linux_vdso_so_o_end; | char *vdso_end = &_binary_linux_vdso_so_o_end; | ||||
linux_szsigcode = vdso_end - vdso_start; | linux_szsigcode = vdso_end - vdso_start; | ||||
MPASS(linux_szsigcode <= LINUX_VDSOPAGE_SIZE); | MPASS(linux_szsigcode <= LINUX_VDSOPAGE_SIZE); | ||||
linux_vdso_base = LINUX_VDSOPAGE_LA48; | linux_vdso_base = LINUX_VDSOPAGE_LA48; | ||||
if (hw_lower_amd64_sharedpage != 0) | if (hw_lower_amd64_sharedpage != 0) | ||||
linux_vdso_base -= PAGE_SIZE; | linux_vdso_base -= PAGE_SIZE; | ||||
__elfN(linux_vdso_fixup)(vdso_start, linux_vdso_base); | __elfN(linux_vdso_fixup)(vdso_start, linux_vdso_base); | ||||
linux_vdso_obj = __elfN(linux_shared_page_init) | linux_vdso_obj = __elfN(linux_shared_page_init) | ||||
(&linux_vdso_mapping, LINUX_VDSOPAGE_SIZE); | (&linux_vdso_mapping, LINUX_VDSOPAGE_SIZE); | ||||
bcopy(vdso_start, linux_vdso_mapping, linux_szsigcode); | bcopy(vdso_start, linux_vdso_mapping, linux_szsigcode); | ||||
linux_vdso_reloc(linux_vdso_mapping, linux_vdso_base); | linux_vdso_reloc(linux_vdso_mapping, linux_vdso_base); | ||||
} | } | ||||
SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_FIRST, | SYSINIT(elf_linux_vdso_init, SI_SUB_EXEC, SI_ORDER_FIRST, | ||||
linux_vdso_install, NULL); | linux_vdso_install, NULL); | ||||
static void | static void | ||||
linux_vdso_deinstall(void *param) | linux_vdso_deinstall(const void *param) | ||||
{ | { | ||||
__elfN(linux_shared_page_fini)(linux_vdso_obj, | __elfN(linux_shared_page_fini)(linux_vdso_obj, | ||||
linux_vdso_mapping, LINUX_VDSOPAGE_SIZE); | linux_vdso_mapping, LINUX_VDSOPAGE_SIZE); | ||||
} | } | ||||
SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, | SYSUNINIT(elf_linux_vdso_uninit, SI_SUB_EXEC, SI_ORDER_FIRST, | ||||
linux_vdso_deinstall, NULL); | linux_vdso_deinstall, NULL); | ||||
▲ Show 20 Lines • Show All 192 Lines • Show Last 20 Lines |