Gene Cumm
2008-Nov-03 01:25 UTC
[syslinux] [PATCH 1/1] COMBOOT: add get config file full name
From: Gene Cumm <gene.cumm at gmail.com> COMBOOT API: Add get config full file name to SYSLINUX Signed-off-by: Gene Cumm <gene.cumm at gmail.com> --- Returns the full configuration file name. Int 22h AX 001Eh for now as it appears that the COMBOOT API is designed to be strictly sequential. The API gets extended but only implemented (for now) for SYSLINUX in ldlinux.asm. Implementation and documentation are derived from Int 22h AX 000Eh. There may be a way to be more efficient (with the push/pop on either side of the call to open in order to preserve the current di value) however I'm not sure what registers are available and utilizing the stack would require changes in all variants. diff --git a/core/comboot.inc b/core/comboot.inc index 810d825..22757e7 100644 --- a/core/comboot.inc +++ b/core/comboot.inc @@ -1033,6 +1033,18 @@ comapi_getadv: ; comapi_writeadv equ adv_write +; +; INT 22h AX=001Eh Get full name of config file +; +%if IS_SYSLINUX +comapi_configfilefull mov P_ES,cs + mov P_BX,ConfigNameFull + clc + ret +%else +comapi_configfilefull equ comapi_err +%endif + section .data %macro int21 2 @@ -1085,6 +1097,7 @@ int22_table: dw comapi_shufflerm ; 001B cleanup, shuffle and boot to rm dw comapi_getadv ; 001C get pointer to ADV dw comapi_writeadv ; 001D write ADV to disk + dw comapi_configfilefull ; 001E get full name of config f int22_count equ ($-int22_table)/2 APIKeyWait db 0 @@ -1109,3 +1122,4 @@ err_comlarge db 'COMBOOT image too large.', CR, LF, 0 alignb 4 DOSErrTramp resd 33 ; Error trampolines ConfigName resb FILENAME_MAX +ConfigNameFull resb FILENAME_MAX ; Can't find a better length definition diff --git a/core/ldlinux.asm b/core/ldlinux.asm index c7f6577..859a52e 100644 --- a/core/ldlinux.asm +++ b/core/ldlinux.asm @@ -904,15 +904,26 @@ getfattype: mov eax,[RootDir] ; Make the root directory ... mov [CurrentDir],eax ; ... the current directory mov di,syslinux_cfg1 + push di call open + pop di jnz .config_open mov di,syslinux_cfg2 + push di call open + pop di jnz .config_open mov di,syslinux_cfg3 + push di call open + pop di jz no_config_file .config_open: + push si + mov si,di + mov di,ConfigNameFull + call strcpy + pop si mov eax,[PrevDir] ; Make the directory with syslinux.cfg . mov [CurrentDir],eax ; ... the current directory diff --git a/doc/comboot.txt b/doc/comboot.txt index ceee93a..ed63e60 100644 --- a/doc/comboot.txt +++ b/doc/comboot.txt @@ -908,3 +908,11 @@ AX=001Dh [3.60] Write auxilliary data vector In a future version, PXELINUX may end up attempting to save the ADV on the server via TFTP write. + + +AX=001Eh [BETA] Get configuration file full name + Input: AX 0000Eh + Output: ES:BX null-terminated file name string + + Returns the full name of the configuration file. Note that it is + possible that the configuration file doesn't actually exist.
H. Peter Anvin
2008-Nov-03 04:25 UTC
[syslinux] [PATCH 1/1] COMBOOT: add get config file full name
Gene Cumm wrote:> > Returns the full configuration file name. Int 22h AX 001Eh for now as > it appears that the COMBOOT API is designed to be strictly sequential. > The API gets extended but only implemented (for now) for SYSLINUX in > ldlinux.asm. Implementation and documentation are derived from Int > 22h AX 000Eh. > > There may be a way to be more efficient (with the push/pop on either > side of the call to open in order to preserve the current di value) > however I'm not sure what registers are available and utilizing the > stack would require changes in all variants.I think we can just have 000Eh return the full configuration file name. The important thing, of course, is that the filename is valid. As far as registers, it's probably easier to simply push/pop di around the call to searchdir in getc.inc. I have been trying to clean up the register conventions more in the core. -hpa
Reasonably Related Threads
- [PATCH 1/1] COMBOOT API: Add get current working directory call to most
- [PATCH 1/1] COMBOOT API: Add calls for directory functions; Implement for FAT
- [PATCH 1/1] COMBOOT API: Add calls for directory functions; Implement for FAT; Try 2
- ldlinux: CurrentDir not set if syslinux.cfg is missing
- [PATCH] comboot: add comapi_chainboot to int22_table