diff options
| author | Nic Gaffney <gaffney_nic@protonmail.com> | 2023-12-21 03:32:06 -0600 |
|---|---|---|
| committer | Nic Gaffney <gaffney_nic@protonmail.com> | 2023-12-21 03:32:06 -0600 |
| commit | 138424b31d9c2af158e8ae619248b035b5a280d9 (patch) | |
| tree | 0da4f6661d68737b5957029242bea43fad77d7a8 /src/include/asm.h | |
| parent | 9dbc5231dd738d97eea13f8ecf9005e5b78ea0d3 (diff) | |
| download | gftos-138424b31d9c2af158e8ae619248b035b5a280d9.tar.gz | |
set up bochs for debugging and started working on interrupts.
Diffstat (limited to 'src/include/asm.h')
| -rw-r--r-- | src/include/asm.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/include/asm.h b/src/include/asm.h new file mode 100644 index 0000000..97ea45a --- /dev/null +++ b/src/include/asm.h @@ -0,0 +1,15 @@ +#pragma once +#include <stdint.h> + +// IO +static inline void outb(uint16_t port, uint8_t val) { + asm volatile("outb %0, %1" : : "a"(val), "Nd"(port) : "memory"); +} + +static inline uint8_t inb(uint16_t port) { + uint8_t ret; + asm volatile("inb %1, %0" : "=a"(ret) : "Nd"(port) : "memory"); + return ret; +} + +static inline void io_wait(void) { outb(0x80, 0); } |
