summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-06-22 19:10:53 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-06-22 19:10:53 -0700
commit547c6d204612410e1208dc1a16135809b9e4daca (patch)
tree9ad7472d2494733f75c2f27cfaf276f49582f4d5
parent606a6a44d7266c8797baee2f4d7fdc09f068ddd4 (diff)
downloadsyslinux-547c6d204612410e1208dc1a16135809b9e4daca.tar.gz
extlinux: fix the end of file condition
We would incorrectly not set SI=0 when returning from getfssec upon end of file. Fix this.
-rw-r--r--core/extlinux.asm14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/extlinux.asm b/core/extlinux.asm
index c4165415..838f718c 100644
--- a/core/extlinux.asm
+++ b/core/extlinux.asm
@@ -1503,13 +1503,13 @@ getfssec:
.done:
pop ecx ; Sectors requested read
shl ecx,SECTOR_SHIFT
- cmp ecx,[si+file_bytesleft]
- jb .noteof
- mov ecx,[si+file_bytesleft]
-.noteof: sub [si+file_bytesleft],ecx
- ; Did we run out of file?
- cmp dword [si+file_bytesleft],1
- ; CF set if [SI] < 1, i.e. == 0
+ sub [si+file_bytesleft],ecx
+ jnbe .noteof ; CF=0 in this case
+ add ecx,[si+file_bytesleft] ; Actual number of bytes left
+ sub [si+file_bytesleft],ecx ; ... all read
+ xor si,si ; File closed
+ stc ; We hit EOF
+.noteof:
pop edi
pop edx
pop eax