Updated StackGuard

This commit is contained in:
Alex 2022-12-15 03:06:55 +02:00
parent 83a5b2a4ee
commit a3664662f3
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
2 changed files with 10 additions and 2 deletions

View File

@ -23,14 +23,18 @@ namespace Memory
}
this->StackBottom = (void *)USER_STACK_BASE;
this->StackTop = (void *)(USER_STACK_BASE + USER_STACK_SIZE);
this->StackPhyiscalBottom = AllocatedStack;
this->StackPhyiscalTop = (void *)((uint64_t)AllocatedStack + USER_STACK_SIZE);
this->Size = USER_STACK_SIZE;
}
else
{
this->StackBottom = KernelAllocator.RequestPages(TO_PAGES(STACK_SIZE));
this->StackPhyiscalBottom = this->StackBottom;
debug("StackBottom: %p", this->StackBottom);
memset(this->StackBottom, 0, STACK_SIZE);
this->StackTop = (void *)((uint64_t)this->StackBottom + STACK_SIZE);
this->StackPhyiscalTop = this->StackTop;
this->Size = STACK_SIZE;
}
trace("Allocated stack at %p", this->StackBottom);

View File

@ -603,8 +603,8 @@ namespace Memory
private:
void *StackBottom = nullptr;
void *StackTop = nullptr;
void *SGB = nullptr;
void *SGT = nullptr;
void *StackPhyiscalBottom = nullptr;
void *StackPhyiscalTop = nullptr;
uint64_t Size = 0;
bool UserMode = false;
PageTable4 *Table = nullptr;
@ -614,6 +614,10 @@ namespace Memory
void *GetStackBottom() { return StackBottom; }
/** @brief For RSP */
void *GetStackTop() { return StackTop; }
/** @brief For general info */
void *GetStackPhysicalBottom() { return StackPhyiscalBottom; }
/** @brief For general info */
void *GetStackPhysicalTop() { return StackPhyiscalTop; }
/** @brief Called by exception handler */
bool Expand(uint64_t FaultAddress);
/**