:: commit 63a45e2b31edeeac2228e6a31b3477fedd9ec162

mintsuki <mintsuki@protonmail.com> — 2021-07-11 06:51

parents: f4a47cff02

stivale2: Implement max_length field of terminal structure tag

diff --git a/stage23/protos/stivale2.c b/stage23/protos/stivale2.c
index 101d44a7..d5f5041e 100644
--- a/stage23/protos/stivale2.c
+++ b/stage23/protos/stivale2.c
@@ -357,10 +357,15 @@ void stivale2_load(char *config, char *cmdline, bool pxe, void *efi_system_table
         struct stivale2_struct_tag_terminal *tag = ext_mem_alloc(sizeof(struct stivale2_struct_tag_terminal));
         tag->tag.identifier = STIVALE2_STRUCT_TAG_TERMINAL_ID;
 
+        // We provide max allowed string length
+        tag->flags |= (1 << 1);
+
 #if defined (bios)
         tag->term_write = (uintptr_t)(void *)stivale2_term_write_entry;
+        tag->max_length = 4096;
 #elif defined (uefi)
         tag->term_write = (uintptr_t)term_write;
+        tag->max_length = 0;
 #endif
 
         // We provide rows and cols
diff --git a/stage23/protos/stivale2_rt.asm b/stage23/protos/stivale2_rt.asm
index 87ec85a2..2eba309d 100644
--- a/stage23/protos/stivale2_rt.asm
+++ b/stage23/protos/stivale2_rt.asm
@@ -8,7 +8,7 @@ user_ds: resq 1
 user_es: resq 1
 user_ss: resq 1
 
-%define MAX_TERM_BUF 1024
+%define MAX_TERM_BUF 4096
 
 term_buf:
     resb MAX_TERM_BUF
tab: 248 wrap: offon