diff --git a/Core/Memory/StackGuard.cpp b/Core/Memory/StackGuard.cpp index 801afe2..8319575 100644 --- a/Core/Memory/StackGuard.cpp +++ b/Core/Memory/StackGuard.cpp @@ -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); diff --git a/include/memory.hpp b/include/memory.hpp index eb5dcd5..8a8bb1a 100644 --- a/include/memory.hpp +++ b/include/memory.hpp @@ -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); /**