[Zion] Add the ability to delete a capability.

This commit is contained in:
Drew Galbraith 2023-11-19 17:53:56 -08:00
parent 2e08eb76ff
commit 7d48dd2b8b
6 changed files with 16 additions and 2 deletions

View file

@ -18,3 +18,11 @@ z_err_t CapDuplicate(ZCapDuplicateReq* req) {
cap->permissions() & req->perm_mask);
return glcr::OK;
}
z_err_t CapRelease(ZCapReleaseReq* req) {
auto& proc = gScheduler->CurrentProcess();
if (proc.ReleaseCapability(req->cap).empty()) {
return glcr::CAP_NOT_FOUND;
}
return glcr::OK;
}

View file

@ -3,3 +3,4 @@
#include "include/zcall.h"
z_err_t CapDuplicate(ZCapDuplicateReq* req);
z_err_t CapRelease(ZCapReleaseReq* req);

View file

@ -81,6 +81,7 @@ extern "C" z_err_t SyscallHandler(uint64_t call_id, void* req) {
CASE(ReplyPortRecv);
// syscall/capability.h
CASE(CapDuplicate);
CASE(CapRelease);
// syscall/syncronization.h
CASE(MutexCreate);
CASE(MutexLock);