diff options
author | Benji Dial <benji@benjidial.net> | 2024-05-19 13:27:11 -0400 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2024-05-19 13:27:11 -0400 |
commit | 649ff9636fe7289749c91141bbf32b2dcbe6dde4 (patch) | |
tree | 5da6e8ddfd449b012d8936040e292fa4de534cc0 /kernel/source/serial.asm | |
parent | f8ff95f19289a88706935abebd71e317355641d4 (diff) | |
download | hilbert-os-649ff9636fe7289749c91141bbf32b2dcbe6dde4.tar.gz |
add serial logging for exceptions, fix virtualbox issue
Diffstat (limited to 'kernel/source/serial.asm')
-rw-r--r-- | kernel/source/serial.asm | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/kernel/source/serial.asm b/kernel/source/serial.asm new file mode 100644 index 0000000..071e525 --- /dev/null +++ b/kernel/source/serial.asm @@ -0,0 +1,58 @@ +bits 64 + +global serial_init +global serial_putchar + +section .text + +serial_init: + + xor al, al + mov dx, 0x03f9 + out dx, al + + mov al, 0x80 + mov dx, 0x03fb + out dx, al + + mov al, 0x03 + mov dx, 0x03f8 + out dx, al + + xor al, al + mov dx, 0x03f9 + out dx, al + + mov al, 0x03 + mov dx, 0x03fb + out dx, al + + mov al, 0xc7 + mov dx, 0x03fa + out dx, al + + ret + +serial_putchar: + + cmp dil, 0x0a + je .do_cr +.cr_ret: + + mov dx, 0x03fd + +.loop: + in al, dx + test al, 0x20 + jz .loop + + mov al, dil + mov dx, 0x03f8 + out dx, al + ret + +.do_cr: + mov dil, 0x0d + call serial_putchar + mov dil, 0x0a + jmp .cr_ret |