DEV Community

Cover image for Xv6 code analysis
Van a performance artist
Van a performance artist

Posted on • Updated on

Xv6 code analysis

xv6 is a simple unix, but it also has syscall to fits some demands. I read some part of xv6's code to learn a simple syscall
kernel/defs.h #function in syscall
kernel/syscall.h #registed syscall
Image description
kernel/syscall.c #syscall entry
Image description
Image description
kernel/sysproc.c #function for syscall, apply what you want to do
Image description
how process in usermode use syscall? in user/user.h
Image description
or it can't link syscall with function while compiling
Image description

Image description
just by name subsitute in perl scripts
Image description
Image description
Image description
how user send the signal of syscall to kernel
set trap function linke to p
Image description
switch user trap to kernele trap

Image description

Image description
process structure
how to detect usercall

Image description

it is write in assembly code to link syscall and userfunction together.

Top comments (0)