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 f0dae74cf3 - Show all commits

View File

@@ -22,6 +22,10 @@
#include "threads/synch.h"
#include "devices/timer.h"
/* Defines the native number of bytes processed by the processor
(for the purposes of alignment). */
#define WORD_SIZE 4
/* Keeps track of the position of pointers to user program arguments
within a linked list. */
struct arg_elem
@@ -153,7 +157,7 @@ process_init_stack (char *saveptr, void **esp, char *file_name)
/* Calculate the remaining number of bytes that need to be written
to the user process stack in order to check for possible overflow. */
size_t align_size = ((unsigned int) *esp % 4) * sizeof (uint8_t);
size_t align_size = ((unsigned int) *esp % WORD_SIZE) * sizeof (uint8_t);
size_t argv_data_size = (arg_count + 1) * sizeof (char *);
size_t argv_size = sizeof (char **);
size_t argc_size = sizeof (int);