2#include "../syscall-nr.h"
6#define syscall0(NUMBER) \
10 ("pushl %[number]; int $0x30; addl $4, %%esp" \
12 : [number] "i" (NUMBER) \
19#define syscall1(NUMBER, ARG0) \
23 ("pushl %[arg0]; pushl %[number]; int $0x30; addl $8, %%esp" \
25 : [number] "i" (NUMBER), \
33#define syscall2(NUMBER, ARG0, ARG1) \
37 ("pushl %[arg1]; pushl %[arg0]; " \
38 "pushl %[number]; int $0x30; addl $12, %%esp" \
40 : [number] "i" (NUMBER), \
49#define syscall3(NUMBER, ARG0, ARG1, ARG2) \
53 ("pushl %[arg2]; pushl %[arg1]; pushl %[arg0]; " \
54 "pushl %[number]; int $0x30; addl $16, %%esp" \
56 : [number] "i" (NUMBER), \
127seek (
int fd,
unsigned position)
#define NOT_REACHED()
lib/debug.h
bool readdir(int fd, char name[READDIR_MAX_LEN+1])
bool chdir(const char *dir)
Project 4 only.
#define syscall1(NUMBER, ARG0)
Invokes syscall NUMBER, passing argument ARG0, and returns the return value as an ‘int’.
mapid_t mmap(int fd, void *addr)
Project 3 and optionally project 4.
bool create(const char *file, unsigned initial_size)
#define syscall3(NUMBER, ARG0, ARG1, ARG2)
Invokes syscall NUMBER, passing arguments ARG0, ARG1, and ARG2, and returns the return value as an ‘i...
int open(const char *file)
bool remove(const char *file)
int write(int fd, const void *buffer, unsigned size)
int inumber(int fd)
lib/user/syscall.h
void seek(int fd, unsigned position)
pid_t exec(const char *file)
int read(int fd, void *buffer, unsigned size)
bool mkdir(const char *dir)
void halt(void)
Projects 2 and later.
#define syscall2(NUMBER, ARG0, ARG1)
Invokes syscall NUMBER, passing arguments ARG0 and ARG1, and returns the return value as an ‘int’.
#define syscall0(NUMBER)
Invokes syscall NUMBER, passing no arguments, and returns the return value as an ‘int’.
void munmap(mapid_t mapid)
int pid_t
Process identifier.
#define READDIR_MAX_LEN
Maximum characters in a filename written by readdir().
int mapid_t
Map region identifier.
@ SYS_MMAP
Map a file into memory.
@ SYS_WRITE
Write to a file.
@ SYS_TELL
Report current position in a file.
@ SYS_HALT
Halt the operating system.
@ SYS_READ
Read from a file.
@ SYS_CREATE
Create a file.
@ SYS_INUMBER
Returns the inode number for a fd.
@ SYS_EXEC
Start another process.
@ SYS_MUNMAP
Remove a memory mapping.
@ SYS_EXIT
Terminate this process.
@ SYS_ISDIR
Tests if a fd represents a directory.
@ SYS_FILESIZE
Obtain a file's size.
@ SYS_WAIT
Wait for a child process to die.
@ SYS_MKDIR
Create a directory.
@ SYS_CHDIR
Change the current directory.
@ SYS_READDIR
Reads a directory entry.
@ SYS_REMOVE
Delete a file.
@ SYS_SEEK
Change position in a file.