feat: port gcc to MontaukOS
This commit is contained in:
1 parent
324b18edda
commit
8e6b619b02
14 files changed
+493
-19
No files matched your search
@@ -19,9 +19,14 @@ namespace Sched {
|
||||
static constexpr int MaxProcesses = 256;
|
||||
static constexpr uint64_t StackPages = 4; // 16 KiB kernel stack per thread
|
||||
static constexpr uint64_t StackSize = StackPages * 0x1000;
|
||||
static constexpr uint64_t UserStackPages = 8; // 32 KiB user stack (main thread)
|
||||
static constexpr uint64_t UserStackPages = 8; // 32 KiB user stack (main thread, eagerly mapped)
|
||||
static constexpr uint64_t UserStackSize = UserStackPages * 0x1000;
|
||||
static constexpr uint64_t UserStackTop = 0x7FFFFFF000ULL; // Main-thread user stack top VA
|
||||
// The main-thread stack demand-grows below the eager region up to this
|
||||
// limit: page faults in [UserStackTop - UserStackMax, UserStackTop -
|
||||
// UserStackSize) map fresh zeroed pages instead of killing the process.
|
||||
// Heavy recursive programs (GCC's cc1plus) need megabytes of stack.
|
||||
static constexpr uint64_t UserStackMax = 64 * 1024 * 1024; // 64 MiB
|
||||
static constexpr uint64_t UserHeapBase = 0x40000000ULL; // User heap start VA
|
||||
static constexpr uint32_t UserReadDirSlots = 64; // rotating scratch pages for SYS_READDIR
|
||||
static constexpr uint64_t UserReadDirBase =
|
||||
@@ -139,6 +144,12 @@ namespace Sched {
|
||||
// Get a pointer to the currently running thread's slot (may be a sibling).
|
||||
Process* GetCurrentThreadPtr();
|
||||
|
||||
// Demand-grow the current process's main-thread user stack. Called from
|
||||
// the page fault handler when a non-present fault lands in the stack
|
||||
// growth region. Maps one zeroed page at the faulting address and returns
|
||||
// true if the faulting instruction should be retried.
|
||||
bool TryGrowUserStack(uint64_t faultAddr);
|
||||
|
||||
// Called by terminated processes to mark themselves done.
|
||||
// Tears down the entire process (kills all sibling threads, frees address space).
|
||||
void ExitProcess();
|
||||
|
||||
Reference in new issue
Block a user