MCPcopy Create free account
hub / github.com/F-Stack/f-stack / linux_vsyscall

Function linux_vsyscall

freebsd/amd64/linux/linux_sysvec.c:714–750  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

712};
713
714static int
715linux_vsyscall(struct thread *td)
716{
717 struct trapframe *frame;
718 uint64_t retqaddr;
719 int code, traced;
720 int error;
721
722 frame = td->td_frame;
723
724 /* Check %rip for vsyscall area. */
725 if (__predict_true(frame->tf_rip < LINUX_VSYSCALL_START))
726 return (EINVAL);
727 if ((frame->tf_rip & (LINUX_VSYSCALL_SZ - 1)) != 0)
728 return (EINVAL);
729 code = (frame->tf_rip - LINUX_VSYSCALL_START) / LINUX_VSYSCALL_SZ;
730 if (code >= nitems(linux_vsyscall_vector))
731 return (EINVAL);
732
733 /*
734 * vsyscall called as callq *(%rax), so we must
735 * use return address from %rsp and also fixup %rsp.
736 */
737 error = copyin((void *)frame->tf_rsp, &retqaddr, sizeof(retqaddr));
738 if (error)
739 return (error);
740
741 frame->tf_rip = retqaddr;
742 frame->tf_rax = linux_vsyscall_vector[code];
743 frame->tf_rsp += 8;
744
745 traced = (frame->tf_flags & PSL_T);
746
747 amd64_syscall(td, traced);
748
749 return (0);
750}
751
752struct sysentvec elf_linux_sysvec = {
753 .sv_size = LINUX_SYS_MAXSYSCALL,

Callers

nothing calls this directly

Calls 2

amd64_syscallFunction · 0.85
copyinFunction · 0.50

Tested by

no test coverage detected