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
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "debug/debug.h"
|
||||
#include "lib/ref_ptr.h"
|
||||
#include "object/kernel_object.h"
|
||||
|
||||
class Process;
|
||||
class Thread;
|
||||
|
|
@ -14,9 +15,15 @@ class Capability {
|
|||
PROCESS,
|
||||
THREAD,
|
||||
};
|
||||
Capability(void* obj, Type type, uint64_t id, uint64_t permissions)
|
||||
Capability(const RefPtr<KernelObject>& obj, Type type, uint64_t id,
|
||||
uint64_t permissions)
|
||||
: obj_(obj), type_(type), id_(id), permissions_(permissions) {}
|
||||
|
||||
template <typename T>
|
||||
Capability(const RefPtr<T>& obj, Type type, uint64_t id, uint64_t permissions)
|
||||
: Capability(StaticCastRefPtr<KernelObject>(obj), type, id, permissions) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T& obj();
|
||||
|
||||
|
|
@ -30,8 +37,7 @@ class Capability {
|
|||
}
|
||||
|
||||
private:
|
||||
// FIXME: This should somehow be a shared ptr to keep the object alive.
|
||||
void* obj_;
|
||||
RefPtr<KernelObject> obj_;
|
||||
Type type_;
|
||||
uint64_t id_;
|
||||
uint64_t permissions_;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue