Refactor push_to_stack helper to match style of other helper functions
This commit is contained in:
@@ -60,16 +60,9 @@ process_execute (const char *file_name)
|
||||
return tid;
|
||||
}
|
||||
|
||||
static void *
|
||||
push_to_stack (void **esp, void *data, size_t data_size)
|
||||
{
|
||||
*esp -= data_size;
|
||||
memcpy (*esp, data, data_size);
|
||||
return *esp;
|
||||
}
|
||||
|
||||
static void process_init_stack (void *file_name_, char *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
|
||||
running. */
|
||||
@@ -205,6 +198,17 @@ process_init_stack (void *file_name_, char *saveptr, void **esp,
|
||||
*(char *) *esp = 0;
|
||||
}
|
||||
|
||||
/* Helper function that pushes the first 'data_size' bytes stored in the
|
||||
address '*data' into the stack given a pointer to the stack pointer
|
||||
'**esp'. */
|
||||
static void *
|
||||
push_to_stack (void **esp, void *data, size_t data_size)
|
||||
{
|
||||
*esp -= data_size;
|
||||
memcpy (*esp, data, data_size);
|
||||
return *esp;
|
||||
}
|
||||
|
||||
/* Waits for thread TID to die and returns its exit status.
|
||||
* If it was terminated by the kernel (i.e. killed due to an exception),
|
||||
* returns -1.
|
||||
|
||||
Reference in New Issue
Block a user