Add support for some basic system calls and args handling correctly. #29

Merged
sb3923 merged 49 commits from system-calls into master 2024-11-07 19:36:30 +00:00
2 changed files with 92 additions and 21 deletions
Showing only changes of commit 92c681ff02 - Show all commits

View File

@@ -83,16 +83,16 @@ start_process (void *file_name_)
command line input must fit in a page. Also keep track command line input must fit in a page. Also keep track
of pointers to the argument data within a linked list. */ of pointers to the argument data within a linked list. */
struct list arg_list; struct list arg_list;
list_init(&arg_list); list_init (&arg_list);
unsigned int arg_count = 1; unsigned int arg_count = 1;
while (arg != NULL) while (arg != NULL)
{ {
size_t arg_size = (strlen(arg) + 1) * sizeof (char); size_t arg_size = (strlen (arg) + 1) * sizeof (char);
if_.esp -= arg_size; if_.esp -= arg_size;
memcpy (if_.esp, arg, arg_size); memcpy (if_.esp, arg, arg_size);
struct arg_elem *arg_elem = malloc(sizeof (struct arg_elem)); struct arg_elem *arg_elem = malloc (sizeof (struct arg_elem));
ASSERT (arg_elem != NULL); ASSERT (arg_elem != NULL);
arg_elem->arg = arg; arg_elem->arg = arg;
list_push_front (&arg_list, &arg_elem->elem); list_push_front (&arg_list, &arg_elem->elem);