|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnachos.kernel.userprog.Syscall
public class Syscall
Nachos system call interface. These are Nachos kernel operations that can be invoked from user programs, by trapping to the kernel via the "syscall" instruction.
Field Summary | |
---|---|
static int |
ConsoleInput
OpenFileId used for input from the keyboard. |
static int |
ConsoleOutput
OpenFileId used for output to the display. |
static byte |
SC_Close
Integer code identifying the "Close" system call. |
static byte |
SC_Create
Integer code identifying the "Create" system call. |
static byte |
SC_Exec
Integer code identifying the "Exec" system call. |
static byte |
SC_Exit
Integer code identifying the "Exit" system call. |
static byte |
SC_Fork
Integer code identifying the "Fork" system call. |
static byte |
SC_Halt
Integer code identifying the "Halt" system call. |
static byte |
SC_Join
Integer code identifying the "Join" system call. |
static byte |
SC_Open
Integer code identifying the "Open" system call. |
static byte |
SC_Read
Integer code identifying the "Read" system call. |
static byte |
SC_Remove
Integer code identifying the "Remove" system call. |
static byte |
SC_Write
Integer code identifying the "Write" system call. |
static byte |
SC_Yield
Integer code identifying the "Yield" system call. |
Constructor Summary | |
---|---|
Syscall()
|
Method Summary | |
---|---|
static void |
close(int id)
Close the file, we're done reading and writing to it. |
static void |
create(java.lang.String name)
Create a Nachos file with a specified name. |
static int |
exec(java.lang.String name)
Run the executable, stored in the Nachos file "name", and return the address space identifier. |
static void |
exit(int status)
This user program is done. |
static void |
fork(int func)
Fork a thread to run a procedure ("func") in the *same* address space as the current thread. |
static void |
halt()
Stop Nachos, and print out performance stats. |
static int |
join(int id)
Wait for the user program specified by "id" to finish, and return its exit status. |
static int |
open(java.lang.String name)
Open the Nachos file "name", and return an "OpenFileId" that can be used to read and write to the file. |
static int |
read(byte[] buffer,
int size,
int id)
Read "size" bytes from the open file into "buffer". |
static void |
remove(java.lang.String name)
Remove a Nachos file. |
static void |
write(byte[] buffer,
int size,
int id)
Write "size" bytes from "buffer" to the open file. |
static void |
yield()
Yield the CPU to another runnable thread, whether in this address space or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final byte SC_Halt
public static final byte SC_Exit
public static final byte SC_Exec
public static final byte SC_Join
public static final byte SC_Create
public static final byte SC_Open
public static final byte SC_Read
public static final byte SC_Write
public static final byte SC_Close
public static final byte SC_Fork
public static final byte SC_Yield
public static final byte SC_Remove
public static final int ConsoleInput
public static final int ConsoleOutput
Constructor Detail |
---|
public Syscall()
Method Detail |
---|
public static void halt()
public static void exit(int status)
status
- Status code to pass to processes doing a Join().
status = 0 means the program exited normally.public static int exec(java.lang.String name)
name
- The name of the file to execute.public static int join(int id)
id
- The "space ID" of the program to wait for.
public static void create(java.lang.String name)
name
- The name of the file to be created.public static void remove(java.lang.String name)
name
- The name of the file to be removed.public static int open(java.lang.String name)
name
- The name of the file to open.
public static void write(byte[] buffer, int size, int id)
buffer
- Location of the data to be written.size
- The number of bytes to write.id
- The OpenFileId of the file to which to write the data.public static int read(byte[] buffer, int size, int id)
buffer
- Where to put the data read.size
- The number of bytes requested.id
- The OpenFileId of the file from which to read the data.
public static void close(int id)
id
- The OpenFileId of the file to be closed.public static void fork(int func)
func
- The user address of the procedure to be run by the
new thread.public static void yield()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |