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);
|
struct list_elem *tail = list_tail (&arg_list);
|
||||||
while (e != tail)
|
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);
|
e = list_next (e);
|
||||||
|
free (arg_elem);
|
||||||
free (list_entry (prev_e, struct arg_elem, elem));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If load failed, quit. */
|
/* If load failed, quit. */
|
||||||
|
|||||||
Reference in New Issue
Block a user