mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-25 22:14:37 +00:00
interrupts: Switch page table in MainInterruptHandler()
This commit is contained in:
parent
23301b8c1b
commit
21faaf6ea1
@ -325,6 +325,34 @@ namespace Interrupts
|
||||
|
||||
extern "C" nsa void MainInterruptHandler(void *Data)
|
||||
{
|
||||
class AutoSwitchPageTable
|
||||
{
|
||||
private:
|
||||
void *Original;
|
||||
|
||||
public:
|
||||
AutoSwitchPageTable()
|
||||
{
|
||||
#if defined(a86)
|
||||
asmv("mov %%cr3, %0" : "=r"(Original));
|
||||
#endif
|
||||
if (likely(Original == KernelPageTable))
|
||||
return;
|
||||
#if defined(a86)
|
||||
asmv("mov %0, %%cr3" : : "r"(KernelPageTable));
|
||||
#endif
|
||||
}
|
||||
|
||||
~AutoSwitchPageTable()
|
||||
{
|
||||
if (likely(Original == KernelPageTable))
|
||||
return;
|
||||
#if defined(a86)
|
||||
asmv("mov %0, %%cr3" : : "r"(Original));
|
||||
#endif
|
||||
}
|
||||
} SwitchPageTable;
|
||||
|
||||
CPU::TrapFrame *Frame = (CPU::TrapFrame *)Data;
|
||||
// debug("IRQ%ld", Frame->InterruptNumber - 32);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user