1 / 19

Nachos Assignment#1

Nachos Assignment#1. System calls implementation. What are system calls?. Enable you to interact with OS kernel. A switch from User Mode to Kernel Mode. How does it work?(1). How does it work?(2). How does it work?(3). test/start.s. MIPS dependend assembler code for userlevel bindings

alisac
Télécharger la présentation

Nachos Assignment#1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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.

  13. 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

  14. 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.

  15. Compiling step • 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”

  16. 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.

  17. 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

  18. 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.

More Related