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:
	li a7, SYS_sleep
	ecall
	ret
#include "user/user.h"
int main(int argc, char* argv[]){
	if (argc !=2){
		fprintf(2,"wrong # args");
		exit(1);
	}
	sleep(atoi(argv[1]));
	exit(0);
}