term: Adjustments for backport
diff --git a/common/menu.c b/common/menu.c
index 1f3c51e4..64b3228b 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -787,7 +787,7 @@ refresh:
set_cursor_pos_helper(x, y + 2);
}
- size_t max_entries = print_tree(tree_offset, term_rows - 10, serial ? "| " : "\xb3 ", 0, 0, selected_entry, menu_tree,
+ size_t max_entries = print_tree(tree_offset, term->rows - 10, serial ? "| " : "\xb3 ", 0, 0, selected_entry, menu_tree,
&selected_menu_entry);
{
@@ -795,7 +795,7 @@ refresh:
term->get_cursor_pos(term, &x, &y);
if (tree_offset + (term->rows - 10) < max_entries) {
- set_cursor_pos_helper(2, term_rows - 2);
+ set_cursor_pos_helper(2, term->rows - 2);
print(serial ? "vvv" : "\x19\x19\x19");
}
diff --git a/common/protos/stivale.c b/common/protos/stivale.c
index b91fba00..e5372f0a 100644
--- a/common/protos/stivale.c
+++ b/common/protos/stivale.c
@@ -308,7 +308,10 @@ noreturn void stivale_load(char *config, char *cmdline) {
stivale_struct->epoch = time();
printv("stivale: Current epoch: %U\n", stivale_struct->epoch);
- term_deinit();
+ if (term != NULL) {
+ term->deinit(term, pmm_free);
+ term = NULL;
+ }
if (stivale_hdr.flags & (1 << 0)) {
size_t req_width = stivale_hdr.framebuffer_width;
diff --git a/common/protos/stivale2.c b/common/protos/stivale2.c
index fb8d7ee6..a2ea1bda 100644
--- a/common/protos/stivale2.c
+++ b/common/protos/stivale2.c
@@ -584,10 +584,10 @@ failed_to_load_header_section:
tag->flags |= (1 << 2);
if (terminal_hdr_tag->callback != 0) {
#if defined (__i386__)
- term_callback = stivale2_term_callback;
+ term->callback = (void *)stivale2_term_callback;
stivale2_term_callback_ptr = terminal_hdr_tag->callback;
#elif defined (__x86_64__)
- term_callback = (void *)terminal_hdr_tag->callback;
+ term->callback = (void *)terminal_hdr_tag->callback;
#endif
}
}
@@ -604,16 +604,16 @@ failed_to_load_header_section:
stivale2_rt_stack = ext_mem_alloc(8192) + 8192;
}
- stivale2_term_write_ptr = (uintptr_t)term_write;
+ stivale2_term_write_ptr = (uintptr_t)_term_write;
tag->term_write = (uintptr_t)(void *)stivale2_term_write_entry;
#elif defined (__x86_64__)
- tag->term_write = (uintptr_t)term_write;
+ tag->term_write = (uintptr_t)_term_write;
#endif
// We provide rows and cols
tag->flags |= (1 << 0);
- tag->cols = term_cols;
- tag->rows = term_rows;
+ tag->cols = term->cols;
+ tag->rows = term->rows;
append_tag(stivale2_struct, (struct stivale2_tag *)tag);
@@ -628,14 +628,20 @@ failed_to_load_header_section:
fb = &_fb;
}
- term_deinit();
+ if (term != NULL) {
+ term->deinit(term, pmm_free);
+ term = NULL;
+ }
if (hdrtag != NULL
#if defined (UEFI)
|| avtag != NULL
#endif
|| (avtag != NULL && preference == 0)) {
- term_deinit();
+ if (term != NULL) {
+ term->deinit(term, pmm_free);
+ term = NULL;
+ }
#if defined (UEFI)
gop_force_16 = true;
@@ -866,9 +872,10 @@ have_tm_tag:;
}
// Clear terminal for kernels that will use the stivale2 terminal
- term_write((uint64_t)(uintptr_t)("\e[2J\e[H"), 7);
-
- term_runtime = true;
+ if (term != NULL) {
+ term_write(term, "\e[2J\e[H", 7);
+ term->in_bootloader = false;
+ }
stivale_spinup(bits, want_5lv, &pagemap, entry_point,
REPORTED_ADDR((uint64_t)(uintptr_t)stivale2_struct),
