/* -*-Asm-*- */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
.text
.align 4
/* OF CIF entry point arrives in %o4 */
/* The offsets to these locations are defined by the
* and grub-setup uses this to patch these next three values as needed.
*
* The boot_path will be the OF device path of the partition where the
* rest of the GRUB kernel image resides. kernel_sector will be set to
* the location of the first block of the GRUB kernel, and
* kernel_address is the location where we should load that first block.
*
* After loading in that block we will execute it by jumping to the
* load address plus the size of the prepended A.OUT header (32 bytes).
*/
.align 4
/* fallthru */
/* fallthru */
/* %o0: OF call name
* %o1: input arg 1
*/
/* %o2: message string
* %o3: message length
*/
/* fallthru */
/* %o0: OF call name
* %o1: input arg 1
* %o2: input arg 2
* %o3: input arg 3
*/
/* fallthru */
/* %o0: OF call name
* %g1: num inputs
* %o5: num outputs
* %o1-%o4: inputs
*/
/* Find the /chosen node so we can fetch the stdout handle,
* and thus perform console output.
*
* chosen_node = prom_finddevice("/chosen")
*/
/* getprop(chosen_node, "stdout", &buffer, buffer_size) */
/* write(stdout_node, "GRUB ", strlen("GRUB ")) */
/* getprop(chosen_node, "bootpath", &buffer, buffer_size) */
/* Open up the boot_path, and use that handle to read the
* first block of the GRUB kernel image.
*
* bootdev_handle = open(boot_path)
*/
/* Since we have 64-bit cells, the high cell of the seek offset
* is zero and the low cell is the entire value.
*
* seek(bootdev, 0, *kernel_byte)
*/
/* read(bootdev, *kernel_address, 512) */
/* the last 4 bytes in the sector 0 contain the signature */