Implement complete stack initialization, process_wait, and all system calls correctly except exec #34

Merged
td1223 merged 46 commits from userprog-merge into master 2024-11-11 22:56:29 +00:00
4 changed files with 65 additions and 10 deletions
Showing only changes of commit 5bd94894e0 - Show all commits

View File

@@ -1,5 +1,6 @@
#include "threads/thread.h" #include "threads/thread.h"
#include <debug.h> #include <debug.h>
#include <hash.h>
#include <stddef.h> #include <stddef.h>
#include <random.h> #include <random.h>
#include <stdio.h> #include <stdio.h>
@@ -15,6 +16,7 @@
#include "threads/vaddr.h" #include "threads/vaddr.h"
#ifdef USERPROG #ifdef USERPROG
#include "userprog/process.h" #include "userprog/process.h"
#include "userprog/syscall.h"
#endif #endif
/* Random value for struct thread's `magic' member. /* Random value for struct thread's `magic' member.
@@ -660,6 +662,7 @@ init_thread (struct thread *t, const char *name, int nice, int priority,
t->priority = t->base_priority; t->priority = t->base_priority;
t->exit_status = -1; t->exit_status = -1;
hash_init (&t->open_files, fd_hash, fd_less, NULL);
old_level = intr_disable (); old_level = intr_disable ();
list_push_back (&all_list, &t->allelem); list_push_back (&all_list, &t->allelem);

View File

@@ -2,6 +2,7 @@
#define THREADS_THREAD_H #define THREADS_THREAD_H
#include <debug.h> #include <debug.h>
#include <hash.h>
#include <list.h> #include <list.h>
#include <stdint.h> #include <stdint.h>
#include "threads/fixed-point.h" #include "threads/fixed-point.h"
@@ -116,6 +117,7 @@ struct thread
#ifdef USERPROG #ifdef USERPROG
/* Owned by userprog/process.c. */ /* Owned by userprog/process.c. */
uint32_t *pagedir; /* Page directory. */ uint32_t *pagedir; /* Page directory. */
struct hash open_files; /* Hash Table of FD -> Struct File */
#endif #endif
/* Owned by thread.c. */ /* Owned by thread.c. */