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 134 additions and 104 deletions
Showing only changes of commit 795d81b7ad - Show all commits

View File

@@ -64,7 +64,7 @@ process_execute (const char *cmd)
return tid;
}
static bool process_init_stack (char *saveptr, void **esp, char *file_name);
static bool process_init_stack (char *cmd_saveptr, void **esp, char *file_name);
static void *push_to_stack (void **esp, void *data, size_t data_size);
/* A thread function that loads a user process and starts it
@@ -125,7 +125,7 @@ start_process (void *cmd)
/* Helper function that initializes the stack of a newly created
user process. Returns true if successful, false otherwise. */
static bool
process_init_stack (char *saveptr, void **esp, char *file_name)
process_init_stack (char *cmd_saveptr, void **esp, char *file_name)
{
/* Load command line argument *data* to user process stack.
This can't cause overflow due to enforcing that the size of
@@ -152,7 +152,7 @@ process_init_stack (char *saveptr, void **esp, char *file_name)
list_push_front (&arg_list, &arg_elem->elem);
arg_count++;
arg = strtok_r (NULL, " ", &saveptr);
arg = strtok_r (NULL, " ", &cmd_saveptr);
}
/* Calculate the remaining number of bytes that need to be written