Register-handling cleanups for searchdir.
authorhpa <hpa>
Mon, 22 Aug 2005 15:59:12 +0000 (15:59 +0000)
committerhpa <hpa>
Mon, 22 Aug 2005 15:59:12 +0000 (15:59 +0000)
extlinux.asm
isolinux.asm
ldlinux.asm
pxelinux.asm

index d291c2c..a0bd41f 100644 (file)
@@ -1065,7 +1065,6 @@ close:
 searchdir:
                push bx
                push cx
-               push di
                push bp
                mov byte [SymlinkCtr],MAX_SYMLINKS
 
@@ -1111,7 +1110,6 @@ searchdir:
 .done:
                and eax,eax             ; Set/clear ZF
                pop bp
-               pop di
                pop cx
                pop bx
                ret
index 50f4117..d1697d6 100644 (file)
@@ -1173,17 +1173,19 @@ local_boot:
 ; to the above, searchdir_iso passes a file flag mask in AL.  This is useful
 ; for searching for directories.
 ;
-alloc_failure:
+searchdir_iso.alloc_failure:
                xor ax,ax                       ; ZF <- 1
-               ret
+               jmp searchdir_iso.ret
 
 searchdir:
                xor al,al
 searchdir_iso:
+               push bx
+               push cx
                mov [ISOFlags],al
                TRACER 'S'
                call allocate_file              ; Temporary file structure for directory
-               jnz alloc_failure
+               jnz .alloc_failure
                push es
                push ds
                pop es                          ; ES = DS
@@ -1268,8 +1270,7 @@ searchdir_iso:
 
 .failure:      xor eax,eax                     ; ZF = 1
                mov [bx+file_sector],eax
-               pop es
-               ret
+               jmp .ret
 
 .success:
                mov eax,[si+2]                  ; Location of extent
@@ -1284,7 +1285,10 @@ searchdir_iso:
                shr edx,16
                and bx,bx                       ; ZF = 0
                mov si,bx
+.ret:
                pop es
+               pop cx
+               pop bx
                ret
 
 .resume:       ; We get here if we were only doing part of a lookup
index df850ed..00ba61e 100644 (file)
@@ -976,9 +976,11 @@ allocate_file:
 ;
 
 searchdir:
+               push bx
                call allocate_file
                jnz .alloc_failure
 
+               push cx
                push gs
                push es
                push ds
@@ -1013,8 +1015,10 @@ searchdir:
 .failure:
                pop es
                pop gs
+               pop cx
 .alloc_failure:
-               xor ax,ax                       ; ZF <- 1
+               pop bx
+               xor eax,eax                     ; ZF <- 1
                ret
 .found:
                mov eax,[gs:si+28]              ; File size
@@ -1039,6 +1043,8 @@ searchdir:
 
                pop es
                pop gs
+               pop cx
+               pop bx
                ret
 
 ;
index 331a84e..f2b542b 100644 (file)
@@ -1089,6 +1089,8 @@ memory_scan_for_pxenv_struct:
 
 searchdir:
                push es
+               push bx
+               push cx
                mov ax,ds
                mov es,ax
                mov si,di
@@ -1096,7 +1098,7 @@ searchdir:
                mov bp,sp
 
                call allocate_socket
-               jz .error
+               jz .ret
 
                mov ax,PKT_RETRY        ; Retry counter
                mov word [PktTimeout],PKT_TIMEOUT       ; Initial timeout
@@ -1308,7 +1310,10 @@ searchdir:
                pop bp                  ; Junk
                pop bp                  ; Junk (retry counter)
                jz .error_si            ; ZF = 1 need to free the socket
+.ret:
                pop bp
+               pop cx
+               pop bx
                pop es
                ret
 
@@ -1341,9 +1346,7 @@ searchdir:
 .error:                mov si,bx               ; Socket pointer
 .error_si:                             ; Socket pointer already in SI
                call free_socket        ; ZF <- 1, SI <- 0
-               pop bp
-               pop es
-               ret
+               jmp .ret
 
 ;
 ; allocate_socket: Allocate a local UDP port structure