diff options
Diffstat (limited to 'src/kernel/io/io.h')
-rw-r--r-- | src/kernel/io/io.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/kernel/io/io.h b/src/kernel/io/io.h index ba5e7c1..2d078f1 100644 --- a/src/kernel/io/io.h +++ b/src/kernel/io/io.h @@ -25,6 +25,7 @@ u16 inw(u16 port); u32 inl(u16 port); int interrupts_enabled(); +void interrupts_print(); void cli(); void sti(); void hlt(); @@ -61,4 +62,13 @@ void init_serial(); */ void serial_put(char ch); +// Spinlock +static inline void spinlock(int *ptr) +{ + int prev; + do + asm volatile("lock xchgl %0,%1" : "=a"(prev) : "m"(*ptr), "a"(1)); + while (prev); +} + #endif
\ No newline at end of file |