From d44e897d06de45c9a91c21d71f1375efb019db17 Mon Sep 17 00:00:00 2001 From: hpa Date: Thu, 18 Aug 2005 23:43:02 +0000 Subject: [PATCH] Better NOESCAPE; handle comments without space (too common a mistake) --- NEWS | 1 + abort.inc | 6 ++---- keywords | 1 - keywords.inc | 3 +-- parsecmd.inc | 4 ++++ parseconfig.inc | 8 +------- ui.inc | 19 +++++++++++++------ 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/NEWS b/NEWS index a19fd68..54a880b 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ Changes in 3.10: * New API call to query features. * Fix for bug in EBIOS code discovered by Arwin Vosselman. * NOESCAPE security fix. + * Comments are now recognized even without a space following #. Changes in 3.09: * gcc4 compilation fix. diff --git a/abort.inc b/abort.inc index 25598d3..850a266 100644 --- a/abort.inc +++ b/abort.inc @@ -61,10 +61,8 @@ abort_check: sti call cwritestr ; Expects SI -> error msg - ; If NOESCAPE is active, then execute the default command - cmp byte [KbdFlagMask],0 - jz auto_boot ; Default command - jmp enter_command ; Otherwise command prompt + ; Return to the command prompt + jmp enter_command ; ; End of abort_check diff --git a/keywords b/keywords index 155a4e1..1fa8c9c 100644 --- a/keywords +++ b/keywords @@ -1,4 +1,3 @@ -# hash menu append default diff --git a/keywords.inc b/keywords.inc index 6f68554..e880154 100644 --- a/keywords.inc +++ b/keywords.inc @@ -44,7 +44,6 @@ keywd_size equ 8 ; Bytes per keyword align 4, db 0 keywd_table: - keyword hash, pc_comment keyword menu, pc_comment keyword append, pc_append keyword default, pc_default @@ -62,7 +61,7 @@ keywd_table: keyword ontimeout, pc_ontimeout keyword onerror, pc_onerror keyword allowoptions, pc_setint16, AllowOptions - keyword noescape, pc_noescape + keyword noescape, pc_setint16, NoEscape keyword f1, pc_fkey, FKeyName+(0< comment + je .skipline + or al,20h ; Convert to lower case movzx ebx,al ; Hash for a one-char keyword .read_loop: diff --git a/parseconfig.inc b/parseconfig.inc index 1e5ff5f..32e84be 100644 --- a/parseconfig.inc +++ b/parseconfig.inc @@ -276,13 +276,6 @@ pc_say: call pc_getline ; "say" command jmp crlf ; tailcall ; -; "noescape" command -; -pc_noescape: - mov byte [KbdFlagMask],0 ; No escape route available... - ; Fall into pc_getline - -; ; Comment line ; pc_comment: ; Fall into pc_getline @@ -359,6 +352,7 @@ OnerrorLen dw 0 ; Bytes in onerror command KbdTimeOut dw 0 ; Keyboard timeout (if any) CmdLinePtr dw cmd_line_here ; Command line advancing pointer ForcePrompt dw 0 ; Force prompt +NoEscape dw 0 ; No escape AllowImplicit dw 1 ; Allow implicit kernels AllowOptions dw 1 ; User-specified options allowed SerialPort dw 0 ; Serial port base (or 0 for no serial port) diff --git a/ui.inc b/ui.inc index 968f778..92bf498 100644 --- a/ui.inc +++ b/ui.inc @@ -20,13 +20,15 @@ no_config_file: ; Check whether or not we are supposed to display the boot prompt. ; check_for_key: - cmp word [ForcePrompt],byte 0 ; Force prompt? + cmp word [ForcePrompt],0 ; Force prompt? jnz enter_command - mov al,[KbdFlags] - test al,[KbdFlagMask] + test byte [KbdFlags],5Bh ; Shift Alt Caps Scroll jz auto_boot ; If neither, default boot enter_command: + cmp word [NoEscape],0 ; If NOESCAPE, no prompt, + je auto_boot ; always run default cmd + mov si,boot_prompt call cwritestr @@ -183,12 +185,20 @@ fk_wrcmd: call cwritestr ; Write command line so far fk_nofile: pop di jmp short get_char_2 + +; +; Jump here to run the default command line +; auto_boot: mov si,default_cmd mov di,command_line mov cx,(max_cmd_len+4) >> 2 rep movsd jmp short load_kernel + +; +; Jump here when the command line is completed +; command_done: call crlf cmp di,command_line ; Did we just hit return? @@ -486,9 +496,6 @@ kernel_good: %endif ; Otherwise Linux kernel - section .data -KbdFlagMask db 5Bh ; Caps, Scroll, Shift, Alt - section .bss alignb 2 KernelExtPtr resw 1 ; During search, final null pointer -- 2.7.4