diff options
author | dzwdz | 2021-06-25 16:27:19 +0200 |
---|---|---|
committer | dzwdz | 2021-06-25 16:27:19 +0200 |
commit | 654ca8603381ffa385350242cfb96906cf612279 (patch) | |
tree | 9fc9b3ff19932c0061efe96c84ba780a6d5b9e0f /kernel | |
parent | f60d40f3bf4dfe8ed6f63a27367d323319a4ef97 (diff) |
tty_const
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/gdt.c | 4 | ||||
-rw-r--r-- | kernel/main.c | 6 | ||||
-rw-r--r-- | kernel/tty.h | 3 |
3 files changed, 7 insertions, 6 deletions
diff --git a/kernel/gdt.c b/kernel/gdt.c index 8a29032..eaf81ba 100644 --- a/kernel/gdt.c +++ b/kernel/gdt.c @@ -106,10 +106,10 @@ static void gdt_load() { } static void gdt_check() { - tty_write("checking gdt...", 15); + tty_const("checking gdt..."); asm("mov %0, %%ds;" : : "r" (SEG_r0data << 3) : "memory"); - tty_write("ok", 2); + tty_const("ok "); } void gdt_init() { diff --git a/kernel/main.c b/kernel/main.c index e63ca14..458558a 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -12,13 +12,13 @@ void kmain() gdt_init(); sysenter_setup(); - tty_write("user...", 7); + tty_const("jumping to ring3..."); sysexit(r3_test, &stack_top); } void r3_test() { - tty_write("in ring3", 8); + tty_const("ok"); asm("cli"); // privileged instruction, should cause a GP - tty_write(" oh no", 6); // shouldn't happen + tty_const(" this shouldn't happen"); for (;;) {} } diff --git a/kernel/tty.h b/kernel/tty.h index 435c87f..3dc1525 100644 --- a/kernel/tty.h +++ b/kernel/tty.h @@ -1,7 +1,8 @@ #pragma once - #include <stddef.h> 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) |