summaryrefslogtreecommitdiffstats
path: root/contrib/syslinux-4.02/core/loadhigh.inc
blob: 89de5e8de38eaafd7b8511bfe2783a1688407853 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
;; -----------------------------------------------------------------------
;;
;;   Copyright 1994-2009 H. Peter Anvin - All Rights Reserved
;;   Copyright 2009-2010 Intel Corporation; author: H. Peter Anvin
;;
;;   This program is free software; you can redistribute it and/or modify
;;   it under the terms of the GNU General Public License as published by
;;   the Free Software Foundation, Inc., 53 Temple Place Ste 330,
;;   Boston MA 02111-1307, USA; either version 2 of the License, or
;;   (at your option) any later version; incorporated herein by reference.
;;
;; -----------------------------------------------------------------------

;;
;; loadhigh.inc
;;
;; Load a file into high memory
;;

		section .text16

;
; load_high:	loads (the remainder of) a file into high memory.
;
;		Assumes CS == DS.
;
; Inputs:	SI  = file handle/cluster pointer
;		EDI = target address in high memory
;		EAX = maximum number of bytes to load
;		DX  = zero-padding mask (e.g. 0003h for pad to dword)
;		BX  = subroutine to call at the top of each loop
;                     (to print status and check for abort)
;		[MyHighMemSize] = maximum load address
;
; Outputs:	SI  = file handle/cluster pointer
;		EBX = first untouched address (not including padding)
;		EDI = first untouched address (including padding)
;		CF  = reached EOF
;
		extern pm_load_high
load_high:
		push ebp
		mov ebp,[MyHighMemSize]
		pm_call pm_load_high
		pop ebp
		jo .overflow
		ret

.overflow:	mov si,err_nohighmem
		jmp abort_load

		section .data16
err_nohighmem   db CR, LF
		db 'Not enough memory to load specified image.', CR, LF, 0

		section .bss16
		alignb 2
PauseBird	resw 1

		section .text16