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 boot sector (or other bootstrap program.)
19 ;; Unlike previous versions of this software, this doesn't require that
20 ;; the length is 512 bytes. This allows PXE bootstraps and WinNT
21 ;; "CD boot sectors" to be invoked.
28 %if IS_SYSLINUX || IS_MDSLINUX
30 mov byte [CopySuper],0
31 jmp short load_bootsec
34 ; Transfer the superblock
35 mov byte [CopySuper],superblock_len
40 xchg dx,ax ; Now EAX = file length
42 push edi ; Save load address
47 push edi ; Save length
49 %if IS_SYSLINUX || IS_MDSLINUX
50 movzx ecx,byte [CopySuper]
53 ; For a BSS boot sector we have to patch.
55 mov edi,100000h+(superblock-bootsec)
63 %if IS_SYSLINUX || IS_MDSLINUX
64 ; Restore original FDC table
65 mov eax,[OrigFDCTabPtr]
69 mov si,PartInfo ; Partition info buffer
70 mov di,800h-18 ; Put partition info here
75 pop si ; DS:SI points to partition info
79 mov byte [KeepPXE],1 ; Chainloading another NBP
85 ; Entrypoint for "shut down and replace bootstrap" -- also invoked by
86 ; the COMBOOT API. This routine expects two dword on the stack:
87 ; linear address and length. Additionally, the values of ESI and EDX
88 ; are passed on to the new bootstrap; the value of BX becomes the new
94 ; Prepare for shutting down
99 ; Set up initial stack frame (not used by PXE if keeppxe is set)
106 test byte [KeepPXE],01h
108 les di,[InitStack] ; Reset stack to PXE original
123 pop ecx ; Byte count to copy
124 pop esi ; Copy from...
130 mov edi,7C00h ; Copy to...
134 %if IS_SYSLINUX || IS_MDSLINUX