acadia/zion/capability/capability.cpp
Drew Galbraith 23895b5c6c Spawn Processes using memory primitives rather than and elf loader.
This allows us to remove the temporary syscall for that style of process
spawn.
2023-06-07 00:04:53 -07:00

36 lines
853 B
C++

#include "capability/capability.h"
#include "object/process.h"
#include "object/thread.h"
template <>
RefPtr<Process> Capability::obj<Process>() {
if (type_ != PROCESS) {
panic("Accessing %u cap as object.", type_);
}
return StaticCastRefPtr<Process>(obj_);
}
template <>
RefPtr<Thread> Capability::obj<Thread>() {
if (type_ != THREAD) {
panic("Accessing %u cap as object.", type_);
}
return StaticCastRefPtr<Thread>(obj_);
}
template <>
RefPtr<AddressSpace> Capability::obj<AddressSpace>() {
if (type_ != ADDRESS_SPACE) {
panic("Accessing %u cap as object.", type_);
}
return StaticCastRefPtr<AddressSpace>(obj_);
}
template <>
RefPtr<MemoryObject> Capability::obj<MemoryObject>() {
if (type_ != MEMORY_OBJECT) {
panic("Accessing %u cap as object.", type_);
}
return StaticCastRefPtr<MemoryObject>(obj_);
}