Update start_process to push pointers to process arguments onto the process thread's stack
This commit is contained in:
@@ -123,12 +123,13 @@ start_process (void *file_name_)
|
||||
struct list_elem *tail = list_tail (&arg_list);
|
||||
while (e != tail)
|
||||
{
|
||||
/* TODO: Push argument pointers to process stack. */
|
||||
struct arg_elem *arg_elem = list_entry (e, struct arg_elem, elem);
|
||||
|
||||
if_.esp -= sizeof (char *);
|
||||
memcpy (if_.esp, arg_elem->arg, sizeof (char *));
|
||||
|
||||
struct list_elem *prev_e = e;
|
||||
e = list_next (e);
|
||||
|
||||
free (list_entry (prev_e, struct arg_elem, elem));
|
||||
free (arg_elem);
|
||||
}
|
||||
|
||||
/* If load failed, quit. */
|
||||
|
||||
Reference in New Issue
Block a user