xv6
Posted on July 2, 2014
Tags: operatingsys
1 Resources
the xv6-public version is much easier to learn from. https://github.com/mit-pdos/xv6-public
Some github notes associated with it https://github.com/palladian1/xv6-annotated/blob/main/boot.md
2 Summary
graph TD;
A["BIOS"];
B["GRUB Bootloader"];
A-- "First 512mb" -->B;
3 Start
struct stat;
struct rtcdate;
// system calls
int fork(void);
int exit(int) __attribute__((noreturn));
int wait(int*);
int pipe(int*);
....
int sleep(int);
int uptime(void);
#include "kernel/syscall.h"
.global sleep
sleep:
, SYS_sleep
li a7
ecall ret
#include "user/user.h"
int main(int argc, char* argv[]){
if (argc !=2){
(2,"wrong # args");
fprintf(1);
exit}
(atoi(argv[1]));
sleep(0);
exit}
- bleh.c imports user.h
- user.h contains
int sleep(int);
int sleep(int)
is linked to it’s implementation with Makefile linker andusys.S
usys.S
implementssleep
by calling systemcallSYS_sleep
- user.h contains