summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhpa <hpa>2005-01-25 07:15:21 +0000
committerhpa <hpa>2005-01-25 07:15:21 +0000
commitd1482bb9a8bb2b04c9014db351aad21a5d0e21e8 (patch)
tree36201f9eac48a3243afdf2e8772ccad7f16f2332
parentb05ac381604932345c7ddc61008db021b66749d9 (diff)
downloadsyslinux-d1482bb9a8bb2b04c9014db351aad21a5d0e21e8.tar.gz
extlinux: handle sparse files correctly
-rw-r--r--cache.inc4
-rw-r--r--extlinux.asm35
2 files changed, 37 insertions, 2 deletions
diff --git a/cache.inc b/cache.inc
index 1da7c8fb..c2472abb 100644
--- a/cache.inc
+++ b/cache.inc
@@ -59,7 +59,11 @@ getcachesector:
shl bx,SECTOR_SHIFT-2
mov si,bx
pushad
+%if IS_EXTLINUX
+ call getonesec_ext
+%else
call getonesec
+%endif
popad
pop es
pop bx
diff --git a/extlinux.asm b/extlinux.asm
index 78496bd5..4de79922 100644
--- a/extlinux.asm
+++ b/extlinux.asm
@@ -842,6 +842,36 @@ load_config:
;
%include "bootsect.inc"
+
+;
+; getlinsec_ext: same as getlinsec, except load any sector from the zero
+; block as all zeros; use to load any data derived
+; from an ext2 block pointer, i.e. anything *except the
+; superblock.*
+;
+getonesec_ext:
+ mov bp,1
+
+getlinsec_ext:
+ cmp eax,[ClustSize]
+ jae getlinsec ; Nothing fancy
+
+ ; If we get here, at least part of what we want is in the
+ ; zero block. Zero one sector at a time and loop.
+ push eax
+ push cx
+ xchg di,bx
+ xor eax,eax
+ mov cx,SECTOR_SIZE >> 2
+ rep stosd
+ xchg di,bx
+ pop cx
+ pop eax
+ inc eax
+ dec bp
+ jnz getlinsec_ext
+ ret
+
;
; abort_check: let the user abort with <ESC> or <Ctrl-C>
;
@@ -1080,7 +1110,6 @@ searchdir:
pop cx
pop bx
ret
-
;
; mangle_name: Mangle a filename pointed to by DS:SI into a buffer pointed
; to by ES:DI; ends on encountering any whitespace.
@@ -1331,7 +1360,9 @@ getfssec:
je .getseccnt
.do_read:
pop eax ; Linear start sector
- call getlinsecsr
+ pushad
+ call getlinsec_ext
+ popad
push bp
shl bp,9
add bx,bp ; Adjust buffer pointer