Add a look up table from system call numbers to their handler functions, w/ E

This commit is contained in:
sBubshait
2024-11-03 22:54:03 +00:00
parent c0f85a6bcc
commit 62453ef432

View File

@@ -10,12 +10,24 @@ static void syscall_handler (struct intr_frame *);
/* A syscall_function is a function that receives up to 3 arguments, the
arguments to the functions are either ints or pointers taking up to 32 bits
in size. */
typedef uintptr_t syscall_function (uintptr_t, uintptr_t, uintptr_t);
typedef uintptr_t (*syscall_function) (uintptr_t, uintptr_t, uintptr_t);
/* System Call Functions */
static void halt (void);
static void exit (int status);
/* A struct defining a pair of a syscall_function along with its arity. */
typedef struct {
syscall_function function;
int arity;
} syscall_arguments;
/* A look-up table for system call functions mapped using their numbers. */
static const syscall_arguments syscall_lookup[] = {
[SYS_HALT] = {(syscall_function) halt, 0},
[SYS_EXIT] = {(syscall_function) exit, 1},
};
void
syscall_init (void)
{