Refactor function names and includes in syscall.c to avoid conflicts w/ S.
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
#include "userprog/syscall.h"
|
#include "userprog/syscall.h"
|
||||||
#include "devices/shutdown.h"
|
#include "devices/shutdown.h"
|
||||||
#include "threads/vaddr.h"
|
#include "threads/vaddr.h"
|
||||||
#include <stdio.h>
|
|
||||||
#include <syscall-nr.h>
|
|
||||||
#include "threads/interrupt.h"
|
#include "threads/interrupt.h"
|
||||||
#include "threads/thread.h"
|
#include "threads/thread.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <syscall-nr.h>
|
||||||
|
|
||||||
static void syscall_handler (struct intr_frame *);
|
static void syscall_handler (struct intr_frame *);
|
||||||
|
|
||||||
@@ -14,19 +14,19 @@ static void syscall_handler (struct intr_frame *);
|
|||||||
typedef uintptr_t (*syscall_function) (uintptr_t, uintptr_t, uintptr_t);
|
typedef uintptr_t (*syscall_function) (uintptr_t, uintptr_t, uintptr_t);
|
||||||
|
|
||||||
/* System call function prototypes */
|
/* System call function prototypes */
|
||||||
static void halt (void);
|
static void syscall_halt (void);
|
||||||
static void exit (int status);
|
static void syscall_exit (int status);
|
||||||
static pid_t exec (const char *cmd_line);
|
static pid_t syscall_exec (const char *cmd_line);
|
||||||
static int wait (pid_t pid);
|
static int syscall_wait (pid_t pid);
|
||||||
static bool file_create (const char *file, unsigned initial_size);
|
static bool syscall_create (const char *file, unsigned initial_size);
|
||||||
static bool file_remove (const char *file);
|
static bool syscall_remove (const char *file);
|
||||||
static int open (const char *file);
|
static int syscall_open (const char *file);
|
||||||
static int filesize (int fd);
|
static int syscall_filesize (int fd);
|
||||||
static int read (int fd, void *buffer, unsigned size);
|
static int syscall_read (int fd, void *buffer, unsigned size);
|
||||||
static int write (int fd, const void *buffer, unsigned size);
|
static int syscall_write (int fd, const void *buffer, unsigned size);
|
||||||
static void seek (int fd, unsigned position);
|
static void syscall_seek (int fd, unsigned position);
|
||||||
static unsigned tell (int fd);
|
static unsigned syscall_tell (int fd);
|
||||||
static void close (int fd);
|
static void syscall_close (int fd);
|
||||||
|
|
||||||
static void *validate_user_pointer (void *ptr, size_t size);
|
static void *validate_user_pointer (void *ptr, size_t size);
|
||||||
|
|
||||||
@@ -41,19 +41,19 @@ typedef struct
|
|||||||
arguments. */
|
arguments. */
|
||||||
static const syscall_arguments syscall_lookup[] =
|
static const syscall_arguments syscall_lookup[] =
|
||||||
{
|
{
|
||||||
[SYS_HALT] = {(syscall_function) halt, 0},
|
[SYS_HALT] = {(syscall_function) syscall_halt, 0},
|
||||||
[SYS_EXIT] = {(syscall_function) exit, 1},
|
[SYS_EXIT] = {(syscall_function) syscall_exit, 1},
|
||||||
[SYS_EXEC] = {(syscall_function) exec, 1},
|
[SYS_EXEC] = {(syscall_function) syscall_exec, 1},
|
||||||
[SYS_WAIT] = {(syscall_function) wait, 1},
|
[SYS_WAIT] = {(syscall_function) syscall_wait, 1},
|
||||||
[SYS_CREATE] = {(syscall_function) file_create, 2},
|
[SYS_CREATE] = {(syscall_function) syscall_create, 2},
|
||||||
[SYS_REMOVE] = {(syscall_function) file_remove, 1},
|
[SYS_REMOVE] = {(syscall_function) syscall_remove, 1},
|
||||||
[SYS_OPEN] = {(syscall_function) open, 1},
|
[SYS_OPEN] = {(syscall_function) syscall_open, 1},
|
||||||
[SYS_FILESIZE] = {(syscall_function) filesize, 1},
|
[SYS_FILESIZE] = {(syscall_function) syscall_filesize, 1},
|
||||||
[SYS_READ] = {(syscall_function) read, 3},
|
[SYS_READ] = {(syscall_function) syscall_read, 3},
|
||||||
[SYS_WRITE] = {(syscall_function) write, 3},
|
[SYS_WRITE] = {(syscall_function) syscall_write, 3},
|
||||||
[SYS_SEEK] = {(syscall_function) seek, 2},
|
[SYS_SEEK] = {(syscall_function) syscall_seek, 2},
|
||||||
[SYS_TELL] = {(syscall_function) tell, 1},
|
[SYS_TELL] = {(syscall_function) syscall_tell, 1},
|
||||||
[SYS_CLOSE] = {(syscall_function) close, 1},
|
[SYS_CLOSE] = {(syscall_function) syscall_close, 1},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The number of syscall functions (i.e, number of elements) within the
|
/* The number of syscall functions (i.e, number of elements) within the
|
||||||
@@ -93,13 +93,13 @@ syscall_handler (struct intr_frame *f)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
halt (void)
|
syscall_halt (void)
|
||||||
{
|
{
|
||||||
shutdown_power_off ();
|
shutdown_power_off ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
exit (int status)
|
syscall_exit (int status)
|
||||||
{
|
{
|
||||||
/* Sets exit_status of the thread to status. thread_exit () will call
|
/* Sets exit_status of the thread to status. thread_exit () will call
|
||||||
process_exit () if user programs are allowed. */
|
process_exit () if user programs are allowed. */
|
||||||
@@ -108,76 +108,76 @@ exit (int status)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static pid_t
|
static pid_t
|
||||||
exec (const char *cmd_line UNUSED)
|
syscall_exec (const char *cmd_line UNUSED)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
wait (pid_t pid UNUSED)
|
syscall_wait (pid_t pid UNUSED)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
file_create (const char *file UNUSED, unsigned initial_size UNUSED)
|
syscall_create (const char *file UNUSED, unsigned initial_size UNUSED)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
file_remove (const char *file UNUSED)
|
syscall_remove (const char *file UNUSED)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
open (const char *file UNUSED)
|
syscall_open (const char *file UNUSED)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
filesize (int fd UNUSED)
|
syscall_filesize (int fd UNUSED)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
read (int fd UNUSED, void *buffer UNUSED, unsigned size UNUSED)
|
syscall_read (int fd UNUSED, void *buffer UNUSED, unsigned size UNUSED)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
write (int fd UNUSED, const void *buffer UNUSED, unsigned size UNUSED)
|
syscall_write (int fd UNUSED, const void *buffer UNUSED, unsigned size UNUSED)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
seek (int fd UNUSED, unsigned position UNUSED)
|
syscall_seek (int fd UNUSED, unsigned position UNUSED)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
tell (int fd UNUSED)
|
syscall_tell (int fd UNUSED)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
close (int fd UNUSED)
|
syscall_close (int fd UNUSED)
|
||||||
{
|
{
|
||||||
//TODO
|
//TODO
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user