mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 07:24:37 +00:00
Updated StackGuard
This commit is contained in:
parent
83a5b2a4ee
commit
a3664662f3
@ -23,14 +23,18 @@ namespace Memory
|
|||||||
}
|
}
|
||||||
this->StackBottom = (void *)USER_STACK_BASE;
|
this->StackBottom = (void *)USER_STACK_BASE;
|
||||||
this->StackTop = (void *)(USER_STACK_BASE + USER_STACK_SIZE);
|
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;
|
this->Size = USER_STACK_SIZE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->StackBottom = KernelAllocator.RequestPages(TO_PAGES(STACK_SIZE));
|
this->StackBottom = KernelAllocator.RequestPages(TO_PAGES(STACK_SIZE));
|
||||||
|
this->StackPhyiscalBottom = this->StackBottom;
|
||||||
debug("StackBottom: %p", this->StackBottom);
|
debug("StackBottom: %p", this->StackBottom);
|
||||||
memset(this->StackBottom, 0, STACK_SIZE);
|
memset(this->StackBottom, 0, STACK_SIZE);
|
||||||
this->StackTop = (void *)((uint64_t)this->StackBottom + STACK_SIZE);
|
this->StackTop = (void *)((uint64_t)this->StackBottom + STACK_SIZE);
|
||||||
|
this->StackPhyiscalTop = this->StackTop;
|
||||||
this->Size = STACK_SIZE;
|
this->Size = STACK_SIZE;
|
||||||
}
|
}
|
||||||
trace("Allocated stack at %p", this->StackBottom);
|
trace("Allocated stack at %p", this->StackBottom);
|
||||||
|
@ -603,8 +603,8 @@ namespace Memory
|
|||||||
private:
|
private:
|
||||||
void *StackBottom = nullptr;
|
void *StackBottom = nullptr;
|
||||||
void *StackTop = nullptr;
|
void *StackTop = nullptr;
|
||||||
void *SGB = nullptr;
|
void *StackPhyiscalBottom = nullptr;
|
||||||
void *SGT = nullptr;
|
void *StackPhyiscalTop = nullptr;
|
||||||
uint64_t Size = 0;
|
uint64_t Size = 0;
|
||||||
bool UserMode = false;
|
bool UserMode = false;
|
||||||
PageTable4 *Table = nullptr;
|
PageTable4 *Table = nullptr;
|
||||||
@ -614,6 +614,10 @@ namespace Memory
|
|||||||
void *GetStackBottom() { return StackBottom; }
|
void *GetStackBottom() { return StackBottom; }
|
||||||
/** @brief For RSP */
|
/** @brief For RSP */
|
||||||
void *GetStackTop() { return StackTop; }
|
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 */
|
/** @brief Called by exception handler */
|
||||||
bool Expand(uint64_t FaultAddress);
|
bool Expand(uint64_t FaultAddress);
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user