Proper stack management

This commit is contained in:
wheremyfoodat 2023-07-07 15:00:18 +03:00
parent 4a12e59c2f
commit 2ec3884189
4 changed files with 48 additions and 8 deletions
src/core/loader

View file

@ -14,6 +14,13 @@ std::optional<u32> Memory::loadELF(std::ifstream& file) {
return std::nullopt;
}
// Allocate stack space. For ELFs we use the default stack size, which is 16KB
if (!allocateMainThreadStack(VirtualAddrs::DefaultStackSize)) {
// Should be unreachable
printf("Failed to allocate stack space for ELF file\n");
return std::nullopt;
}
auto segNum = reader.segments.size();
printf("Number of segments: %d\n", segNum);
printf(" # Perms Vaddr File Size Mem Size\n");