mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Refactor gsTCB struct for debugging and update usage in related files
This commit is contained in:
parent
e021c1d9eb
commit
2ffd8e3c34
@ -239,38 +239,42 @@ namespace Tasking
|
|||||||
*/
|
*/
|
||||||
struct gsTCB
|
struct gsTCB
|
||||||
{
|
{
|
||||||
/**
|
/** Used by syscall handler
|
||||||
* Used by syscall handler
|
|
||||||
*
|
|
||||||
* gs+0x0
|
* gs+0x0
|
||||||
*/
|
*/
|
||||||
uintptr_t SyscallStack;
|
void *SyscallStack;
|
||||||
|
|
||||||
/**
|
/** Used by syscall handler
|
||||||
* Used by syscall handler
|
|
||||||
*
|
|
||||||
* gs+0x8
|
* gs+0x8
|
||||||
*/
|
*/
|
||||||
uintptr_t TempStack;
|
void *TempStack;
|
||||||
|
|
||||||
/**
|
|
||||||
* Used by syscall handler
|
|
||||||
*
|
|
||||||
* gs+0x10
|
|
||||||
*/
|
|
||||||
uint8_t Flags;
|
|
||||||
|
|
||||||
/* For future use */
|
/* For future use */
|
||||||
|
|
||||||
/* gs+0x11 */
|
/** Used by syscall handler
|
||||||
uintptr_t Padding : 7;
|
* gs+0x10
|
||||||
|
*/
|
||||||
|
uintptr_t Flags;
|
||||||
|
|
||||||
|
/* gs+0x18 */
|
||||||
|
uintptr_t Padding;
|
||||||
|
|
||||||
|
/* gs+0x20 */
|
||||||
void *SyscallStackBase;
|
void *SyscallStackBase;
|
||||||
int ScPages;
|
|
||||||
|
/* gs+0x28 */
|
||||||
|
intptr_t ScPages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current thread class
|
* The current thread class
|
||||||
|
* gs+0x30
|
||||||
*/
|
*/
|
||||||
class TCB *t;
|
class TCB *t;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
/* gs+0x38 */
|
||||||
|
uintptr_t __stub;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class TCB
|
class TCB
|
||||||
|
@ -452,7 +452,7 @@ namespace Tasking
|
|||||||
sf->rax = si->tf.rax;
|
sf->rax = si->tf.rax;
|
||||||
sf->Flags = si->tf.rflags.raw;
|
sf->Flags = si->tf.rflags.raw;
|
||||||
sf->ReturnAddress = si->tf.rip;
|
sf->ReturnAddress = si->tf.rip;
|
||||||
gs->TempStack = si->tf.rsp;
|
gs->TempStack = (void *)si->tf.rsp;
|
||||||
|
|
||||||
SignalMask.store(si->SignalMask);
|
SignalMask.store(si->SignalMask);
|
||||||
|
|
||||||
|
@ -508,10 +508,13 @@ namespace Tasking
|
|||||||
this->Stack = new Memory::StackGuard(true, this->vma);
|
this->Stack = new Memory::StackGuard(true, this->vma);
|
||||||
|
|
||||||
gsTCB *gsT = (gsTCB *)this->vma->RequestPages(TO_PAGES(sizeof(gsTCB)));
|
gsTCB *gsT = (gsTCB *)this->vma->RequestPages(TO_PAGES(sizeof(gsTCB)));
|
||||||
|
#ifdef DEBUG
|
||||||
|
gsT->__stub = 0xFFFFFFFFFFFFFFFF;
|
||||||
|
#endif
|
||||||
|
|
||||||
gsT->ScPages = TO_PAGES(STACK_SIZE);
|
gsT->ScPages = TO_PAGES(STACK_SIZE);
|
||||||
gsT->SyscallStackBase = this->vma->RequestPages(gsT->ScPages);
|
gsT->SyscallStackBase = this->vma->RequestPages(gsT->ScPages);
|
||||||
gsT->SyscallStack = (uintptr_t)gsT->SyscallStackBase + STACK_SIZE - 0x10;
|
gsT->SyscallStack = (void *)((uintptr_t)gsT->SyscallStackBase + STACK_SIZE - 0x10);
|
||||||
debug("New syscall stack created: %#lx (base: %#lx) with gs base at %#lx",
|
debug("New syscall stack created: %#lx (base: %#lx) with gs base at %#lx",
|
||||||
gsT->SyscallStack, gsT->SyscallStackBase, gsT);
|
gsT->SyscallStack, gsT->SyscallStackBase, gsT);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user