-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmachine.C
executable file
·40 lines (29 loc) · 1023 Bytes
/
machine.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
File: machine.c
Author: R. Bettati
Department of Computer Science
Texas A&M University
Date : 09/04/13
LOW-LEVEL MACHINE FUNCTIONS.
*/
/*--------------------------------------------------------------------------*/
/* INCLUDES */
/*--------------------------------------------------------------------------*/
#include "machine.H"
#include "assert.H"
#include "threads_low.H"
/*--------------------------------------------------------------------------*/
/* EXPORTED FUNCTIONS */
/*--------------------------------------------------------------------------*/
int machine_interrupts_enabled() {
/* We check the IF flag (INTERRUPT ENABLE) in the EFLAGS status register. */
return get_EFLAGS() & (1 << 9);
}
void machine_enable_interrupts() {
assert(!machine_interrupts_enabled());
__asm__ __volatile__ ("sti");
}
void machine_disable_interrupts() {
assert(machine_interrupts_enabled());
__asm__ __volatile__ ("cli");
}