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