[zion] Move capability validation to capability.h
This commit is contained in:
parent
93cf8f2740
commit
172bf51db7
8 changed files with 42 additions and 47 deletions
|
|
@ -43,19 +43,6 @@ void InitSyscall() {
|
|||
SetMSR(LSTAR, reinterpret_cast<uint64_t>(syscall_enter));
|
||||
}
|
||||
|
||||
z_err_t ValidateCap(const RefPtr<Capability>& cap, uint64_t permissions) {
|
||||
if (!cap) {
|
||||
return Z_ERR_CAP_NOT_FOUND;
|
||||
}
|
||||
// FIXME: Check capability type before permissions, otherwise you can
|
||||
// get a confusing error.
|
||||
if (!cap->HasPermissions(permissions)) {
|
||||
dbgln("PERM, has %x needs %x", cap->permissions(), permissions);
|
||||
return Z_ERR_CAP_DENIED;
|
||||
}
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
#define CASE(name) \
|
||||
case kZion##name: \
|
||||
return name(reinterpret_cast<Z##name##Req*>(req));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue