Make a KernelObject base class for all Capabilities.
This commit is contained in:
parent
d358c1d672
commit
4e278a4664
9 changed files with 50 additions and 21 deletions
|
|
@ -1,11 +1,14 @@
|
|||
#include "capability/capability.h"
|
||||
|
||||
#include "scheduler/process.h"
|
||||
#include "scheduler/thread.h"
|
||||
|
||||
template <>
|
||||
Process& Capability::obj<Process>() {
|
||||
if (type_ != PROCESS) {
|
||||
panic("Accessing %u cap as object.", type_);
|
||||
}
|
||||
return *static_cast<Process*>(obj_);
|
||||
return *static_cast<Process*>(obj_.get());
|
||||
}
|
||||
|
||||
template <>
|
||||
|
|
@ -13,5 +16,5 @@ Thread& Capability::obj<Thread>() {
|
|||
if (type_ != THREAD) {
|
||||
panic("Accessing %u cap as object.", type_);
|
||||
}
|
||||
return *static_cast<Thread*>(obj_);
|
||||
return *static_cast<Thread*>(obj_.get());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue