summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/generic.h2
-rw-r--r--src/arch/i386/boot.c7
-rw-r--r--src/arch/i386/interrupts/isr.c6
-rw-r--r--src/arch/i386/log.c6
-rw-r--r--src/arch/i386/tty.h2
-rw-r--r--src/arch/log.h7
6 files changed, 22 insertions, 8 deletions
diff --git a/src/arch/generic.h b/src/arch/generic.h
index 7807316..f9617ab 100644
--- a/src/arch/generic.h
+++ b/src/arch/generic.h
@@ -1,5 +1,7 @@
#pragma once
+#include <arch/log.h>
+
// i have no idea where else to put it
#define PAGE_SIZE 4096
diff --git a/src/arch/i386/boot.c b/src/arch/i386/boot.c
index b2b84f0..37e1aff 100644
--- a/src/arch/i386/boot.c
+++ b/src/arch/i386/boot.c
@@ -1,3 +1,4 @@
+#include <arch/generic.h>
#include <arch/i386/gdt.h>
#include <arch/i386/interrupts/idt.h>
#include <arch/i386/sysenter.h>
@@ -6,11 +7,11 @@
void kmain_early() {
tty_clear();
- tty_const("gdt...");
+ log_const("gdt...");
gdt_init();
- tty_const("idt...");
+ log_const("idt...");
idt_init();
- tty_const("sysenter...");
+ log_const("sysenter...");
sysenter_setup();
kmain();
}
diff --git a/src/arch/i386/interrupts/isr.c b/src/arch/i386/interrupts/isr.c
index 03399ea..1603fba 100644
--- a/src/arch/i386/interrupts/isr.c
+++ b/src/arch/i386/interrupts/isr.c
@@ -1,5 +1,5 @@
#include <arch/i386/interrupts/isr.h>
-#include <arch/i386/tty.h>
+#include <arch/log.h>
#include <kernel/panic.h>
#include <stdbool.h>
#include <stdint.h>
@@ -8,13 +8,13 @@ bool isr_test_interrupt_called = false;
__attribute__((interrupt))
void isr_double_fault(struct interrupt_frame *frame) {
- tty_const("#DF");
+ log_const("#DF");
panic();
}
__attribute__((interrupt))
void isr_general_protection_fault(struct interrupt_frame *frame) {
- tty_const("#GP");
+ log_const("#GP");
panic();
}
diff --git a/src/arch/i386/log.c b/src/arch/i386/log.c
new file mode 100644
index 0000000..fc82023
--- /dev/null
+++ b/src/arch/i386/log.c
@@ -0,0 +1,6 @@
+#include <arch/i386/tty.h>
+#include <arch/log.h>
+
+void log_write(const char *buf, size_t len) {
+ tty_write(buf, len);
+}
diff --git a/src/arch/i386/tty.h b/src/arch/i386/tty.h
index 3dc1525..cbb8efc 100644
--- a/src/arch/i386/tty.h
+++ b/src/arch/i386/tty.h
@@ -4,5 +4,3 @@
void tty_putchar(char c);
void tty_write(const char *buf, size_t len);
void tty_clear();
-
-#define tty_const(str) tty_write(str, sizeof(str) - 1)
diff --git a/src/arch/log.h b/src/arch/log.h
new file mode 100644
index 0000000..6365c20
--- /dev/null
+++ b/src/arch/log.h
@@ -0,0 +1,7 @@
+#pragma once
+#include <stddef.h>
+
+void log_write(const char *buf, size_t len);
+
+// used for static strings
+#define log_const(str) log_write(str, sizeof(str) - 1)