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
|
|
@ -6,10 +6,10 @@
|
|||
|
||||
extern KernelStackManager* gKernelStackManager;
|
||||
|
||||
AddressSpace AddressSpace::ForRoot() {
|
||||
RefPtr<AddressSpace> AddressSpace::ForRoot() {
|
||||
uint64_t cr3 = 0;
|
||||
asm volatile("mov %%cr3, %0;" : "=r"(cr3));
|
||||
return {cr3};
|
||||
return MakeRefCounted<AddressSpace>(cr3);
|
||||
}
|
||||
|
||||
AddressSpace::AddressSpace() {
|
||||
|
|
@ -22,6 +22,10 @@ uint64_t AddressSpace::AllocateUserStack() {
|
|||
}
|
||||
|
||||
uint64_t AddressSpace::GetNextMemMapAddr(uint64_t size) {
|
||||
if (size == 0) {
|
||||
panic("Zero size memmap");
|
||||
}
|
||||
size = ((size - 1) & ~0xFFF) + 0x1000;
|
||||
uint64_t addr = next_memmap_addr_;
|
||||
next_memmap_addr_ += size;
|
||||
if (next_memmap_addr_ >= 0x30'00000000) {
|
||||
|
|
@ -35,6 +39,12 @@ void AddressSpace::MapInMemoryObject(uint64_t vaddr,
|
|||
memory_mappings_.PushBack({.vaddr = vaddr, .mem_obj = mem_obj});
|
||||
}
|
||||
|
||||
uint64_t AddressSpace::MapInMemoryObject(const RefPtr<MemoryObject>& mem_obj) {
|
||||
uint64_t vaddr = GetNextMemMapAddr(mem_obj->size());
|
||||
memory_mappings_.PushBack({.vaddr = vaddr, .mem_obj = mem_obj});
|
||||
return vaddr;
|
||||
}
|
||||
|
||||
uint64_t* AddressSpace::AllocateKernelStack() {
|
||||
return gKernelStackManager->AllocateKernelStack();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue