tac0S
Template Affectional Command Operating System
|
Entry point into the Nachos kernel from user programs. More...
Macros | |
#define | MAX_FILENAME_BUFFER 200 |
Functions | |
void | ExitThread (void *object) |
void | copyStringFromMachine (int from, char *to, unsigned size) |
void | copyMachineFromString (char *from, int to, unsigned size) |
void | ProcedurePutInt (int n) |
void | ProcedureGetInt (int *n) |
unsigned int | SYScreateUserThread (void *f, void *arg) |
SYScreateUserThread Syscall function that create a UserThread (and the thread) More... | |
void * | SYSWaitForChildExited (unsigned int CID) |
SYSWaitForChildExited. More... | |
void | SYSWaitForAllChildExited () |
SYSWaitForAllChildExited Call SYSWaitForChildExited on all child. | |
void | SYSExitThread (void *object) |
SYSExitThread Syscall function to exit a thread (Kill it) Function called at end of all thread if no return and/or ExitThread() More... | |
void | StartUserThread (int data) |
StartUserThread Init the NachOS thread. More... | |
int | SYSStopChild (unsigned int CID) |
UserThread::StopChild Put the thread in BLOCKED status. More... | |
int | SYSWakeUpChild (unsigned int CID) |
UserThread::WakeUpChild Put a thread in Ready status. More... | |
void | ExceptionHandler (ExceptionType which) |
ExceptionHandler Entry point into the Nachos kernel. Called when a user program is executing, and either does a syscall, or generates an addressing or arithmetic exception. More... | |
Entry point into the Nachos kernel from user programs.
Copyright (c) 1992-1993 The Regents of the University of California. All rights reserved. See copyright.h for copyright notice and limitation of liability and disclaimer of warranty provisions. syscall – The user code explicitly requests to call a procedure Entry point into the Nachos kernel from user programs. There are two kinds of things that can cause control to transfer back to here from user code:
syscall – The user code explicitly requests to call a procedure in the Nachos kernel. Right now, the only function we support is "Halt".
exceptions – The user code does something that the CPU can't handle. For instance, accessing memory that doesn't exist, arithmetic errors, etc. Interrupts (which can also cause control to transfer from user code into the Nachos kernel) are handled elsewhere.
For now, this only handles the Halt() system call. Everything else core dumps. Copyright (c) 1992-1993 The Regents of the University of California.
void copyMachineFromString | ( | char * | from, |
int | to, | ||
unsigned | size | ||
) |
copyMachineFromString Copy a string from Kernel to Mips
void copyStringFromMachine | ( | int | from, |
char * | to, | ||
unsigned | size | ||
) |
copyStringFromMachine Copy a string from MIPS to Kernel
from | : the Machine adresse where the string is |
to | : the Kernel adresse where to copy the string |
size | : the string's adresse |
void ExceptionHandler | ( | ExceptionType | which | ) |
ExceptionHandler Entry point into the Nachos kernel. Called when a user program is executing, and either does a syscall, or generates an addressing or arithmetic exception.
For system calls, the following is the calling convention:
system call code – r2 arg1 – r4 arg2 – r5 arg3 – r6 arg4 – r7
The result of the system call, if any, must be put back into r2.
And don't forget to increment the pc before returning. (Or else you'll loop making the same system call forever!
which | is the kind of exception. The list of possible exceptions are in machine.h. |
void ProcedureGetInt | ( | int * | n | ) |
ProcedurePutInt Get the int that have been written int the input stream of the SynchConsole Be carefull the absolute value of the int must be lower than 10^10-1 Negative int is supported
n | : The adress where the int will be written |
void ProcedurePutInt | ( | int | n | ) |
ProcedurePutInt Put an int in the SynchConsole current output stream Be carefull the absolute value of the int must be lower than 10^10-1 Negative int is supported
n | : The int to be printed |
void StartUserThread | ( | int | data | ) |
StartUserThread Init the NachOS thread.
data |
unsigned int SYScreateUserThread | ( | void * | f, |
void * | arg | ||
) |
SYScreateUserThread Syscall function that create a UserThread (and the thread)
f | The function where the thread will begin |
arg | the adress of the argument needed by this function |
void SYSExitThread | ( | void * | object | ) |
SYSExitThread Syscall function to exit a thread (Kill it) Function called at end of all thread if no return and/or ExitThread()
object |
int SYSStopChild | ( | unsigned int | CID | ) |
UserThread::StopChild Put the thread in BLOCKED status.
CID |
void* SYSWaitForChildExited | ( | unsigned int | CID | ) |
SYSWaitForChildExited.
CID |
int SYSWakeUpChild | ( | unsigned int | CID | ) |
UserThread::WakeUpChild Put a thread in Ready status.
CID |