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
21 ; load_high: loads (the remainder of) a file into high memory.
22 ; This routine prints dots for each 64K transferred, and
23 ; calls abort_check periodically.
25 ; The xfer_buf_seg is used as a bounce buffer.
27 ; The input address (EDI) should be dword aligned, and the final
28 ; dword written is padded with zeroes if necessary.
30 ; Inputs: SI = file handle/cluster pointer
31 ; EDI = target address in high memory
32 ; EAX = size of remaining file in bytes
34 ; Outputs: SI = file handle/cluster pointer
35 ; EDI = first untouched address (not including padding)
44 and si,si ; If SI == 0 then we have end of file
52 push eax ; <A> Total bytes to transfer
53 cmp eax,(1 << 16) ; Max 64K in one transfer
57 push eax ; <B> Bytes transferred this chunk
59 shr eax,SECTOR_SHIFT ; Convert to sectors
61 ; Now (e)ax contains the number of sectors to get
62 push edi ; <C> Target buffer
65 call getfssec ; Load the data into xfer_buf_seg
66 pop edi ; <C> Target buffer
67 pop ecx ; <B> Byte count this round
68 push ecx ; <B> Byte count this round
69 push edi ; <C> Target buffer
73 ; The last dword fractional - pad with zeroes
74 ; Zero-padding is critical for multi-file initramfs.
79 push esi ; <D> File handle/cluster pointer
80 mov esi,(xfer_buf_seg << 4) ; Source address
81 call bcopy ; Copy to high memory
82 pop esi ; <D> File handle/cluster pointer
83 pop edi ; <C> Target buffer
84 pop ecx ; <B> Byte count this round
85 pop eax ; <A> Total bytes to transfer
88 jnz .read_loop ; More to read...