mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-07-11 15:29:18 +00:00
Fixed wrong stack pointer & new tss command for crash screen
This commit is contained in:
@ -75,7 +75,7 @@ namespace GlobalDescriptorTable
|
||||
// tss
|
||||
{}};
|
||||
|
||||
static GlobalDescriptorTableEntries GDTEntries[MAX_CPU];
|
||||
GlobalDescriptorTableEntries GDTEntries[MAX_CPU];
|
||||
GlobalDescriptorTableDescriptor gdt[MAX_CPU];
|
||||
|
||||
TaskStateSegment tss[MAX_CPU] = {
|
||||
@ -145,9 +145,14 @@ namespace GlobalDescriptorTable
|
||||
|
||||
SafeFunction void SetKernelStack(void *Stack)
|
||||
{
|
||||
if (Stack)
|
||||
tss[GetCurrentCPU()->ID].StackPointer[0] = (uint64_t)Stack;
|
||||
long CPUID = GetCurrentCPU()->ID;
|
||||
if (Stack != nullptr)
|
||||
tss[CPUID].StackPointer[0] = (uint64_t)Stack;
|
||||
else
|
||||
tss[GetCurrentCPU()->ID].StackPointer[0] = (uint64_t)CPUStackPointer[GetCurrentCPU()->ID] + STACK_SIZE;
|
||||
tss[CPUID].StackPointer[0] = (uint64_t)CPUStackPointer[CPUID] + STACK_SIZE;
|
||||
|
||||
// TODO: This may cause problems in the future I guess? This should be checked later
|
||||
asmv("mov %%rsp, %0"
|
||||
: "=r"(tss[CPUID].StackPointer[0]));
|
||||
}
|
||||
}
|
||||
|
@ -113,6 +113,8 @@ namespace InterruptDescriptorTable
|
||||
// : "q"(KPT)
|
||||
// : "memory");
|
||||
|
||||
// GlobalDescriptorTable::SetKernelStack(nullptr);
|
||||
|
||||
asm(
|
||||
// "cmp $0x1000, %rsp\n"
|
||||
// "jng .skip_swap_check__1\n"
|
||||
|
@ -131,6 +131,7 @@ namespace GlobalDescriptorTable
|
||||
} __attribute__((packed)) GlobalDescriptorTableDescriptor;
|
||||
|
||||
extern void *CPUStackPointer[];
|
||||
extern TaskStateSegment tss[];
|
||||
void Init(int Core);
|
||||
void SetKernelStack(void *Stack);
|
||||
}
|
||||
|
Reference in New Issue
Block a user