:: commit 9cbe856da0ec9522489d17b6935c85a48603662f

mintsuki <mintsuki@protonmail.com> — 2021-11-21 00:18

parents: b0e9007e2c

term: Bug fixes

diff --git a/stage23/entry.s2.c b/stage23/entry.s2.c
index e41dbaa3..4385042a 100644
--- a/stage23/entry.s2.c
+++ b/stage23/entry.s2.c
@@ -20,6 +20,7 @@
 #include <pxe/tftp.h>
 #include <drivers/disk.h>
 #include <sys/idt.h>
+#include <sys/cpu.h>
 
 struct volume *boot_volume;
 
@@ -80,6 +81,19 @@ void entry(uint8_t boot_drive, int boot_from) {
 
     term_notready();
 
+#if bios == 1
+    {
+    struct rm_regs r = {0};
+    r.eax = 0x0003;
+    rm_int(0x10, &r, &r);
+
+    current_video_mode = -1;
+
+    outb(0x3d4, 0x0a);
+    outb(0x3d5, 0x20);
+    }
+#endif
+
     init_e820();
     init_memmap();
 
diff --git a/stage23/entry.s3.c b/stage23/entry.s3.c
index ef07aff8..2ff6a8d1 100644
--- a/stage23/entry.s3.c
+++ b/stage23/entry.s3.c
@@ -141,6 +141,10 @@ void stage3_common(void) {
     char *quiet_str = config_get_value(NULL, 0, "QUIET");
     quiet = quiet_str != NULL && strcmp(quiet_str, "yes") == 0;
 
+#if bios == 1
+    term_textmode();
+#endif
+
     char *verbose_str = config_get_value(NULL, 0, "VERBOSE");
     verbose = verbose_str != NULL && strcmp(verbose_str, "yes") == 0;
 
diff --git a/stage23/lib/term.s2.c b/stage23/lib/term.s2.c
index 2b0129d0..c81dae38 100644
--- a/stage23/lib/term.s2.c
+++ b/stage23/lib/term.s2.c
@@ -7,7 +7,6 @@
 #include <lib/blib.h>
 #include <drivers/vga_textmode.h>
 #include <lib/print.h>
-#include <sys/cpu.h>
 
 // Tries to implement this standard for terminfo
 // https://man7.org/linux/man-pages/man4/console_codes.4.html
@@ -75,26 +74,6 @@ void term_notready(void) {
 
     term_rows = 100;
     term_cols = 100;
-
-#if bios == 1
-    {
-    if (current_video_mode != -1) {
-        struct rm_regs r = {0};
-        r.eax = 0x0003;
-        rm_int(0x10, &r, &r);
-
-        current_video_mode = -1;
-    }
-
-    volatile uint16_t *vmem = (volatile uint16_t *)0xb8000;
-    for (size_t i = 0; i < 80*25; i++) {
-        vmem[i] = 0x0720;
-    }
-
-    outb(0x3d4, 0x0a);
-    outb(0x3d5, 0x20);
-    }
-#endif
 }
 
 void (*raw_putchar)(uint8_t c);
tab: 248 wrap: offon