2
* GRUB -- GRand Unified Bootloader
3
* Copyright (C) 2000 Free Software Foundation, Inc.
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21
#include <diskless_size.h>
27
/* Just a dummy entry */
28
.globl _start; _start:
31
* netboot image header
36
/* load address of the first block */
39
/* start addr of the relocation code */
40
.word NBI_DEST_OFF + (relocate - _start)
44
.long NBI_DEST_ADDR + 0x0200
50
* This code is for now located at 0x10000.
51
* Relocate the code in two steps:
52
* 1. Copy the first 32k to 0x8000 and jump to the relocated area.
53
* 2. Copy the rest to 0x10000 (0x8000 + 32k).
56
/* Copy the first 32k */
57
movw $NBI_DEST_SEG, %ax
59
movw $RELOCATED_SEG, %ax
63
/* Always copy 32k bytes */
70
/* Jump to the relocated address */
71
ljmp $0, $(RELOCATED_ADDR + copy_rest - _start)
75
/* Set %edx to the number of bytes */
76
movl $(DISKLESS_SIZE + 0x200 - 0x8000), %edx
83
/* Copy by 32k, as that is easy to implement */
90
/* Update the number of rest bytes */
93
/* Add 0x0800 (32k >> 4) into %es and %ds */
101
/* Zero the offsets */
105
/* Use word-size copy */
109
/* The direction is already correct */
115
/* Jump to the stage2 */
117
ljmp $0, $STAGE2_START_ADDR
119
/* This ensures that the length of this image will be 1 sector */
120
. = _start + 0x200 - 1