aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhpa <hpa>2002-04-30 03:33:27 +0000
committerhpa <hpa>2002-04-30 03:33:27 +0000
commitb17209b886b2395ed711f3335e7be355d2fefc8d (patch)
tree68821078b0d4b1f2e8975b9b079127d36dedc350
parent83b3e784e2226dbda6345e54031c0eb4ceca34eb (diff)
downloadsyslinux-b17209b886b2395ed711f3335e7be355d2fefc8d.tar.gz
syslinux-b17209b886b2395ed711f3335e7be355d2fefc8d.tar.xz
syslinux-b17209b886b2395ed711f3335e7be355d2fefc8d.zip
Further rationalize command-line parsing by allowing functions tosyslinux-1.73-pre9
take an argument.
-rw-r--r--isolinux.asm50
-rw-r--r--keywords.inc51
-rw-r--r--ldlinux.asm51
-rw-r--r--parsecmd.inc5
-rw-r--r--parseconfig.inc89
-rw-r--r--pxelinux.asm52
6 files changed, 114 insertions, 184 deletions
diff --git a/isolinux.asm b/isolinux.asm
index 1be8b202..807f707d 100644
--- a/isolinux.asm
+++ b/isolinux.asm
@@ -689,6 +689,12 @@ all_read:
; Now set up screen parameters
call adjust_screen
+ ; Wipe the F-key area
+ mov al,NULLFILE
+ mov di,FKeyName
+ mov cx,10*(1 << FILENAME_MAX_LG2)
+ rep stosb
+
; Patch the writechr routine to point to the full code
mov word [writechr+1], writechr_full-(writechr+3)
@@ -914,21 +920,19 @@ ctrl_f: push di
jmp short show_help
func_key:
+ ; AL = 0 if we get here
push di
cmp ah,68 ; F10
ja get_char_2
sub ah,59 ; F1
jb get_char_2
- shr ax,8
+ xchg al,ah
show_help: ; AX = func key # (0 = F1, 9 = F10)
- mov cl,al
- shl ax,FILENAME_MAX_LG2 ; Convert to offset
- mov bx,1
- shl bx,cl
- and bx,[FKeyMap]
- jz get_char_2 ; Undefined F-key
- mov di,ax
+ shl ax,FILENAME_MAX_LG2 ; Convert to pointer
+ xchg di,ax
add di,FKeyName
+ cmp byte [di],NULLFILE
+ je get_char_2 ; Undefined F-key
call searchdir
jz fk_nofile
push si
@@ -1865,35 +1869,6 @@ initrd_cmd_len equ 7
; Config file keyword table
;
%include "keywords.inc"
- align 2, db 0
-
-keywd_table:
- keyword append, pc_append
- keyword default, pc_default
- keyword timeout, pc_timeout
- keyword font, pc_font
- keyword kbdmap, pc_kbd
- keyword display, pc_display
- keyword prompt, pc_prompt
- keyword label, pc_label
- keyword implicit, pc_implicit
- keyword kernel, pc_kernel
- keyword serial, pc_serial
- keyword say, pc_say
- keyword f1, pc_f1
- keyword f2, pc_f2
- keyword f3, pc_f3
- keyword f4, pc_f4
- keyword f5, pc_f5
- keyword f6, pc_f6
- keyword f7, pc_f7
- keyword f8, pc_f8
- keyword f9, pc_f9
- keyword f10, pc_f10
- keyword f0, pc_f10
- keyword localboot, pc_localboot
-
-keywd_count equ ($-keywd_table)/keywd_size
;
; Extensions to search for (in *forward* order).
@@ -1935,7 +1910,6 @@ img_table:
;
AppendLen dw 0 ; Bytes in append= command
KbdTimeOut dw 0 ; Keyboard timeout (if any)
-FKeyMap dw 0 ; Bitmap for F-keys loaded
CmdLinePtr dw cmd_line_here ; Command line advancing pointer
initrd_flag equ $
initrd_ptr dw 0 ; Initial ramdisk pointer/flag
diff --git a/keywords.inc b/keywords.inc
index 51551ef0..10255431 100644
--- a/keywords.inc
+++ b/keywords.inc
@@ -23,7 +23,56 @@
%macro keyword 2
dd hash_%1 ; Hash value
+ dw 0 ; No argument
dw %2 ; Entrypoint
%endmacro
-keywd_size equ 6 ; Bytes per keyword
+%macro keyword 3
+ dd hash_%1 ; Hash value
+ dw %3 ; 16-bit argument
+ dw %2 ; Entrypoint
+%endmacro
+
+%macro keyword 4
+ dd hash_%1 ; Hash value
+ db %3, %4 ; 2 8-bit arguments
+ dw %2 ; Entrypoint
+%endmacro
+
+keywd_size equ 8 ; Bytes per keyword
+
+ align 4, db 0
+
+keywd_table:
+ keyword append, pc_append
+ keyword default, pc_default
+ keyword display, pc_filecmd, get_msg_file
+ keyword font, pc_filecmd, loadfont
+ keyword implicit, pc_setint16, AllowImplicit
+ keyword kbdmap, pc_filecmd, loadkeys
+ keyword kernel, pc_kernel
+ keyword label, pc_label
+ keyword prompt, pc_setint16, ForcePrompt
+ keyword say, pc_say
+ keyword serial, pc_serial
+ keyword timeout, pc_timeout
+ keyword f1, pc_fkey, FKeyName+(0<<FILENAME_MAX_LG2)
+ keyword f2, pc_fkey, FKeyName+(1<<FILENAME_MAX_LG2)
+ keyword f3, pc_fkey, FKeyName+(2<<FILENAME_MAX_LG2)
+ keyword f4, pc_fkey, FKeyName+(3<<FILENAME_MAX_LG2)
+ keyword f5, pc_fkey, FKeyName+(4<<FILENAME_MAX_LG2)
+ keyword f6, pc_fkey, FKeyName+(5<<FILENAME_MAX_LG2)
+ keyword f7, pc_fkey, FKeyName+(6<<FILENAME_MAX_LG2)
+ keyword f8, pc_fkey, FKeyName+(7<<FILENAME_MAX_LG2)
+ keyword f9, pc_fkey, FKeyName+(8<<FILENAME_MAX_LG2)
+ keyword f10, pc_fkey, FKeyName+(9<<FILENAME_MAX_LG2)
+ keyword f0, pc_fkey, FKeyName+(9<<FILENAME_MAX_LG2)
+%if IS_PXELINUX
+ keyword ipappend, pc_ipappend
+%endif
+%if IS_PXELINUX || IS_ISOLINUX
+ keyword localboot, pc_localboot
+%endif
+
+keywd_count equ ($-keywd_table)/keywd_size
+
diff --git a/ldlinux.asm b/ldlinux.asm
index e46643a8..2a93985a 100644
--- a/ldlinux.asm
+++ b/ldlinux.asm
@@ -940,6 +940,13 @@ all_read:
;
; Now set up screen parameters
call adjust_screen
+
+ ; Wipe the F-key area
+ mov al,NULLFILE
+ mov di,FKeyName
+ mov cx,10*(1 << FILENAME_MAX_LG2)
+ rep stosb
+
;
; Now, everything is "up and running"... patch kaboom for more
; verbosity and using the full screen system
@@ -1092,21 +1099,19 @@ ctrl_f: push di
jmp short show_help
func_key:
+ ; AL = 0 if we get here
push di
cmp ah,68 ; F10
ja get_char_2
sub ah,59 ; F1
jb get_char_2
- shr ax,8
+ xchg al,ah
show_help: ; AX = func key # (0 = F1, 9 = F10)
- mov cl,al
- shl ax,4 ; Convert to x16
- mov bx,1
- shl bx,cl
- and bx,[FKeyMap]
- jz get_char_2 ; Undefined F-key
- mov di,ax
+ shl ax,FILENAME_MAX_LG2 ; Convert to pointer
+ xchg di,ax
add di,FKeyName
+ cmp byte [di],NULLFILE
+ je get_char_2 ; Undefined F-key
call searchdir
jz fk_nofile
push si
@@ -1673,35 +1678,6 @@ initrd_cmd_len equ 7
; Config file keyword table
;
%include "keywords.inc"
- align 2, db 0
-
-keywd_table:
- keyword append, pc_append
- keyword default, pc_default
- keyword timeout, pc_timeout
- keyword font, pc_font
- keyword kbdmap, pc_kbd
- keyword display, pc_display
- keyword prompt, pc_prompt
- keyword label, pc_label
- keyword implicit, pc_implicit
- keyword kernel, pc_kernel
- keyword serial, pc_serial
- keyword say, pc_say
- keyword f1, pc_f1
- keyword f2, pc_f2
- keyword f3, pc_f3
- keyword f4, pc_f4
- keyword f5, pc_f5
- keyword f6, pc_f6
- keyword f7, pc_f7
- keyword f8, pc_f8
- keyword f9, pc_f9
- keyword f10, pc_f10
- keyword f0, pc_f10
-
-keywd_count equ ($-keywd_table)/keywd_size
-
;
; Extensions to search for (in *reverse* order). Note that the last
; (lexically first) entry in the table is a placeholder for the original
@@ -1724,7 +1700,6 @@ debug_magic dw 0D00Dh ; Debug code sentinel
%endif
AppendLen dw 0 ; Bytes in append= command
KbdTimeOut dw 0 ; Keyboard timeout (if any)
-FKeyMap dw 0 ; Bitmap for F-keys loaded
CmdLinePtr dw cmd_line_here ; Command line advancing pointer
initrd_flag equ $
initrd_ptr dw 0 ; Initial ramdisk pointer/flag
diff --git a/parsecmd.inc b/parsecmd.inc
index f10e4f59..5639db93 100644
--- a/parsecmd.inc
+++ b/parsecmd.inc
@@ -57,7 +57,7 @@ getcommand:
lodsd
cmp ebx,eax
je .found_keywd
- lodsw ; Skip entrypoint
+ lodsd ; Skip entrypoint/argument
loop .table_search
; Otherwise unrecognized keyword
@@ -71,7 +71,8 @@ getcommand:
call cwritestr
jmp short .find
-.found_keywd: call near [si]
+.found_keywd: lodsw ; Load argument into ax
+ call near [si]
clc
ret
diff --git a/parseconfig.inc b/parseconfig.inc
index a46694a4..cee88df0 100644
--- a/parseconfig.inc
+++ b/parseconfig.inc
@@ -99,28 +99,34 @@ pc_timeout: call getint
.err: ret
;
-; "display" command
+; Generic integer variable setting commands:
+; "prompt", "implicit"
;
-pc_display: call pc_getfile
- jz .err ; File not found?
- call get_msg_file ; Load and display file
-.err: ret
-
-;
-; "prompt" command
-;
-pc_prompt: call getint
+pc_setint16:
+ push ax
+ call getint
+ pop si
jc .err
- mov [ForcePrompt],bx
+ mov [si],bx
.err: ret
;
-; "implicit" command
+; Generic file-processing commands:
+; "display", "font", "kbdmap"
;
-pc_implicit: call getint
- jc .err
- mov [AllowImplicit],bx
-.err: ret
+pc_filecmd: push ax ; Function to tailcall
+ mov di,trackbuf
+ push di
+ call getline
+ pop si
+ mov di,MNameBuf
+ push di
+ call mangle_name
+ pop di
+ call searchdir ; tailcall
+ jnz .ok
+ pop ax ; Drop the successor function
+.ok: ret ; Tailcall if OK, error return
;
; "serial" command
@@ -209,31 +215,12 @@ pc_serial: call getint
;
; "F"-key command
;
-; This relies on the fact that [si] points to the address of the entrypoint
-;
-pc_f1: nop
-pc_f2: nop
-pc_f3: nop
-pc_f4: nop
-pc_f5: nop
-pc_f6: nop
-pc_f7: nop
-pc_f8: nop
-pc_f9: nop
-pc_f10:
- mov cx,[si]
- sub cx,pc_f1
- push cx
- mov ax,1
- shl ax,cl
- or [FKeyMap], ax ; Mark that we have this loaded
+pc_fkey: push ax
mov di,trackbuf
push di
call getline ; Get filename to display
pop si
pop di
- shl di,FILENAME_MAX_LG2 ; Convert to offset
- add di,FKeyName
call mangle_name ; Mangle file name
ret
@@ -264,22 +251,6 @@ pc_label: call commit_vk ; Commit any current vkernel
ret
;
-; "font" command
-;
-pc_font: call pc_getfile ; "font" command
- jz .err ; File not found?
- call loadfont ; Load and install font
-.err: ret
-
-;
-; "kbd" command
-;
-pc_kbd: call pc_getfile ; "kbd" command
- jz .err
- call loadkeys
-.err: ret
-
-;
; "say" command
;
pc_say: mov di,trackbuf ; "say" command
@@ -292,20 +263,6 @@ pc_say: mov di,trackbuf ; "say" command
jmp crlf ; tailcall
;
-; pc_getfile: For command line options that take file argument, this
-; routine decodes the file argument and runs it through searchdir
-;
-pc_getfile: mov di,trackbuf
- push di
- call getline
- pop si
- mov di,MNameBuf
- push di
- call mangle_name
- pop di
- jmp searchdir ; tailcall
-
-;
; Main loop for configuration file parsing
;
parse_config:
diff --git a/pxelinux.asm b/pxelinux.asm
index 1986bc22..2c879252 100644
--- a/pxelinux.asm
+++ b/pxelinux.asm
@@ -289,6 +289,13 @@ _start1:
;
; Now set up screen parameters
call adjust_screen
+
+ ; Wipe the F-key area
+ mov al,NULLFILE
+ mov di,FKeyName
+ mov cx,10*(1 << FILENAME_MAX_LG2)
+ rep stosb
+
;
; Tell the user we got this far
;
@@ -835,21 +842,19 @@ ctrl_f: push di
jmp short show_help
func_key:
+ ; AL = 0 if we get here
push di
cmp ah,68 ; F10
ja get_char_2
sub ah,59 ; F1
jb get_char_2
- shr ax,8
+ xchg al,ah
show_help: ; AX = func key # (0 = F1, 9 = F10)
- mov cl,al
- shl ax,FILENAME_MAX_LG2 ; Convert to offset
- mov bx,1
- shl bx,cl
- and bx,[FKeyMap]
- jz get_char_2 ; Undefined F-key
- mov di,ax
+ shl ax,FILENAME_MAX_LG2 ; Convert to pointer
+ xchg di,ax
add di,FKeyName
+ cmp byte [di],NULLFILE
+ je get_char_2 ; Undefined F-key
call searchdir
jz fk_nofile
push si
@@ -2306,36 +2311,6 @@ initrd_cmd_len equ 7
; Config file keyword table
;
%include "keywords.inc"
- align 2, db 0
-
-keywd_table:
- keyword append, pc_append
- keyword default, pc_default
- keyword timeout, pc_timeout
- keyword font, pc_font
- keyword kbdmap, pc_kbd
- keyword display, pc_display
- keyword prompt, pc_prompt
- keyword label, pc_label
- keyword implicit, pc_implicit
- keyword kernel, pc_kernel
- keyword serial, pc_serial
- keyword say, pc_say
- keyword f1, pc_f1
- keyword f2, pc_f2
- keyword f3, pc_f3
- keyword f4, pc_f4
- keyword f5, pc_f5
- keyword f6, pc_f6
- keyword f7, pc_f7
- keyword f8, pc_f8
- keyword f9, pc_f9
- keyword f10, pc_f10
- keyword f0, pc_f10
- keyword ipappend, pc_ipappend
- keyword localboot, pc_localboot
-
-keywd_count equ ($-keywd_table)/keywd_size
;
; Extensions to search for (in *forward* order).
@@ -2415,7 +2390,6 @@ pxe_undi_shutdown_pkt:
;
AppendLen dw 0 ; Bytes in append= command
KbdTimeOut dw 0 ; Keyboard timeout (if any)
-FKeyMap dw 0 ; Bitmap for F-keys loaded
CmdLinePtr dw cmd_line_here ; Command line advancing pointer
initrd_flag equ $
initrd_ptr dw 0 ; Initial ramdisk pointer/flag