diff --git a/limine.bin b/limine.bin index 035d981e..8869a106 100644 Binary files a/limine.bin and b/limine.bin differ diff --git a/stage2/lib/config.c b/stage2/lib/config.c index 686b2d75..8f07660a 100644 --- a/stage2/lib/config.c +++ b/stage2/lib/config.c @@ -8,6 +8,8 @@ #define SEPARATOR '\n' +bool config_ready = false; + static char *config_addr; int init_config(int drive, int part) { @@ -33,6 +35,8 @@ int init_config(int drive, int part) { } } + config_ready = true; + return 0; } diff --git a/stage2/lib/config.h b/stage2/lib/config.h index 788eb3c4..b5a0108b 100644 --- a/stage2/lib/config.h +++ b/stage2/lib/config.h @@ -4,6 +4,8 @@ #include #include +extern bool config_ready; + int init_config(int drive, int part); int config_get_entry_name(char *ret, size_t index, size_t limit); int config_set_entry(size_t index); diff --git a/stage2/lib/print.c b/stage2/lib/print.c index 630e634e..e4b1a91c 100644 --- a/stage2/lib/print.c +++ b/stage2/lib/print.c @@ -3,8 +3,12 @@ #include #include #include -#include +#include #include +#include +#include + +static int e9_output = -1; static const char *base_digits = "0123456789abcdef"; @@ -114,6 +118,11 @@ void print(const char *fmt, ...) { static char print_buf[PRINT_BUF_MAX]; void vprint(const char *fmt, va_list args) { + if (config_ready && e9_output == -1) { + e9_output = config_get_value(print_buf, 0, PRINT_BUF_MAX, "E9_OUTPUT") && + !strcmp(print_buf, "yes"); + } + size_t print_buf_i = 0; for (;;) { @@ -170,8 +179,8 @@ void vprint(const char *fmt, va_list args) { out: term_write(print_buf, print_buf_i); -#ifdef E9_OUTPUT - for (size_t i = 0; i < print_buf_i; i++) - outb(0xe9, print_buf[i]); -#endif + if (e9_output == 1) { + for (size_t i = 0; i < print_buf_i; i++) + outb(0xe9, print_buf[i]); + } } diff --git a/test/limine.cfg b/test/limine.cfg index 20cb5e2c..330d0549 100644 --- a/test/limine.cfg +++ b/test/limine.cfg @@ -1,6 +1,7 @@ DEFAULT_ENTRY=0 TIMEOUT=3 GRAPHICS=yes +E9_OUTPUT=yes THEME_BLACK=80000000 THEME_RED=aa0000