[zion] Move capability validation to capability.h

This commit is contained in:
Drew Galbraith 2023-06-20 15:50:49 -07:00
parent 93cf8f2740
commit 172bf51db7
8 changed files with 42 additions and 47 deletions

View file

@ -1,8 +1,8 @@
#include "syscall/process.h"
#include "capability/capability.h"
#include "scheduler/process_manager.h"
#include "scheduler/scheduler.h"
#include "syscall/syscall.h"
z_err_t ProcessExit(ZProcessExitReq* req) {
auto curr_thread = gScheduler->CurrentThread();
@ -16,7 +16,7 @@ z_err_t ProcessExit(ZProcessExitReq* req) {
z_err_t ProcessSpawn(ZProcessSpawnReq* req) {
auto& curr_proc = gScheduler->CurrentProcess();
auto cap = curr_proc.GetCapability(req->proc_cap);
RET_ERR(ValidateCap(cap, ZC_PROC_SPAWN_PROC));
RET_ERR(ValidateCapability<Process>(cap, ZC_PROC_SPAWN_PROC));
RefPtr<Process> proc = Process::Create();
gProcMan->InsertProcess(proc);