Compare commits
No commits in common. "f5deb1048a27e17791215791675eae5b567395ea" and "e90b90c5561f59066b8669fa9051b01c930e9a59" have entirely different histories.
f5deb1048a
...
e90b90c556
@ -8,10 +8,4 @@ namespace Interrupts
|
|||||||
|
|
||||||
bool is_in_handler();
|
bool is_in_handler();
|
||||||
void return_from_handler(Context* context);
|
void return_from_handler(Context* context);
|
||||||
|
|
||||||
bool are_enabled();
|
|
||||||
bool were_enabled();
|
|
||||||
void push_and_disable();
|
|
||||||
void push_and_enable();
|
|
||||||
void pop();
|
|
||||||
}
|
}
|
@ -5,6 +5,4 @@ namespace Utilities
|
|||||||
{
|
{
|
||||||
uint64_t get_blocks_from_size(uint64_t blocksize,
|
uint64_t get_blocks_from_size(uint64_t blocksize,
|
||||||
uint64_t size); // Returns how many blocks of size blocksize does size occupy.
|
uint64_t size); // Returns how many blocks of size blocksize does size occupy.
|
||||||
|
|
||||||
uint64_t get_rflags();
|
|
||||||
}
|
}
|
@ -1,5 +1,4 @@
|
|||||||
#include "interrupts/Interrupts.h"
|
#include "interrupts/Interrupts.h"
|
||||||
#include "misc/utils.h"
|
|
||||||
#include "trace/StackTracer.h"
|
#include "trace/StackTracer.h"
|
||||||
|
|
||||||
void Interrupts::disable()
|
void Interrupts::disable()
|
||||||
@ -25,35 +24,4 @@ void Interrupts::return_from_handler(Context* context)
|
|||||||
"jmp _asm_interrupt_exit"
|
"jmp _asm_interrupt_exit"
|
||||||
:
|
:
|
||||||
: "r"(context));
|
: "r"(context));
|
||||||
}
|
|
||||||
|
|
||||||
bool Interrupts::are_enabled()
|
|
||||||
{
|
|
||||||
return (Utilities::get_rflags() & 0x200) > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool saved_interrupt_state;
|
|
||||||
|
|
||||||
void Interrupts::push_and_disable()
|
|
||||||
{
|
|
||||||
saved_interrupt_state = are_enabled();
|
|
||||||
disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Interrupts::push_and_enable()
|
|
||||||
{
|
|
||||||
saved_interrupt_state = are_enabled();
|
|
||||||
enable();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Interrupts::pop()
|
|
||||||
{
|
|
||||||
if (saved_interrupt_state && !are_enabled()) enable();
|
|
||||||
else if (!saved_interrupt_state && are_enabled())
|
|
||||||
disable();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Interrupts::were_enabled()
|
|
||||||
{
|
|
||||||
return saved_interrupt_state;
|
|
||||||
}
|
}
|
@ -25,10 +25,4 @@ asm_enable_sse:
|
|||||||
mov rax, cr4
|
mov rax, cr4
|
||||||
or ax, 3 << 9
|
or ax, 3 << 9
|
||||||
mov cr4, rax
|
mov cr4, rax
|
||||||
ret
|
|
||||||
|
|
||||||
global asm_get_rflags
|
|
||||||
asm_get_rflags:
|
|
||||||
pushfq
|
|
||||||
pop rax
|
|
||||||
ret
|
ret
|
@ -3,10 +3,4 @@
|
|||||||
uint64_t Utilities::get_blocks_from_size(uint64_t blocksize, uint64_t size)
|
uint64_t Utilities::get_blocks_from_size(uint64_t blocksize, uint64_t size)
|
||||||
{
|
{
|
||||||
return (size + (blocksize - 1)) / blocksize;
|
return (size + (blocksize - 1)) / blocksize;
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" uint64_t asm_get_rflags();
|
|
||||||
uint64_t Utilities::get_rflags()
|
|
||||||
{
|
|
||||||
return asm_get_rflags();
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user