27 lines
506 B
C++
27 lines
506 B
C++
#include "interrupts/Interrupts.h"
|
|
#include "trace/StackTracer.h"
|
|
|
|
void Interrupts::disable()
|
|
{
|
|
asm volatile("cli");
|
|
}
|
|
|
|
void Interrupts::enable()
|
|
{
|
|
asm volatile("sti");
|
|
}
|
|
|
|
extern int _asm_interrupt_exit;
|
|
|
|
bool Interrupts::is_in_handler()
|
|
{
|
|
return stack_trace_contains((uintptr_t)&_asm_interrupt_exit);
|
|
}
|
|
|
|
void Interrupts::return_from_handler(Context* context)
|
|
{
|
|
asm volatile("mov %0, %%rsp\n"
|
|
"jmp _asm_interrupt_exit"
|
|
:
|
|
: "r"(context));
|
|
} |