Spawn Processes using memory primitives rather than and elf loader.
This allows us to remove the temporary syscall for that style of process spawn.
This commit is contained in:
parent
b06c76e477
commit
23895b5c6c
26 changed files with 403 additions and 94 deletions
|
|
@ -4,17 +4,33 @@
|
|||
#include "object/thread.h"
|
||||
|
||||
template <>
|
||||
Process& Capability::obj<Process>() {
|
||||
RefPtr<Process> Capability::obj<Process>() {
|
||||
if (type_ != PROCESS) {
|
||||
panic("Accessing %u cap as object.", type_);
|
||||
}
|
||||
return *static_cast<Process*>(obj_.get());
|
||||
return StaticCastRefPtr<Process>(obj_);
|
||||
}
|
||||
|
||||
template <>
|
||||
Thread& Capability::obj<Thread>() {
|
||||
RefPtr<Thread> Capability::obj<Thread>() {
|
||||
if (type_ != THREAD) {
|
||||
panic("Accessing %u cap as object.", type_);
|
||||
}
|
||||
return *static_cast<Thread*>(obj_.get());
|
||||
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_);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ class Capability {
|
|||
UNDEFINED,
|
||||
PROCESS,
|
||||
THREAD,
|
||||
ADDRESS_SPACE,
|
||||
MEMORY_OBJECT,
|
||||
};
|
||||
Capability(const RefPtr<KernelObject>& obj, Type type, uint64_t id,
|
||||
uint64_t permissions)
|
||||
|
|
@ -25,7 +27,7 @@ class Capability {
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
T& obj();
|
||||
RefPtr<T> obj();
|
||||
|
||||
uint64_t id() { return id_; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue