/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1994-2002 H. Peter Anvin
* Copyright (C) 1999,2000,2001,2004 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.
*
*/
/*
Most of this file was originally "isolinux.asm" from SYSLINUX package.
It has been very heavily modified.
*/
#define ASM_FILE
#include "stage1.h"
#include "shared.h"
#include "iso9660.h"
#ifndef STAGE1_5
#include "stage2_size.h"
#endif
/* Absolute addresses
This makes the assembler generate the address without support
from the linker. (ELF can't relocate 16-bit addresses!) */
#ifdef STAGE1_5
# define STAGE_ADDR 0x2000
#else
# define STAGE_ADDR 0x8000
#endif /* STAGE1_5 */
/* Print message string */
.file "start_eltorito.S"
.text
/* Tell GAS to generate 16-bit instructions so that this code works
in real mode. */
/*
* Primary entry point. Because BIOSes are buggy, we only load the first
* CD-ROM sector (2K) of the file, so the number one priority is actually
* loading the rest.
*/
/* This table gets filled in by mkisofs using the
-boot-info-table option */
/* save drive reference first thing! */
/* print a notification message on the screen */
/* Set up boot file sector, size, load address */
/* save the sector number of the second sector in %ebp */
/* go here when you need to stop the machine hard after an error condition */
/*
* Get linear sectors - EBIOS LBA addressing, 2048-byte sectors.
*
* Note that we can't always do this as a single request, because at least
* Phoenix BIOSes has a 127-sector limit. To be on the safe side, stick
* to 16 sectors (32K) per request.
*
* Input:
* EAX - Linear sector number
* ES:BX - Target buffer
* BP - Sector count
*/
1:
jbe 2f
2:
ja 1b
/*
* INT 13h with retry
*/
.try:
int $0x13
jc 1f
1:
ja 2f
2:
.setmaxtr:
3:
/*
* message: write the string pointed to by %si
*
* WARNING: trashes %si, %ax, and %bx
*/
/*
* Use BIOS "int 10H Function 0Eh" to write character in teletype mode
* %ah = 0xe %al = character
* %bh = page %bl = foreground color (graphics modes)
*/
1:
int $0x10 /* display a byte */
/*
* printhex[248]: Write a hex number in (AL, AX, EAX) to the console
*/
jmp 1f
jmp 1f
1:
jmp 2f
2:
int $0x10 /* display a char */
loop 1b
/**************************************************************************/
#ifdef STAGE1_5
#else
#endif
/*
* EBIOS disk address packet
*/
.align 8
.byte 0 /* reserved */
.word 0 /* +2 Block count */
.word 0 /* +4 Offset of buffer */
.word 0 /* +6 Segment of buffer */
.long 0 /* +8 LBA (LSW) */
.long 0 /* +C LBA (MSW) */
.byte 0xFF
.byte 0
/*
* This area is an empty space between the main body of code below which
* grows up (fixed after compilation, but between releases it may change
* in size easily), and the lists of sectors to read, which grows down
* from a fixed top location.
*/
.word 0
.word 0
/* fill the first data listing with the default */
blocklist_default_start:/* this is the sector start parameter, in logical
sectors from the start of the disk, sector 0 */
.long 0
#ifdef STAGE1_5
.word 0
#else
#endif
to load the data into */