1N/A * GRUB -- GRand Unified Bootloader 1N/A * Copyright (C) 1994-2002 H. Peter Anvin 1N/A * Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc. 1N/A * This program is free software; you can redistribute it and/or modify 1N/A * it under the terms of the GNU General Public License as published by 1N/A * the Free Software Foundation; either version 2 of the License, or 1N/A * (at your option) any later version. 1N/A * This program is distributed in the hope that it will be useful, 1N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of 1N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1N/A * GNU General Public License for more details. 1N/A * You should have received a copy of the GNU General Public License 1N/A * along with this program; if not, write to the Free Software 1N/A * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 1N/A Most of this file was originally "isolinux.asm" from SYSLINUX package. 1N/A It has been very heavily modified. 1N/A /* Absolute addresses 1N/A This makes the assembler generate the address without support 1N/A from the linker. (ELF can't relocate 16-bit addresses!) */ 1N/A#
endif /* STAGE1_5 */ 1N/A /* Print message string */ 1N/A /* Tell GAS to generate 16-bit instructions so that this code works 1N/A * Primary entry point. Because BIOSes are buggy, we only load the first 1N/A * CD-ROM sector (2K) of the file, so the number one priority is actually 1N/A /* This table gets filled in by mkisofs using the 1N/A -boot-info-table option */ 1N/Abi_pvd: .
long 0xDEADBEEF /* LBA of primary volume descript */ 1N/Abi_csum: .
long 0xDEADBEEF /* Checksum of boot file */ 1N/A /* save drive reference first thing! */ 1N/A /* print a notification message on the screen */ 1N/A /* Set up boot file sector, size, load address */ 1N/A /* save the sector number of the second sector in %ebp */ 1N/A/* go here when you need to stop the machine hard after an error condition */ 1N/A * Get linear sectors - EBIOS LBA addressing, 2048-byte sectors. 1N/A * Note that we can't always do this as a single request, because at least 1N/A * Phoenix BIOSes has a 127-sector limit. To be on the safe side, stick 1N/A * to 16 sectors (32K) per request. 1N/A * EAX - Linear sector number 1N/A * ES:BX - Target buffer 1N/A * INT 13h with retry 1N/A mov $
1, %
ah /* Drop transfer size to 1 */ 1N/A ja 3f /* First time, just try again */ 1N/A shr $
1, %
ah /* Otherwise, try to reduce */ 1N/A adc $0, %
ah /* the max transfer size, but not */ 1N/A * message: write the string pointed to by %si 1N/A * WARNING: trashes %si, %ax, and %bx 1N/A * Use BIOS "int 10H Function 0Eh" to write character in teletype mode 1N/A * %ah = 0xe %al = character 1N/A * %bh = page %bl = foreground color (graphics modes) 1N/A int $
0x10 /* display a byte */ 1N/A jne 1b
/* if not end of string, jmp to display */ 1N/A * printhex[248]: Write a hex number in (AL, AX, EAX) to the console 1N/A int $
0x10 /* display a char */ 1N/A/**************************************************************************/ 1N/A * EBIOS disk address packet 1N/A .
long 0
/* +8 LBA (LSW) */ 1N/A .
long 0
/* +C LBA (MSW) */ 1N/A .
word 16 /* Max sectors per transfer (32Kb) */ 1N/A * This area is an empty space between the main body of code below which 1N/A * grows up (fixed after compilation, but between releases it may change 1N/A * in size easily), and the lists of sectors to read, which grows down 1N/A * from a fixed top location. 1N/A /* fill the first data listing with the default */ 1N/A sectors from the start of the disk, sector 0 */ 1N/A to load the data into */