Syscall / System Call / vDSO in FreeBSD and Linux

vsyscall / vDSO

vDSOs (virtual dynamically linked shared objects)
What are vdso and vsyscall?
Creating a vDSO: the Colonel’s Other Chicken
On vsyscalls and the vDSO
Linux syscall, vsyscall, and vDSO… Oh My!
What is

Sysenter Based System Call Mechanism in Linux 2.6
How to invoke a system call via sysenter in inline assembly (x86/amd64 linux)?
Intel x86 vs x64 system call
Call gate
System Calls
Debugging in AMD64 64-bit Mode in Theory

Comparison of command shells


Linux kernel interfaces
The Linux Programming Interface
System call
wait (system call)
read (system call)

Linux System Calls Overview
Where is the system call table in linux kernel v3.9?
Where is the system call table in linux kernel v3.9?
Adding a System call for Linux 3.10 x86_64
ARM Kernel-provided User Helpers
Add new system call to linux kernel…
Linux Syscall Reference for Kernel 2.6
List of Linux/i386 system calls for Kernel 2.6
man syscalls – Linux system calls


Adding Syscalls To FreeBSD
runtime: reconsider using SYSCALL instruction on FreeBSD
Reading the FreeBSD Kernel

grep -r sysenter .
grep -r sysexit .
grep -r db_inst_0f0x .
grep -r db_inst_0f .
grep -r "int 0x80" .
grep -r "syscall" .
grep -r "sys/syscall.h" .
grep -r "sy_call" .
grep -r sigtramp.S .
grep -r "NON_GPROF_ENTRY(sigcode)" .
grep -r "sigcode" .
grep -r SYS_sigreturn .
#include <sys/syscall.h>





cpu_fetch_syscall_args(struct thread *td, struct syscall_args *sa)

 * System call handler for native binaries.  The trap frame is already
 * set up by the assembler trampoline and a pointer to it is saved in
 * td_frame.
amd64_syscall(struct thread *td, int traced)

./kern/subr_syscall.c:syscallenter(struct thread *td, struct syscall_args *sa)

static inline int
syscallenter(struct thread *td, struct syscall_args *sa)
        struct proc *p;
        int error, traced;

        p = td->td_proc;
        error = (p->p_sysent->sv_fetch_syscall_args)(td, sa);

                error = syscall_thread_enter(td, sa->callp);

                AUDIT_SYSCALL_ENTER(sa->code, td);
                error = (sa->callp->sy_call)(td, sa->args);
                AUDIT_SYSCALL_EXIT(error, td);

                syscall_thread_exit(td, sa->callp);

./amd64/amd64/db_trace.c:       sy_call_t *f;
./amd64/amd64/db_trace.c:               f = p->p_sysent->sv_table[number].sy_call;


The arguments of sys_sigreturn
svn commit: r245414 – head/sys/arm/arm/locore.S



Wikipedia: INT (x86 instruction)


List of ARM microarchitectures

  • ARM9E (ARMv5TEJ => ARM926EJ-S)
  • ARM10E (ARMv5TEJ => ARM1026EJ-S)
  • ARM11 (ARMv6Z => ARM1176JZ(F)-S)
  • Cortex-M (ARMv7E-M => Cortex-M4)
  • Cortex-A 32-bit (ARMv7-A => Cortex-A17)
  • Cortex-A 64-bit (ARMv8-A => Cortex-A57)

Thumb software interrupt and breakpoint instructions > Software interrupt (SWI)
Developing software for Cortex-M3 > Supervisor Calls (SVC) => formerly SWI
ARM and Thumb Instructions > Hypervisor Call (HVC) (Virtualization Extensions)
SWI : SoftWare Interrupt
Keil: SWI Functions, run in Supervisor Mode of ARM7 and ARM9, interrupt protected
Keil: SVC Functions, run in Privileged Handler Mode of the Cortex-M core
Are ARM instructuons SWI and SVC exactly same thing?
How to use the SWI in ARM Cortex A9 for enabling the IRQ interrupt?
Which Cortex-M3 interrupts can I use for general purpose work?
Effective Use of ARM Cortex-M3 SVCall

Leave a Reply

Your email address will not be published. Required fields are marked *