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
|
|
@ -25,10 +25,13 @@ RefPtr<Process> Process::Create() {
|
|||
proc->caps_.PushBack(
|
||||
new Capability(proc, Capability::PROCESS, Z_INIT_PROC_SELF,
|
||||
ZC_PROC_SPAWN_PROC | ZC_PROC_SPAWN_THREAD));
|
||||
proc->caps_.PushBack(new Capability(proc->vmas(), Capability::ADDRESS_SPACE,
|
||||
Z_INIT_AS_SELF, ZC_WRITE));
|
||||
return proc;
|
||||
}
|
||||
|
||||
Process::Process() : id_(gNextId++), state_(RUNNING) {}
|
||||
Process::Process()
|
||||
: id_(gNextId++), vmm_(MakeRefCounted<AddressSpace>()), state_(RUNNING) {}
|
||||
|
||||
RefPtr<Thread> Process::CreateThread() {
|
||||
RefPtr<Thread> thread = MakeRefCounted<Thread>(*this, next_thread_id_++);
|
||||
|
|
@ -77,3 +80,22 @@ uint64_t Process::AddCapability(const RefPtr<Thread>& thread) {
|
|||
caps_.PushBack(new Capability(thread, Capability::THREAD, cap_id, ZC_WRITE));
|
||||
return cap_id;
|
||||
}
|
||||
|
||||
uint64_t Process::AddCapability(const RefPtr<Process>& p) {
|
||||
uint64_t cap_id = next_cap_id_++;
|
||||
caps_.PushBack(new Capability(p, Capability::PROCESS, cap_id,
|
||||
ZC_WRITE | ZC_PROC_SPAWN_THREAD));
|
||||
return cap_id;
|
||||
}
|
||||
uint64_t Process::AddCapability(const RefPtr<AddressSpace>& as) {
|
||||
uint64_t cap_id = next_cap_id_++;
|
||||
caps_.PushBack(
|
||||
new Capability(as, Capability::ADDRESS_SPACE, cap_id, ZC_WRITE));
|
||||
return cap_id;
|
||||
}
|
||||
uint64_t Process::AddCapability(const RefPtr<MemoryObject>& mo) {
|
||||
uint64_t cap_id = next_cap_id_++;
|
||||
caps_.PushBack(
|
||||
new Capability(mo, Capability::MEMORY_OBJECT, cap_id, ZC_WRITE));
|
||||
return cap_id;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue