1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
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
; -----------------------------------------------------------------------------
|