/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2000 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <nbi.h>
#include <diskless_size.h>
.file "nbloader.S"
.text
/* Just a dummy entry */
/*
* netboot image header
*/
.long NBI_MAGIC
.long 0x00000004
/* load address of the first block */
/* start addr of the relocation code */
.long 0x04000004
.long NBI_DEST_ADDR + 0x0200
.long DISKLESS_SIZE
.long DISKLESS_SIZE
/*
* This code is for now located at 0x10000.
* Relocate the code in two steps:
* 1. Copy the first 32k to 0x8000 and jump to the relocated area.
* 2. Copy the rest to 0x10000 (0x8000 + 32k).
*/
/* Copy the first 32k */
/* Always copy 32k bytes */
/* Jump to the relocated address */
/* Copy the rest */
/* Set %edx to the number of bytes */
/* Check the rest */
/* Copy by 32k, as that is easy to implement */
copy:
/* Update the number of rest bytes */
/* Add 0x0800 (32k >> 4) into %es and %ds */
/* Zero the offsets */
/* Use word-size copy */
/* The direction is already correct */
/* Jump to the stage2 */
ljmp $0, $STAGE2_START_ADDR
/* This ensures that the length of this image will be 1 sector */
.byte 0