Reformat calculation of padding size in stack set-up to increase clarity
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#include <debug.h>
|
||||
#include <inttypes.h>
|
||||
#include <round.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -116,7 +117,7 @@ start_process (void *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) if_.esp % 4;
|
||||
size_t align_size = ((unsigned int) if_.esp % 4) * 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);
|
||||
@@ -133,7 +134,7 @@ start_process (void *file_name_)
|
||||
|
||||
/* Align stack pointer to word size before pushing argv elements for
|
||||
performance. */
|
||||
if_.esp -= align_size * sizeof (uint8_t);
|
||||
if_.esp -= align_size;
|
||||
|
||||
/* Push a null pointer sentinel inside argv. */
|
||||
if_.esp -= sizeof (char *);
|
||||
|
||||
Reference in New Issue
Block a user