From d95894085b0b0d9305561fde7510df262ea21102 Mon Sep 17 00:00:00 2001 From: Gleb Koval Date: Fri, 8 Nov 2024 09:15:22 +0000 Subject: [PATCH] Implement syscall_exec via process_execute --- src/userprog/syscall.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/userprog/syscall.c b/src/userprog/syscall.c index 1dbe73b..03e0721 100644 --- a/src/userprog/syscall.c +++ b/src/userprog/syscall.c @@ -110,10 +110,14 @@ syscall_exit (int status) } static pid_t -syscall_exec (const char *cmd_line UNUSED) +syscall_exec (const char *cmd_line) { - //TODO - return 0; + /* To check the end we would need to traverse the null-terminate string, + which is equally unsafe as just leaving process_execute to do it. */ + cmd_line = validate_user_pointer (cmd_line, 1); + if (cmd_line == NULL) + thread_exit (); + process_execute (cmd_line); } static int