kernel/process_capability: Handle syscall capability flags
This commit is contained in:
parent
27caf71204
commit
3dc59b74ec
2 changed files with 29 additions and 1 deletions
|
@ -239,7 +239,30 @@ ResultCode ProcessCapabilities::HandlePriorityCoreNumFlags(u32 flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ResultCode ProcessCapabilities::HandleSyscallFlags(u32& set_svc_bits, u32 flags) {
|
ResultCode ProcessCapabilities::HandleSyscallFlags(u32& set_svc_bits, u32 flags) {
|
||||||
// TODO: Implement
|
const u32 index = flags >> 29;
|
||||||
|
const u32 svc_bit = 1U << index;
|
||||||
|
|
||||||
|
// If we've already set this svc before, bail.
|
||||||
|
if ((set_svc_bits & svc_bit) != 0) {
|
||||||
|
return ERR_INVALID_COMBINATION;
|
||||||
|
}
|
||||||
|
set_svc_bits |= svc_bit;
|
||||||
|
|
||||||
|
const u32 svc_mask = (flags >> 5) & 0xFFFFFF;
|
||||||
|
for (u32 i = 0; i < 24; ++i) {
|
||||||
|
const u32 svc_number = index * 24 + i;
|
||||||
|
|
||||||
|
if ((svc_mask & (1U << i)) == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (svc_number >= svc_capabilities.size()) {
|
||||||
|
return ERR_OUT_OF_RANGE;
|
||||||
|
}
|
||||||
|
|
||||||
|
svc_capabilities[svc_number] = true;
|
||||||
|
}
|
||||||
|
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,11 @@ public:
|
||||||
return priority_mask;
|
return priority_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gets the SVC access permission bits
|
||||||
|
const SyscallCapabilities& GetServiceCapabilities() const {
|
||||||
|
return svc_capabilities;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Attempts to parse a given sequence of capability descriptors.
|
/// Attempts to parse a given sequence of capability descriptors.
|
||||||
///
|
///
|
||||||
|
|
Loading…
Reference in a new issue