DEV Community

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

Posted on • Edited on

1

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.

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay