diff --git a/src/userprog/process.c b/src/userprog/process.c index 9d4b3fc..b43123d 100644 --- a/src/userprog/process.c +++ b/src/userprog/process.c @@ -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);