syslinux/syslinux-3.86-gfxboot.diff

284 lines
6.0 KiB
Diff

diff --git a/core/isolinux.asm b/core/isolinux.asm
index 23429bd..54f2e19 100644
--- a/core/isolinux.asm
+++ b/core/isolinux.asm
@@ -1135,73 +1135,23 @@ all_read:
; (which will be at 16 only for a single-session disk!); from the PVD
; we should be able to find the rest of what we need to know.
;
-get_fs_structures:
- mov eax,[bi_pvd]
- mov bx,trackbuf
- call getonesec
-
- mov eax,[trackbuf+156+2]
- mov [RootDir+dir_lba],eax
- mov [CurrentDir+dir_lba],eax
-%ifdef DEBUG_MESSAGES
- mov si,dbg_rootdir_msg
- call writemsg
- call writehex8
- call crlf
-%endif
- mov eax,[trackbuf+156+10]
- mov [RootDir+dir_len],eax
- mov [CurrentDir+dir_len],eax
- add eax,SECTOR_SIZE-1
- shr eax,SECTOR_SHIFT
- mov [RootDir+dir_clust],eax
- mov [CurrentDir+dir_clust],eax
-
- ; Look for an isolinux directory, and if found,
- ; make it the current directory instead of the root
- ; directory.
- ; Also copy the name of the directory to CurrentDirName
- mov word [CurrentDirName],ROOT_DIR_WORD ; Write '/',0 to the CurrentDirName
+ call iso_mount
mov di,boot_dir ; Search for /boot/isolinux
- mov al,02h
- push di
- call searchdir_iso
- pop di
- jnz .found_dir
- mov di,isolinux_dir
- mov al,02h ; Search for /isolinux
- push di
- call searchdir_iso
- pop di
- jz .no_isolinux_dir
+ call setcwd
+ jnc .found_dir
+ mov di,isolinux_dir ; Search for /isolinux
+ call setcwd
.found_dir:
- ; Copy current directory name to CurrentDirName
- push si
- push di
- mov si,di
- mov di,CurrentDirName
- call strcpy
- mov byte [di],0 ;done in case it's not word aligned
- dec di
- mov byte [di],'/'
- pop di
- pop si
- mov [CurrentDir+dir_len],eax
- mov eax,[si+file_left]
- mov [CurrentDir+dir_clust],eax
- xor eax,eax ; Free this file pointer entry
- xchg eax,[si+file_sector]
- mov [CurrentDir+dir_lba],eax
%ifdef DEBUG_MESSAGES
push si
mov si,dbg_isodir_msg
call writemsg
pop si
+ mov eax,[CurrentDir+dir_lba]
call writehex8
call crlf
%endif
-.no_isolinux_dir:
;
; Locate the configuration file
@@ -1706,6 +1656,90 @@ getfssec:
TRACER 'f'
ret
+;
+; setcwd: Set current working directory.
+;
+; On entry:
+; DI -> directory name
+; On exit:
+; CF = 1 -> error
+;
+; On error, the old working directory is kept.
+;
+setcwd:
+ mov al,02h
+ push di
+ call searchdir_iso
+ pop di
+ stc
+ jz .err
+ mov [CurrentDir+dir_len],eax
+ mov eax,[si+file_left]
+ mov [CurrentDir+dir_clust],eax
+ xor eax,eax
+ xchg eax,[si+file_sector]
+ mov [CurrentDir+dir_lba],eax
+ mov si,di
+ mov di,CurrentDirName
+ cmp si,di
+ jz .ok
+ mov cx,FILENAME_MAX
+ push ds
+ pop es
+.copy:
+ lodsb
+ stosb
+ or al,al
+ loopnz .copy
+ mov byte [di-1],0
+ jnz .err
+.ok:
+ clc
+.err:
+ ret
+
+;
+; Read fs meta data and setup RootDir and CurrentDir.
+;
+; On exit:
+; CF = 1 -> error
+;
+iso_mount:
+ mov eax,[bi_pvd]
+ mov bx,trackbuf
+ call getonesec
+
+ mov eax,[trackbuf+156+10]
+ mov [RootDir+dir_len],eax
+ add eax,SECTOR_SIZE-1
+ shr eax,SECTOR_SHIFT
+ mov [RootDir+dir_clust],eax
+ mov eax,[trackbuf+156+2]
+ mov [RootDir+dir_lba],eax
+
+ push ds
+ pop es
+ mov si,RootDir
+ mov di,CurrentDir
+ mov cx,dir_t_size
+ rep movsb
+
+%ifdef DEBUG_MESSAGES
+ mov si,dbg_rootdir_msg
+ call writemsg
+ call writehex8
+ call crlf
+%endif
+
+ mov di,CurrentDirName
+ call setcwd
+ jnc .ok
+ mov word [CurrentDirName],ROOT_DIR_WORD
+.ok:
+ clc
+ ret
+
+
; -----------------------------------------------------------------------------
; Common modules
; -----------------------------------------------------------------------------
diff --git a/core/comboot.inc b/core/comboot.inc
index f8a7853..37bd0f2 100644
--- a/core/comboot.inc
+++ b/core/comboot.inc
@@ -970,6 +970,45 @@ comapi_shufraw:
mov ecx,P_ECX
jmp shuffle_and_boot_raw
+
+;
+; INT 22h AX=0025h Set current working directory
+;
+%if IS_ISOLINUX
+comapi_setcwd:
+ mov si,P_BX
+ mov di,TmpDirName
+ mov cx,FILENAME_MAX
+ mov ds,P_ES
+.copy:
+ lodsb
+ stosb
+ or al,al
+ loopnz .copy
+ push cs
+ pop ds
+ stc
+ jnz .err
+ mov di,TmpDirName
+ call setcwd
+.err:
+ ret
+%else
+comapi_setcwd equ comapi_err
+%endif
+
+
+;
+; INT 22h AX=0026h Read filesystem meta data
+;
+%if IS_ISOLINUX
+comapi_mount:
+; call iso_mount
+ ret
+%else
+comapi_mount equ comapi_err
+%endif
+
section .data
%macro int21 2
@@ -1029,6 +1068,8 @@ int22_table:
dw comapi_closedir ; 0022 close directory
dw comapi_shufsize ; 0023 query shuffler size
dw comapi_shufraw ; 0024 cleanup, shuffle and boot raw
+ dw comapi_setcwd ; 0025 set current working directory
+ dw comapi_mount ; 0026 read fs structures (aka mount)
int22_count equ ($-int22_table)/2
APIKeyWait db 0
@@ -1049,8 +1090,9 @@ feature_flags_len equ ($-feature_flags)
err_notdos db ': attempted DOS system call INT ',0
err_comlarge db 'COMBOOT image too large.', CR, LF, 0
- section .bss1
+ section .bss2
alignb 4
DOSErrTramp resd 33 ; Error trampolines
+TmpDirName resb FILENAME_MAX
ConfigName resb FILENAME_MAX
CurrentDirName resb FILENAME_MAX
diff --git a/doc/comboot.txt b/doc/comboot.txt
index eb43708..13d18f6 100644
--- a/doc/comboot.txt
+++ b/doc/comboot.txt
@@ -949,3 +949,20 @@ AX=0024h [3.80] Cleanup, shuffle and boot, raw version
with read/write data segments, matching the respective code
segment. For mode 0, B=0 and the limits will be 64K, for mode
1, B=1 and the limits will be 4 GB.
+
+
+AX=0025h [3.84] Set current working directory
+ Input: AX 00025h
+ ES:BX null-terminated directory name string
+ Output: None
+
+ Sets the current working directory. For SYSLINUX, ISOLINUX,
+ and PXELINUX, this will be an absolute path.
+
+
+AX=0026h [3.84] Read file system metadata [ISOLINUX]
+ Input: AX 00026h
+ Output: None
+
+ Reads filesystem data (e.g. after a CDROM change).
+
diff --git a/modules/Makefile b/modules/Makefile
index 77020ea..f318364 100644
--- a/modules/Makefile
+++ b/modules/Makefile
@@ -19,7 +19,7 @@ include $(topdir)/MCONFIG.embedded
INCLUDES = -I$(com32)/include
-BINS = pxechain.com gfxboot.com poweroff.com int18.com
+BINS = pxechain.com poweroff.com int18.com
all: $(BINS)