nachos assignment#1 system calls implementation. what are system calls? enable you to interact with...

Post on 12-Jan-2016

212 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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 userle

vel 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

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”

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 he

re.

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.

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.

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)

Implementation example: void Create(char* filename)

Crates a file with the name”filename” given as the parameter.

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

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.

Compiling step Add the file in the “MakefileMakefile” under “

build.linux” Add the test file in the “Makefile” under

“nachos/code/test”. Complile test file under “test”,others un

der “nachos/code/build.linux”

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.

Project Deadline 4/30 24:00 E-mail your project to r91050@im.ntu.edu.tw Use student id as file name.(one of th

e two group member) Ex:R91725050

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.

top related