diff --git a/src/threads/thread.h b/src/threads/thread.h index 093bcddeb82e3c52182ff182c8c832d90f695908..f5988dacd053e53c60127da18d60d8655ebe8ca7 100644 --- a/src/threads/thread.h +++ b/src/threads/thread.h @@ -96,10 +96,16 @@ struct thread #ifdef USERPROG /* Owned by userprog/process.c. */ uint32_t *pagedir; /* Page directory. */ + uint8_t *current_esp; /* The current value of the user program’s stack pointer. + A page fault might occur in the kernel, so we might + need to store esp on transition to kernel mode*/ #endif /* Owned by thread.c. */ unsigned magic; /* Detects stack overflow. */ + /* VALUE */ + bool process_exit; + int process_exit_status; }; /* If false (default), use round-robin scheduler. diff --git a/src/userprog/process.h b/src/userprog/process.h index 6dc39e41c99c450b487be78a2352fb0f0c39881d..ee8fcf40271ae0bdd733b90d329680cb353ae6ac 100644 --- a/src/userprog/process.h +++ b/src/userprog/process.h @@ -2,6 +2,7 @@ #define USERPROG_PROCESS_H #include "threads/thread.h" +typedef int pid_t; typedef int pit_t; #define PID_ERROR ((pid_t)-1) diff --git a/src/userprog/syscall.h b/src/userprog/syscall.h index 4d30d0a80bdb162a372668138916fe1ab1658126..e672e2a04c18790f9f4f2cc808450356061792e5 100644 --- a/src/userprog/syscall.h +++ b/src/userprog/syscall.h @@ -1,5 +1,8 @@ #ifndef USERPROG_SYSCALL_H #define USERPROG_SYSCALL_H +#include "threads/thread.h" +#include <stdbool.h> +#include <stddef.h> #include "threads/thread.h" #include <stdbool.h> @@ -15,4 +18,12 @@ bool syscall_remove(const char* file_name); static int read(void *src, void *dst, size_t bytes); static int get_user (const uint8_t *uaddr); +void syscall_halt(void); +void syscall_exit(int status); +int syscall_wait(tid_t tid); +bool syscall_create(const char* file_name, unsigned initial_size); +bool syscall_remove(const char* file_name); + +static int read(void *src, void *dst, size_t bytes); + #endif /* userprog/syscall.h */