50 uintptr_t kernelStack;
53 size_t processorIndex;
54 void* pendingUserEntry;
55#if PEDIGREE_LATENCY_ACCOUNTING
56 size_t latencyNmiDepth = 0;
59 static_assert(__builtin_offsetof(
KernelGsAnchor, kernelStack) == 0);
61 static_assert(__builtin_offsetof(
KernelGsAnchor, information) == 16);
62 static_assert(__builtin_offsetof(
KernelGsAnchor, processorIndex) == 24);
63 static_assert(__builtin_offsetof(
KernelGsAnchor, pendingUserEntry) == 32);
64#if PEDIGREE_LATENCY_ACCOUNTING
65 static_assert(__builtin_offsetof(
KernelGsAnchor, latencyNmiDepth) == 40);
72 return &m_KernelGsAnchor;
74 void activateKernelGsAnchor(
size_t processorIndex);
86 void setTssSelector(uint16_t TssSelector);
89 void setTss(
void* Tss);
92 uint16_t getTssSelector()
const;
97 uint16_t getTlsSelector();
99 void setTlsSelector(uint16_t tls);
101 uintptr_t getKernelStack()
const;
102 void setKernelStack(uintptr_t stack);
103 Thread* getCurrentThread()
const {
104 return m_pCurrentThread;
106 void setCurrentThread(
Thread* pThread);
115 return m_ProcessorId;
117 uint8_t localApicId()
const {
118 return m_LocalApicId;
122 void initialiseTscClockAnchor(uint64_t tsc, uint64_t nanoseconds);
126 if (!__atomic_load_n(&m_TscClockAnchorInitialised, __ATOMIC_ACQUIRE)) {
130 tsc = __atomic_load_n(&m_TscClockAnchor, __ATOMIC_RELAXED);
131 nanoseconds = __atomic_load_n(&m_TscClockAnchorNanoseconds, __ATOMIC_RELAXED);
142 void setIds(
ProcessorId processorId, uint8_t apicId = 0);