diff options
-rw-r--r-- | comboot.inc | 7 | ||||
-rw-r--r-- | conio.inc | 2 | ||||
-rw-r--r-- | extlinux.asm | 9 | ||||
-rw-r--r-- | isolinux.asm | 12 | ||||
-rw-r--r-- | ldlinux.asm | 9 | ||||
-rw-r--r-- | parseconfig.inc | 4 | ||||
-rw-r--r-- | pxelinux.asm | 51 | ||||
-rw-r--r-- | ui.inc | 5 |
8 files changed, 55 insertions, 44 deletions
diff --git a/comboot.inc b/comboot.inc index 01a18240..5ea648f4 100644 --- a/comboot.inc +++ b/comboot.inc @@ -404,9 +404,7 @@ comapi_open: mov ds,P_ES mov si,P_SI mov di,InitRD - push di call mangle_name - pop di pop ds call searchdir jz comapi_err @@ -687,9 +685,7 @@ comapi_runkernel: mov ds,P_DS mov si,P_SI mov di,KernelName - push di call mangle_name - pop di pop ds call searchdir jz comapi_err @@ -865,3 +861,6 @@ feature_flags: db 2 ; No local boot, idle is noop %endif feature_flags_len equ ($-feature_flags) + + section .latebss +ConfigName resb FILENAME_MAX @@ -228,9 +228,7 @@ msg_viewimage: mov byte [si],0 ; Zero-terminate filename mov si,VGAFileBuf mov di,VGAFileMBuf - push di call mangle_name - pop di call searchdir pop es jz msg_putcharnext ; Not there diff --git a/extlinux.asm b/extlinux.asm index e4628478..eb55dab9 100644 --- a/extlinux.asm +++ b/extlinux.asm @@ -841,7 +841,11 @@ expand_super: ; Load configuration file ; load_config: + mov si,config_name ; Save config file name mov di,ConfigName + call strcpy + + mov si,ConfigName call open jz no_config_file @@ -1254,6 +1258,7 @@ SymlinkCtr resb 1 ; ; mangle_name: Mangle a filename pointed to by DS:SI into a buffer pointed ; to by ES:DI; ends on encountering any whitespace. +; DI is preserved. ; ; This verifies that a filename is < FILENAME_MAX characters, ; doesn't contain whitespace, zero-pads the output buffer, @@ -1265,6 +1270,7 @@ SymlinkCtr resb 1 ; be the place.) ; mangle_name: + push di push bx xor ax,ax mov cx,FILENAME_MAX-1 @@ -1295,6 +1301,7 @@ mangle_name: xor ax,ax ; Zero-fill name rep stosb pop bx + pop di ret ; Done ; @@ -1570,7 +1577,7 @@ aborted_msg db ' aborted.' ; Fall through to crlf_msg! crlf_msg db CR, LF null_msg db 0 crff_msg db CR, FF, 0 -ConfigName db 'extlinux.conf',0 ; Unmangled form +config_name db 'extlinux.conf',0 ; Unmangled form ; ; Command line options we'd like to take a look at diff --git a/isolinux.asm b/isolinux.asm index 35827f14..c36c2bcd 100644 --- a/isolinux.asm +++ b/isolinux.asm @@ -925,7 +925,11 @@ load_config: call writemsg %endif - mov di,isolinux_cfg + mov si,config_name + mov di,ConfigName + call strcpy + + mov di,ConfigName call open jz no_config_file ; Not found or empty @@ -1353,6 +1357,7 @@ iso_compare_names: ; ; mangle_name: Mangle a filename pointed to by DS:SI into a buffer pointed ; to by ES:DI; ends on encountering any whitespace. +; DI is preserved. ; ; This verifies that a filename is < FILENAME_MAX characters, ; doesn't contain whitespace, zero-pads the output buffer, @@ -1361,6 +1366,7 @@ iso_compare_names: ; path-searching routine gets a bit of an easier job. ; mangle_name: + push di push bx xor ax,ax mov cx,FILENAME_MAX-1 @@ -1393,6 +1399,7 @@ mangle_name: xor ax,ax ; Zero-fill name rep stosb pop bx + pop di ret ; Done ; @@ -1522,8 +1529,7 @@ default_str db 'default', 0 default_len equ ($-default_str) boot_dir db '/boot' ; /boot/isolinux isolinux_dir db '/isolinux', 0 -ConfigName equ $ -isolinux_cfg db 'isolinux.cfg', 0 +config_name db 'isolinux.cfg', 0 err_disk_image db 'Cannot load disk image (invalid file)?', CR, LF, 0 %ifdef DEBUG_MESSAGES diff --git a/ldlinux.asm b/ldlinux.asm index 69259247..fda4fb9a 100644 --- a/ldlinux.asm +++ b/ldlinux.asm @@ -896,6 +896,10 @@ getfattype: ; ; Load configuration file ; + mov si,config_name ; Save configuration file name + mov di,ConfigName + call strcpy + mov di,syslinux_cfg1 call open jnz .config_open @@ -1156,6 +1160,7 @@ kaboom2: ; ; mangle_name: Mangle a filename pointed to by DS:SI into a buffer pointed ; to by ES:DI; ends on encountering any whitespace. +; DI is preserved. ; ; This verifies that a filename is < FILENAME_MAX characters, ; doesn't contain whitespace, zero-pads the output buffer, @@ -1166,6 +1171,7 @@ kaboom2: ; ; mangle_name: + push di push bx xor ax,ax mov cx,FILENAME_MAX-1 @@ -1202,6 +1208,7 @@ mangle_name: xor ax,ax ; Zero-fill name rep stosb pop bx + pop di ret ; Done ; @@ -1584,7 +1591,7 @@ crff_msg db CR, FF, 0 syslinux_cfg1 db '/boot' ; /boot/syslinux/syslinux.cfg syslinux_cfg2 db '/syslinux' ; /syslinux/syslinux.cfg syslinux_cfg3 db '/' ; /syslinux.cfg -ConfigName db 'syslinux.cfg', 0 ; syslinux.cfg +config_name db 'syslinux.cfg', 0 ; syslinux.cfg ; ; Command line options we'd like to take a look at diff --git a/parseconfig.inc b/parseconfig.inc index dd7e7b00..987ed2a5 100644 --- a/parseconfig.inc +++ b/parseconfig.inc @@ -150,9 +150,7 @@ pc_setint16: pc_filecmd: push ax ; Function to tailcall call pc_getline mov di,MNameBuf - push di call mangle_name - pop di call searchdir ; tailcall jnz .ok pop ax ; Drop the successor function @@ -291,7 +289,7 @@ pc_label: call commit_vk ; Commit any current vkernel call mangle_name ; Mangle virtual name mov byte [VKernel],1 ; We've seen a "label" statement mov si,VKernelBuf+vk_vname ; By default, rname == vname - mov di,VKernelBuf+vk_rname + ; mov di,VKernelBuf+vk_rname ; -- already set mov cx,FILENAME_MAX rep movsb mov si,AppendBuf ; Default append==global append diff --git a/pxelinux.asm b/pxelinux.asm index 6f99b324..1dd6afff 100644 --- a/pxelinux.asm +++ b/pxelinux.asm @@ -187,8 +187,6 @@ Files resb MAX_OPEN*open_file_t_size alignb FILENAME_MAX BootFile resb 256 ; Boot file from DHCP packet -ConfigServer resd 1 ; Null prefix for mangled config name -ConfigName resb 256-4 ; Configuration file from DHCP option PathPrefix resb 256 ; Path prefix derived from boot file DotQuadBuf resb 16 ; Buffer for dotted-quad IP address IPOption resb 80 ; ip= option buffer @@ -755,22 +753,11 @@ find_config: ; Begin looking for configuration file ; config_scan: - mov di,ConfigServer - xor eax,eax - stosd ; The config file is always from the server - test byte [DHCPMagic], 02h jz .no_option ; We got a DHCP option, try it first - mov si,trying_msg - call writestr - ; mov di,ConfigName ; - already the case - mov si,di - call writestr - call crlf - mov di,ConfigServer - call open + call .try jnz .success .no_option: @@ -785,14 +772,7 @@ config_scan: mov si,MACStr mov cx,(3*17+1)/2 rep movsw - mov si,trying_msg - call writestr - mov di,ConfigName - mov si,di - call writestr - call crlf - mov di,ConfigServer - call open + call .try pop di jnz .success @@ -824,23 +804,31 @@ config_scan: mov cx,default_len rep movsb ; Copy "default" string popa -.not_default: pusha +.not_default: + call .try + jnz .success + dec di + loop .tryagain + + mov si,err_noconfig + call writestr + jmp kaboom + +.try: + pusha mov si,trying_msg call writestr mov di,ConfigName mov si,di call writestr call crlf - mov di,ConfigServer + mov si,di + mov di,getcbuf + call mangle_name call open popa - jnz .success - dec di - loop .tryagain + ret - mov si,err_noconfig - call writestr - jmp kaboom .success: @@ -1454,6 +1442,7 @@ parse_dotquad: ; ; mangle_name: Mangle a filename pointed to by DS:SI into a buffer pointed ; to by ES:DI; ends on encountering any whitespace. +; DI is preserved. ; ; This verifies that a filename is < FILENAME_MAX characters ; and doesn't contain whitespace, and zero-pads the output buffer, @@ -1463,6 +1452,7 @@ parse_dotquad: ; the download host. ; mangle_name: + push di push si mov eax,[ServerIP] cmp byte [si],0 @@ -1520,6 +1510,7 @@ mangle_name: inc cx ; At least one null byte xor ax,ax ; Zero-fill name rep stosb ; Doesn't do anything if CX=0 + pop di ret ; Done ; @@ -532,6 +532,11 @@ is_unknown_filetype: jmp is_linux_kernel is_config_file: + pusha + mov si,KernelCName ; Save the config file name, for posterity + mov di,ConfigName + call strcpy + popa call openfd call reset_config jmp load_config_file |