mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-07-05 04:19:16 +00:00
RIP history implementation for broken stacks
This commit is contained in:
@ -489,6 +489,23 @@ namespace Tasking
|
||||
CurrentCPU->CurrentThread->Status = TaskStatus::Running;
|
||||
|
||||
*Frame = CurrentCPU->CurrentThread->Registers;
|
||||
|
||||
// FIXME: Untested
|
||||
for (int i = 0; i < 128; i++)
|
||||
{
|
||||
if (CurrentCPU->CurrentThread->RIPHistory[i] == 0)
|
||||
{
|
||||
CurrentCPU->CurrentThread->RIPHistory[i] = Frame->rip;
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 127)
|
||||
{
|
||||
for (int j = 0; j < 127; j++)
|
||||
CurrentCPU->CurrentThread->RIPHistory[j] = CurrentCPU->CurrentThread->RIPHistory[j + 1];
|
||||
CurrentCPU->CurrentThread->RIPHistory[127] = Frame->rip;
|
||||
}
|
||||
}
|
||||
GlobalDescriptorTable::SetKernelStack((void *)((uint64_t)CurrentCPU->CurrentThread->Stack->GetStackTop()));
|
||||
CPU::x64::writecr3({.raw = (uint64_t)CurrentCPU->CurrentProcess->PageTable});
|
||||
// Not sure if this is needed, but it's better to be safe than sorry.
|
||||
|
Reference in New Issue
Block a user