Merge basic system calls with stack set-up infrastructure #27

Merged
td1223 merged 31 commits from user-programs into user-programs-stdout 2024-11-06 22:21:28 +00:00
5 changed files with 228 additions and 125 deletions
Showing only changes of commit 5aac37d167 - Show all commits

View File

@@ -14,6 +14,7 @@
#include "threads/flags.h" #include "threads/flags.h"
#include "threads/init.h" #include "threads/init.h"
#include "threads/interrupt.h" #include "threads/interrupt.h"
#include "threads/synch.h"
#include "threads/palloc.h" #include "threads/palloc.h"
#include "threads/thread.h" #include "threads/thread.h"
#include "threads/vaddr.h" #include "threads/vaddr.h"
@@ -88,7 +89,8 @@ start_process (void *file_name_)
int int
process_wait (tid_t child_tid UNUSED) process_wait (tid_t child_tid UNUSED)
{ {
return -1; for (;;)
barrier ();
} }
/* Free the current process's resources. */ /* Free the current process's resources. */
@@ -451,7 +453,7 @@ setup_stack (void **esp)
{ {
success = install_page (((uint8_t *) PHYS_BASE) - PGSIZE, kpage, true); success = install_page (((uint8_t *) PHYS_BASE) - PGSIZE, kpage, true);
if (success) if (success)
*esp = PHYS_BASE; *esp = PHYS_BASE - 12;
else else
palloc_free_page (kpage); palloc_free_page (kpage);
} }