20 #include "pedigree/kernel/processor/hosted/ProcessorInformation.h" 21 #include "pedigree/kernel/Log.h" 22 #include "pedigree/kernel/processor/Processor.h" 23 #include "pedigree/kernel/processor/types.h" 24 #include <processor/hosted/VirtualAddressSpace.h> 34 extern void *safe_stack_top;
38 : m_ProcessorId(processorId),
41 m_pCurrentThread(0), m_Scheduler(0),
68 Thread *HostedProcessorInformation::getCurrentThread()
const 73 void HostedProcessorInformation::setCurrentThread(
Thread *pThread)
92 static bool trickSigaltstack(uintptr_t stack, stack_t *p)
96 stack =
reinterpret_cast<uintptr_t
>(&safe_stack_top);
100 stack, reinterpret_cast<uintptr_t>(sigaltstack),
101 reinterpret_cast<uintptr_t>(p));
104 WARNING(
"sigaltstack failed to set new stack");
111 void HostedProcessorInformation::setKernelStack(uintptr_t stack)
115 void *new_sp =
reinterpret_cast<void *
>(stack - KERNEL_STACK_SIZE);
118 if (s.ss_sp != new_sp)
120 ByteSet(&s, 0,
sizeof(s));
122 s.ss_size = KERNEL_STACK_SIZE;
123 int r = sigaltstack(&s, 0);
124 if (r < 0 && errno == EPERM)
126 trickSigaltstack(stack, &s);
134 s.ss_flags |= SS_DISABLE;
135 int r = sigaltstack(&s, 0);
136 if (r < 0 && errno == EPERM)
138 trickSigaltstack(stack, &s);
145 uintptr_t HostedProcessorInformation::getKernelStack()
const
static EXPORTED_PUBLIC VirtualAddressSpace & getKernelAddressSpace()