-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME
76 lines (64 loc) · 2.22 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Michael Salerno 108512298
Paul Campbell 108481554
This is the 60 pt OS final project.
How to test binaries:
1) make sure the binary is in the rootfs/bin/ folder
2) go into the sys/kmain.c and call the binary by using
void exec_tarfs_elf_args(const char *path, int argc, char *argv[], char *envp[])
or
void exec_tarfs_elf(const char *path)
Included binaries:
- args [arg1] [arg2] ...
This program tests that args are placed on the stack correctly
- malloc
Attempts to test the malloc
- open
It asks for a file name in tarfs and then writes out its contents
- ps
lists all of the processes running on the os
- kill
kills a process
- echo
echos text passed as arguments
Working system calls:
- fork
* Bug with using exec after forking.
- execve
- sleep
- open
- read
- write
- lseek
- close
- brk
- exit
- getpid
- getppid
- kill
- getcwd
- chdir
Other noteable features:
- fast syscall and sysretq are used
- on demand malloc
- auto growing stack
The provided Makefile:
1) builds a kernel
2) copies it into rootfs/boot/kernel/kernel
3) creates an ISO CD image with the rootfs/ contents
To boot the system in QEMU, run:
qemu-system-x86_64 -curses -cdrom $USER.iso -drive id=disk,file=$USER.img,if=none -device ahci,id=ahci
-device ide-drive,drive=disk,bus=ahci.0 -net nic -net user,hostfwd=tcp::10080-:80 -net user,
hostfwd=tcp::10023-:23 --no-reboot -gdb tcp::9998
Explanation of parameters:
-curses use a text console (omit this to use default SDL/VNC console)
-cdrom x.iso connect a CD-ROM and insert CD with x.iso disk
--no-reboot exit when guest reboots
-gdb tcp::9998 listen for "remote" debugging connections on port 9998
connect a hard drive with x.img disk:
-drive id=disk,file=$USER.img,if=none -device ahci,id=ahci -device ide-drive,drive=disk,bus=ahci.0
connect a NIC and forward local port 10080 into port 80 and local port 10023 to port 23
-net nic -net user,hostfwd=tcp::10080-:80 -net user,hostfwd=tcp::10023-:23
When using the -curses mode, switch to the qemu> console with ESC-2.
To connect a remote debugger to the running qemu VM:
gdb ./kernel
target remote localhost:9998