isolinux: don't clobber bp in getfssec syslinux-3.70-pre26
authorH. Peter Anvin <hpa@zytor.com>
Fri, 27 Jun 2008 01:50:22 +0000 (18:50 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 27 Jun 2008 01:50:22 +0000 (18:50 -0700)
The comapi functions get very unhappy if bp is ever clobbered, since
it uses bp as a frame pointer.

core/isolinux.asm

index fb91a9e..5452012 100644 (file)
@@ -1397,7 +1397,6 @@ unmangle_name:    call strcpy
 ;
 getfssec:
                TRACER 'F'
-
                push ds
                push cs
                pop ds                          ; DS <- CS
@@ -1406,32 +1405,24 @@ getfssec:
                cmp ecx,[si+file_left]
                jna .ok_size
                mov ecx,[si+file_left]
-
 .ok_size:
-               mov bp,cx
-               push cx
-               push si
+
+               pushad
                mov eax,[si+file_sector]
+               mov bp,cx
                TRACER 'l'
                call getlinsec
-               xor ecx,ecx
-               pop si
-               pop cx
+               popad
 
+               ; ECX[31:16] == 0 here...
                add [si+file_sector],ecx
                sub [si+file_left],ecx
-               ja .not_eof                     ; CF = 0
-               stc
-
-.not_eof:
-               pushf
                shl ecx,SECTOR_SHIFT            ; Convert to bytes
                cmp ecx,[si+file_bytesleft]
                jb .not_all
                mov ecx,[si+file_bytesleft]
 .not_all:      sub [si+file_bytesleft],ecx
-               popf
-               jnc .ret
+               jnz .ret                        ; CF = 0 in this case...
                push eax
                xor eax,eax
                mov [si+file_sector],eax        ; Unused