pintos/src/lib/user/syscall.c File Reference

#include <syscall.h>
#include "../syscall-nr.h"

Go to the source code of this file.

Defines

#define syscall0(NUMBER)
#define syscall1(NUMBER, ARG0)
#define syscall2(NUMBER, ARG0, ARG1)
#define syscall3(NUMBER, ARG0, ARG1, ARG2)

Functions

void halt (void)
void exit (int status)
pid_t exec (const char *file)
int wait (pid_t pid)
bool create (const char *file, unsigned initial_size)
bool remove (const char *file)
int open (const char *file)
int filesize (int fd)
int read (int fd, void *buffer, unsigned size)
int write (int fd, const void *buffer, unsigned size)
void seek (int fd, unsigned position)
unsigned tell (int fd)
void close (int fd)
mapid_t mmap (int fd, void *addr)
void munmap (mapid_t mapid)
bool chdir (const char *dir)
bool mkdir (const char *dir)
bool readdir (int fd, char name[READDIR_MAX_LEN+1])
bool isdir (int fd)
int inumber (int fd)


Define Documentation

#define syscall0 ( NUMBER   ) 

Value:

({                                                      \
          int retval;                                           \
          asm volatile                                          \
            ("pushl %[number]; int $0x30; addl $4, %%esp"       \
               : "=a" (retval)                                  \
               : [number] "i" (NUMBER)                          \
               : "memory");                                     \
          retval;                                               \
        })

Definition at line 6 of file syscall.c.

Referenced by halt().

#define syscall1 ( NUMBER,
ARG0   ) 

Value:

({                                                               \
          int retval;                                                    \
          asm volatile                                                   \
            ("pushl %[arg0]; pushl %[number]; int $0x30; addl $8, %%esp" \
               : "=a" (retval)                                           \
               : [number] "i" (NUMBER),                                  \
                 [arg0] "g" (ARG0)                                       \
               : "memory");                                              \
          retval;                                                        \
        })

Definition at line 19 of file syscall.c.

Referenced by chdir(), close(), exec(), exit(), filesize(), inumber(), isdir(), mkdir(), munmap(), open(), remove(), tell(), and wait().

#define syscall2 ( NUMBER,
ARG0,
ARG1   ) 

Value:

({                                                      \
          int retval;                                           \
          asm volatile                                          \
            ("pushl %[arg1]; pushl %[arg0]; "                   \
             "pushl %[number]; int $0x30; addl $12, %%esp"      \
               : "=a" (retval)                                  \
               : [number] "i" (NUMBER),                         \
                 [arg0] "g" (ARG0),                             \
                 [arg1] "g" (ARG1)                              \
               : "memory");                                     \
          retval;                                               \
        })

Definition at line 33 of file syscall.c.

Referenced by create(), mmap(), readdir(), and seek().

#define syscall3 ( NUMBER,
ARG0,
ARG1,
ARG2   ) 

Value:

({                                                      \
          int retval;                                           \
          asm volatile                                          \
            ("pushl %[arg2]; pushl %[arg1]; pushl %[arg0]; "    \
             "pushl %[number]; int $0x30; addl $16, %%esp"      \
               : "=a" (retval)                                  \
               : [number] "i" (NUMBER),                         \
                 [arg0] "g" (ARG0),                             \
                 [arg1] "g" (ARG1),                             \
                 [arg2] "g" (ARG2)                              \
               : "memory");                                     \
          retval;                                               \
        })

Definition at line 49 of file syscall.c.

Referenced by read(), and write().


Function Documentation

bool chdir ( const char *  dir  ) 

Definition at line 157 of file syscall.c.

References SYS_CHDIR, and syscall1.

Referenced by main(), and test_main().

void close ( int  fd  ) 

bool create ( const char *  file,
unsigned  initial_size 
)

Definition at line 91 of file syscall.c.

References SYS_CREATE, and syscall2.

Referenced by do_touch(), main(), make_tar_archive(), seq_test(), sort_chunks(), and test_main().

pid_t exec ( const char *  file  ) 

Definition at line 79 of file syscall.c.

References SYS_EXEC, and syscall1.

Referenced by exec_children(), main(), sort_chunks(), spawn_child(), and test_main().

void exit ( int  status  ) 

int filesize ( int  fd  ) 

Definition at line 109 of file syscall.c.

References SYS_FILESIZE, and syscall1.

Referenced by archive_ordinary_file(), check_file_handle(), check_file_size(), list_dir(), and main().

void halt ( void   ) 

Definition at line 65 of file syscall.c.

References NOT_REACHED, SYS_HALT, and syscall0.

Referenced by main(), and test_main().

int inumber ( int  fd  ) 

Definition at line 181 of file syscall.c.

References SYS_INUMBER, and syscall1.

Referenced by archive_file(), get_inumber(), getcwd(), list_dir(), and test_main().

bool isdir ( int  fd  ) 

Definition at line 175 of file syscall.c.

References SYS_ISDIR, and syscall1.

Referenced by archive_file(), and list_dir().

bool mkdir ( const char *  dir  ) 

Definition at line 163 of file syscall.c.

References SYS_MKDIR, and syscall1.

Referenced by do_mkdir(), main(), and test_main().

mapid_t mmap ( int  fd,
void *  addr 
)

Definition at line 145 of file syscall.c.

References SYS_MMAP, and syscall2.

Referenced by main(), and test_main().

void munmap ( mapid_t  mapid  ) 

Definition at line 151 of file syscall.c.

References SYS_MUNMAP, and syscall1.

Referenced by main(), and test_main().

int open ( const char *  file  ) 

int read ( int  fd,
void *  buffer,
unsigned  size 
)

Definition at line 115 of file syscall.c.

References SYS_READ, and syscall3.

Referenced by archive_ordinary_file(), check_file_handle(), main(), read_line(), relay(), sort_chunks(), and test_main().

bool readdir ( int  fd,
char  name[READDIR_MAX_LEN+1] 
)

Definition at line 169 of file syscall.c.

References name, SYS_READDIR, and syscall2.

Referenced by archive_directory(), getcwd(), list_dir(), and test_main().

bool remove ( const char *  file  ) 

Definition at line 97 of file syscall.c.

References SYS_REMOVE, and syscall1.

void seek ( int  fd,
unsigned  position 
)

Definition at line 127 of file syscall.c.

References SYS_SEEK, and syscall2.

Referenced by main(), and test_main().

unsigned tell ( int  fd  ) 

Definition at line 133 of file syscall.c.

References SYS_TELL, and syscall1.

Referenced by check_tell(), and main().

int wait ( pid_t  pid  ) 

Definition at line 85 of file syscall.c.

References SYS_WAIT, and syscall1.

int write ( int  fd,
const void *  buffer,
unsigned  size 
)


Generated on Mon Jan 10 16:43:58 2011 for Pintos by  doxygen 1.5.6