2 ;; -----------------------------------------------------------------------
4 ;; Copyright 1994-2002 H. Peter Anvin - All Rights Reserved
6 ;; This program is free software; you can redistribute it and/or modify
7 ;; it under the terms of the GNU General Public License as published by
8 ;; the Free Software Foundation, Inc., 53 Temple Place Ste 330,
9 ;; Boston MA 02111-1307, USA; either version 2 of the License, or
10 ;; (at your option) any later version; incorporated herein by reference.
12 ;; -----------------------------------------------------------------------
17 ;; Load a file into high memory
23 ; load_high: loads (the remainder of) a file into high memory.
24 ; This routine prints dots for each 64K transferred, and
25 ; calls abort_check periodically.
27 ; The xfer_buf_seg is used as a bounce buffer.
29 ; The input address (EDI) should be dword aligned, and the final
30 ; stretch is padded with zeroes if necessary.
32 ; Inputs: SI = file handle/cluster pointer
33 ; EDI = target address in high memory
34 ; EAX = size of remaining file in bytes
35 ; DX = zero-padding mask (e.g. 0003h for pad to dword)
37 ; Outputs: SI = file handle/cluster pointer
38 ; EDI = first untouched address (not including padding)
47 and si,si ; If SI == 0 then we have end of file
55 push eax ; <A> Total bytes to transfer
56 cmp eax,(1 << 16) ; Max 64K in one transfer
60 push eax ; <B> Bytes transferred this chunk
62 shr eax,SECTOR_SHIFT ; Convert to sectors
64 ; Now (e)ax contains the number of sectors to get
65 push edi ; <C> Target buffer
68 call getfssec ; Load the data into xfer_buf_seg
69 pop edi ; <C> Target buffer
70 pop ecx ; <B> Byte count this round
71 push ecx ; <B> Byte count this round
72 push edi ; <C> Target buffer
76 ; The last dword fractional - pad with zeroes
77 ; Zero-padding is critical for multi-file initramfs.
82 push esi ; <D> File handle/cluster pointer
83 mov esi,(xfer_buf_seg << 4) ; Source address
84 call bcopy ; Copy to high memory
85 pop esi ; <D> File handle/cluster pointer
86 pop edi ; <C> Target buffer
87 pop ecx ; <B> Byte count this round
88 pop eax ; <A> Total bytes to transfer
91 jnz .read_loop ; More to read...