version: Update to 4.08, update year to 2014
[syslinux/sherbszt.git] / core / loadhigh.inc
blob89de5e8de38eaafd7b8511bfe2783a1688407853
1 ;; -----------------------------------------------------------------------
2 ;;
3 ;;   Copyright 1994-2009 H. Peter Anvin - All Rights Reserved
4 ;;   Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
5 ;;
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 ;; -----------------------------------------------------------------------
15 ;; loadhigh.inc
17 ;; Load a file into high memory
20                 section .text16
23 ; load_high:    loads (the remainder of) a file into high memory.
25 ;               Assumes CS == DS.
27 ; Inputs:       SI  = file handle/cluster pointer
28 ;               EDI = target address in high memory
29 ;               EAX = maximum number of bytes to load
30 ;               DX  = zero-padding mask (e.g. 0003h for pad to dword)
31 ;               BX  = subroutine to call at the top of each loop
32 ;                     (to print status and check for abort)
33 ;               [MyHighMemSize] = maximum load address
35 ; Outputs:      SI  = file handle/cluster pointer
36 ;               EBX = first untouched address (not including padding)
37 ;               EDI = first untouched address (including padding)
38 ;               CF  = reached EOF
40                 extern pm_load_high
41 load_high:
42                 push ebp
43                 mov ebp,[MyHighMemSize]
44                 pm_call pm_load_high
45                 pop ebp
46                 jo .overflow
47                 ret
49 .overflow:      mov si,err_nohighmem
50                 jmp abort_load
52                 section .data16
53 err_nohighmem   db CR, LF
54                 db 'Not enough memory to load specified image.', CR, LF, 0
56                 section .bss16
57                 alignb 2
58 PauseBird       resw 1
60                 section .text16