misc: Fix bugs introduced in 3181293a
This commit is contained in:
parent
e89d834457
commit
a6189abdc1
|
@ -21,6 +21,10 @@ noreturn void panic(bool allow_menu, const char *fmt, ...) {
|
||||||
|
|
||||||
quiet = false;
|
quiet = false;
|
||||||
|
|
||||||
|
if (term_backend == _NOT_READY) {
|
||||||
|
term_fallback();
|
||||||
|
}
|
||||||
|
|
||||||
if (term_backend != FALLBACK) {
|
if (term_backend != FALLBACK) {
|
||||||
print("\033[31mPANIC\033[37;1m\033[0m: ");
|
print("\033[31mPANIC\033[37;1m\033[0m: ");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -142,10 +142,6 @@ void print(const char *fmt, ...) {
|
||||||
static char print_buf[PRINT_BUF_MAX];
|
static char print_buf[PRINT_BUF_MAX];
|
||||||
|
|
||||||
void vprint(const char *fmt, va_list args) {
|
void vprint(const char *fmt, va_list args) {
|
||||||
if (quiet) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t print_buf_i = 0;
|
size_t print_buf_i = 0;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -222,15 +218,17 @@ void vprint(const char *fmt, va_list args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
if (!quiet) {
|
||||||
#if defined (BIOS)
|
#if defined (BIOS)
|
||||||
if (stage3_loaded) {
|
if (stage3_loaded) {
|
||||||
#endif
|
#endif
|
||||||
term_write((uint64_t)(uintptr_t)print_buf, print_buf_i);
|
term_write((uint64_t)(uintptr_t)print_buf, print_buf_i);
|
||||||
#if defined (BIOS)
|
#if defined (BIOS)
|
||||||
} else {
|
} else {
|
||||||
s2_print(print_buf, print_buf_i);
|
s2_print(print_buf, print_buf_i);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
for (size_t i = 0; i < print_buf_i; i++) {
|
for (size_t i = 0; i < print_buf_i; i++) {
|
||||||
#if defined (__x86_64__) || defined (__i386__)
|
#if defined (__x86_64__) || defined (__i386__)
|
||||||
|
@ -238,7 +236,7 @@ out:
|
||||||
outb(0xe9, print_buf[i]);
|
outb(0xe9, print_buf[i]);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (serial || COM_OUTPUT) {
|
if ((!quiet && serial) || COM_OUTPUT) {
|
||||||
switch (print_buf[i]) {
|
switch (print_buf[i]) {
|
||||||
case '\n':
|
case '\n':
|
||||||
serial_out('\r');
|
serial_out('\r');
|
||||||
|
|
|
@ -52,7 +52,7 @@ void term_deinit(void) {
|
||||||
gterm_deinit();
|
gterm_deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
term_fallback();
|
term_notready();
|
||||||
}
|
}
|
||||||
|
|
||||||
void term_vbe(char *config, size_t width, size_t height) {
|
void term_vbe(char *config, size_t width, size_t height) {
|
||||||
|
@ -253,6 +253,8 @@ static uint8_t xfer_buf[TERM_XFER_CHUNK];
|
||||||
|
|
||||||
bool term_autoflush = true;
|
bool term_autoflush = true;
|
||||||
|
|
||||||
|
static void term_putchar(uint8_t c);
|
||||||
|
|
||||||
void term_write(uint64_t buf, uint64_t count) {
|
void term_write(uint64_t buf, uint64_t count) {
|
||||||
switch (count) {
|
switch (count) {
|
||||||
case TERM_CTX_SIZE: {
|
case TERM_CTX_SIZE: {
|
||||||
|
@ -1026,7 +1028,7 @@ static uint8_t dec_special_to_cp437(uint8_t c) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
void term_putchar(uint8_t c) {
|
static void term_putchar(uint8_t c) {
|
||||||
if (discard_next || (term_runtime == true && (c == 0x18 || c == 0x1a))) {
|
if (discard_next || (term_runtime == true && (c == 0x18 || c == 0x1a))) {
|
||||||
discard_next = false;
|
discard_next = false;
|
||||||
escape = false;
|
escape = false;
|
||||||
|
|
|
@ -50,13 +50,13 @@ extern int term_backend;
|
||||||
extern size_t term_rows, term_cols;
|
extern size_t term_rows, term_cols;
|
||||||
extern bool term_runtime;
|
extern bool term_runtime;
|
||||||
|
|
||||||
|
void term_notready(void);
|
||||||
void term_fallback(void);
|
void term_fallback(void);
|
||||||
|
|
||||||
void term_reinit(void);
|
void term_reinit(void);
|
||||||
void term_deinit(void);
|
void term_deinit(void);
|
||||||
void term_vbe(char *config, size_t width, size_t height);
|
void term_vbe(char *config, size_t width, size_t height);
|
||||||
void term_textmode(void);
|
void term_textmode(void);
|
||||||
void term_putchar(uint8_t c);
|
|
||||||
void term_write(uint64_t buf, uint64_t count);
|
void term_write(uint64_t buf, uint64_t count);
|
||||||
|
|
||||||
extern void (*raw_putchar)(uint8_t c);
|
extern void (*raw_putchar)(uint8_t c);
|
||||||
|
|
|
@ -136,8 +136,6 @@ static void fallback_get_cursor_pos(size_t *x, size_t *y) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void term_notready(void);
|
|
||||||
|
|
||||||
void term_fallback(void) {
|
void term_fallback(void) {
|
||||||
#if defined (UEFI)
|
#if defined (UEFI)
|
||||||
if (!efi_boot_services_exited) {
|
if (!efi_boot_services_exited) {
|
||||||
|
@ -193,7 +191,7 @@ static void notready_uint64_t(uint64_t n) {
|
||||||
(void)n;
|
(void)n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void term_notready(void) {
|
void term_notready(void) {
|
||||||
raw_putchar = notready_raw_putchar;
|
raw_putchar = notready_raw_putchar;
|
||||||
clear = notready_clear;
|
clear = notready_clear;
|
||||||
enable_cursor = notready_void;
|
enable_cursor = notready_void;
|
||||||
|
@ -224,4 +222,6 @@ static void term_notready(void) {
|
||||||
|
|
||||||
term_cols = 80;
|
term_cols = 80;
|
||||||
term_rows = 24;
|
term_rows = 24;
|
||||||
|
|
||||||
|
term_backend = _NOT_READY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -738,7 +738,6 @@ FEAT_START
|
||||||
FEAT_END
|
FEAT_END
|
||||||
|
|
||||||
term_deinit();
|
term_deinit();
|
||||||
quiet = true;
|
|
||||||
|
|
||||||
if (!fb_init(&fb, req_width, req_height, req_bpp)) {
|
if (!fb_init(&fb, req_width, req_height, req_bpp)) {
|
||||||
panic(true, "limine: Could not acquire framebuffer");
|
panic(true, "limine: Could not acquire framebuffer");
|
||||||
|
|
|
@ -496,7 +496,6 @@ noreturn void linux_load(char *config, char *cmdline) {
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
|
|
||||||
term_deinit();
|
term_deinit();
|
||||||
quiet = true;
|
|
||||||
|
|
||||||
struct screen_info *screen_info = &boot_params->screen_info;
|
struct screen_info *screen_info = &boot_params->screen_info;
|
||||||
|
|
||||||
|
|
|
@ -303,7 +303,6 @@ noreturn void multiboot1_load(char *config, char *cmdline) {
|
||||||
multiboot1_info->flags |= (1 << 9);
|
multiboot1_info->flags |= (1 << 9);
|
||||||
|
|
||||||
term_deinit();
|
term_deinit();
|
||||||
quiet = true;
|
|
||||||
|
|
||||||
if (header.flags & (1 << 2)) {
|
if (header.flags & (1 << 2)) {
|
||||||
size_t req_width = header.fb_width;
|
size_t req_width = header.fb_width;
|
||||||
|
|
|
@ -498,7 +498,6 @@ noreturn void multiboot2_load(char *config, char* cmdline) {
|
||||||
tag->common.size = sizeof(struct multiboot_tag_framebuffer);
|
tag->common.size = sizeof(struct multiboot_tag_framebuffer);
|
||||||
|
|
||||||
term_deinit();
|
term_deinit();
|
||||||
quiet = true;
|
|
||||||
|
|
||||||
if (fbtag) {
|
if (fbtag) {
|
||||||
size_t req_width = fbtag->width;
|
size_t req_width = fbtag->width;
|
||||||
|
|
Loading…
Reference in New Issue