diff --git a/include/task.hpp b/include/task.hpp index 778cb88..89870f6 100644 --- a/include/task.hpp +++ b/include/task.hpp @@ -239,38 +239,42 @@ namespace Tasking */ struct gsTCB { - /** - * Used by syscall handler - * + /** Used by syscall handler * gs+0x0 */ - uintptr_t SyscallStack; + void *SyscallStack; - /** - * Used by syscall handler - * + /** Used by syscall handler * gs+0x8 */ - uintptr_t TempStack; - - /** - * Used by syscall handler - * - * gs+0x10 - */ - uint8_t Flags; + void *TempStack; /* For future use */ - /* gs+0x11 */ - uintptr_t Padding : 7; + /** Used by syscall handler + * gs+0x10 + */ + uintptr_t Flags; + + /* gs+0x18 */ + uintptr_t Padding; + + /* gs+0x20 */ void *SyscallStackBase; - int ScPages; + + /* gs+0x28 */ + intptr_t ScPages; /** * The current thread class + * gs+0x30 */ class TCB *t; + +#ifdef DEBUG + /* gs+0x38 */ + uintptr_t __stub; +#endif }; class TCB diff --git a/tasking/signal.cpp b/tasking/signal.cpp index eb29046..1a195d0 100644 --- a/tasking/signal.cpp +++ b/tasking/signal.cpp @@ -452,7 +452,7 @@ namespace Tasking sf->rax = si->tf.rax; sf->Flags = si->tf.rflags.raw; sf->ReturnAddress = si->tf.rip; - gs->TempStack = si->tf.rsp; + gs->TempStack = (void *)si->tf.rsp; SignalMask.store(si->SignalMask); diff --git a/tasking/thread.cpp b/tasking/thread.cpp index bd056b1..a18100b 100644 --- a/tasking/thread.cpp +++ b/tasking/thread.cpp @@ -508,10 +508,13 @@ namespace Tasking this->Stack = new Memory::StackGuard(true, this->vma); gsTCB *gsT = (gsTCB *)this->vma->RequestPages(TO_PAGES(sizeof(gsTCB))); +#ifdef DEBUG + gsT->__stub = 0xFFFFFFFFFFFFFFFF; +#endif gsT->ScPages = TO_PAGES(STACK_SIZE); 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", gsT->SyscallStack, gsT->SyscallStackBase, gsT);