Download presentation
Presentation is loading. Please wait.
Published byDamian Booth Modified over 9 years ago
1
Nachos Assignment#1 System calls implementation
2
What are system calls? Enable you to interact with OS kernel. A switch from User Mode to Kernel Mode
3
How does it work?(1)
4
How does it work?(2)
5
How does it work?(3)
6
test/start.s MIPS dependend assembler code for userlevel bindings Do not modify! How does it work: gets parameter via registers (C-calling convention) loads syscall number into first register does a syscall exception (enter the kernel) jump back
7
What are you going to do? Implement following system calls. Create : Create a file with the “filename” Open : Open a file with the “filename” Read : Read from the file or console Write : Write to the file or console Close : Close the opened file with the”fid”
8
Related Nachos codes (1) syscall.h Definitions of the system call prototypes You have to implement it. exception.cc The handler for system calls and other exceptions is here.
9
Related Nachos codes (2) test/start.s Assembly startup code of every user program of nachos. To see how a user program does a system call and enters the kernel.
10
What are Stubs for ?(1) Each system call has a stub associated with it. Assembly codes used to : assist user programs to understand system calls. Make system calls to kernels.
11
What are Stubs for ?(2) Register r2 stores the system call number. Other arguments in r4,r5,r6,r7,respectly. New system call need a new stub to be added in “start.s”. (No need to do it in this project)
12
Implementation example: void Create(char* filename) Crates a file with the name”filename” given as the parameter.
14
Implementation example: Add your code in exception.cc. ReadRegister -> machine.cc To get the starting virtual address. ReadMem -> translate.cc Translate virtual address to real address
15
Setup your tool On your PC Get the tar ball from our site and untar it under “/”. Go to [Install Dir]/NachOS-4.0/coff2noff/ compile it with makefile. On IM workstation Go to [Install Dir]/NachOS-4.0/coff2noff/ compile it with makefile.
16
Compiling step Makefile Add the file in the “Makefile” under “build.linux” Add the test file in the “Makefile” under “nachos/code/test”. Complile test file under “test”,others under “nachos/code/build.linux”
17
Project grading policy Primary requirement System call implementation :70% Documentation :15% How to verify your work?:15% Demo: About 5 groups will be chosen to demo.
18
Project Deadline 4/30 24:00 E-mail your project to r91050@im.ntu.edu.tw Use student id as file name.(one of the two group member) Ex:R91725050
19
Your files SHOULD include: Modified files and test files 5 page-report Do not put source code in your report. Explain why you chose to modify these files. Problems encountered and your solution Anything else.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.