file_sector resd 1 ; Next linear sector to read
file_in_sec resd 1 ; Sector where inode lives
file_in_off resw 1
- resw 1
+file_mode resw 1
endstruc
%ifndef DEPEND
call getcachesector
add si,dx
+ mov ax,[gs:si+i_mode]
+ mov [bx+file_mode],ax
mov eax,[gs:si+i_size]
push eax
add eax,SECTOR_SIZE-1
; Assumes CS == DS == ES; *** IS THIS CORRECT ***?
;
searchdir:
+ push bx
+ push cx
+ push di
mov eax,[CurrentDir]
.leadingslash:
cmp byte [di],'/' ; Absolute filename?
je .endblock
push di
- push si
- mov cx,[bx+d_name_len]
+ movzx cx,byte [bx+d_name_len]
lea si,[bx+d_name]
repe cmpsb
- pop si
je .maybe
.nope:
pop di
jnc .readdir ; There is more
.failure:
xor eax,eax
- ret
+ jmp .done
.maybe:
- mov eax,[si+d_inode]
+ mov eax,[bx+d_inode]
cmp byte [di],0
je .finish ; It's a real file; done
pop si ; Adjust stack (di)
pop si ; Adjust stack (flags)
call open_inode
+.done:
+ pop di
+ pop cx
+ pop bx
ret
;
getfssec:
push ebp
push eax
- push ebx
push edx
.getfragment:
- mov eax,[si] ; Current start index
+ mov eax,[si+file_sector] ; Current start index
+ push ebx ; Buffer pointer
mov ebx,eax
call linsector
push eax ; Fragment start sector
je .getseccnt
.do_read:
pop eax ; Linear start sector
+ pop ebx ; Buffer pointer
call getlinsecsr
- lea eax,[eax+ebp-1] ; This is the last sector actually read
+ push bp
shl bp,9
add bx,bp ; Adjust buffer pointer
- call linsector
- jc .eof
- mov edx,eax
- and cx,cx
- jnz .getfragment
+ pop bp
+ sub cx,bp
+ add [si+file_sector],ebp ; Next sector index
+ sub [si],ebp ; Sectors consumed
+ jz .done
+ jcxz .done
+ jmp .getfragment
.done:
+ cmp dword [si],1 ; Did we run out of file?
+ ; CF set if [SI] < 1, i.e. == 0
pop edx
- pop ebx
pop eax
pop ebp
ret
-.eof:
- xor edx,edx
- stc
- jmp .done
-
-
; -----------------------------------------------------------------------------
; Common modules
crlf_msg db CR, LF
null_msg db 0
crff_msg db CR, FF, 0
-ConfigName db 'extlinux.cfg',0 ; Unmangled form
+ConfigName db 'extlinux.conf',0 ; Unmangled form
;
; Command line options we'd like to take a look at
static const struct geometry geometries[] =
{
- { 720, 40, 2, 9, 0, 0x01, 0 }, /* 360 K */
- { 1440, 80, 2, 9, 0, 0x03, 0 }, /* 720 K*/
- { 2400, 80, 2, 15, 0, 0x02, 0 }, /* 1200 K */
- { 2880, 80, 2, 18, 0, 0x04, 0 }, /* 1440 K */
- { 1680, 80, 2, 21, 0, 0x04, 0 }, /* 1680 K */
- { 1722, 82, 2, 21, 0, 0x04, 0 }, /* 1722 K */
- { 5760, 80, 2, 36, 0, 0x06, 0 }, /* 2880 K */
+ { 360*2, 40, 2, 9, 0, 0x01, 0 }, /* 360 K */
+ { 720*2, 80, 2, 9, 0, 0x03, 0 }, /* 720 K*/
+ { 1200*2, 80, 2, 15, 0, 0x02, 0 }, /* 1200 K */
+ { 1440*2, 80, 2, 18, 0, 0x04, 0 }, /* 1440 K */
+ { 1680*2, 80, 2, 21, 0, 0x04, 0 }, /* 1680 K */
+ { 1722*2, 82, 2, 21, 0, 0x04, 0 }, /* 1722 K */
+ { 2880*2, 80, 2, 36, 0, 0x06, 0 }, /* 2880 K */
+ { 3840*2, 80, 2, 48, 0, 0x06, 0 }, /* 3840 K */
};
#define known_geometries (sizeof(geometries)/sizeof(struct geometry))