Kernel: Add SYS_EXEC syscall
This commit is contained in:
@@ -112,6 +112,14 @@ namespace Kernel
|
||||
return 0;
|
||||
}
|
||||
|
||||
long sys_exec(const char* pathname, const char* const* argv, const char* const* envp)
|
||||
{
|
||||
auto ret = Process::current().exec(pathname, argv, envp);
|
||||
if (ret.is_error())
|
||||
return -ret.error().get_error_code();
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
extern "C" long sys_fork_trampoline();
|
||||
|
||||
extern "C" long cpp_syscall_handler(int syscall, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5)
|
||||
@@ -171,6 +179,9 @@ namespace Kernel
|
||||
case SYS_SLEEP:
|
||||
ret = sys_sleep((unsigned int)arg1);
|
||||
break;
|
||||
case SYS_EXEC:
|
||||
ret = sys_exec((const char*)arg1, (const char* const*)arg2, (const char* const*)arg3);
|
||||
break;
|
||||
default:
|
||||
Kernel::panic("Unknown syscall {}", syscall);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user