2N/A/* crt0.S - Startup code for the Sparc64. */
2N/A/*
2N/A * GRUB -- GRand Unified Bootloader
2N/A * Copyright (C) 2009 Free Software Foundation, Inc.
2N/A *
2N/A * GRUB is free software: you can redistribute it and/or modify
2N/A * it under the terms of the GNU General Public License as published by
2N/A * the Free Software Foundation, either version 3 of the License, or
2N/A * (at your option) any later version.
2N/A *
2N/A * GRUB is distributed in the hope that it will be useful,
2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of
2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2N/A * GNU General Public License for more details.
2N/A *
2N/A * You should have received a copy of the GNU General Public License
2N/A * along with GRUB. If not, see <http://www.gnu.org/licenses/>.
2N/A */
2N/A#include <grub/symbol.h>
2N/A#include <grub/machine/kernel.h>
2N/A#include <grub/offsets.h>
2N/A
2N/A .text
2N/A .align 4
2N/A .globl _start
2N/A_start:
2N/A ba codestart
2N/A mov %o4, %o0
2N/A
2N/A . = EXT_C(_start) + GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE
2N/A
2N/AVARIABLE(grub_total_module_size)
2N/A .word 0
2N/A
2N/Acodestart:
2N/A /* Copy the modules past the end of the kernel image.
2N/A * They are currently sitting in the BSS.
2N/A */
2N/A sethi %hi(__bss_start), %o2
2N/A or %o2, %lo(__bss_start), %o2
2N/A sethi %hi(_end), %o3
2N/A or %o3, %lo(_end), %o3
2N/A sethi %hi(grub_total_module_size), %o4
2N/A lduw [%o4 + %lo(grub_total_module_size)], %o4
2N/A
2N/A add %o2, %o4, %o2
2N/A add %o3, %o4, %o3
2N/A
2N/A /* Save ieee1275 stack for future use by booter. */
2N/A mov %o6, %o1
2N/A /* Our future stack. */
2N/A sethi %hi(GRUB_KERNEL_MACHINE_STACK_SIZE), %o5
2N/A or %o5, %lo(GRUB_KERNEL_MACHINE_STACK_SIZE), %o5
2N/A add %o3, %o5, %o6
2N/A and %o6, ~0xff, %o6
2N/A sub %o6, 2047, %o6
2N/A
2N/A sub %o2, 4, %o2
2N/A sub %o3, 4, %o3
2N/A1: lduw [%o2], %o5
2N/A stw %o5, [%o3]
2N/A subcc %o4, 4, %o4
2N/A sub %o2, 4, %o2
2N/A bne,pt %icc, 1b
2N/A sub %o3, 4, %o3
2N/A
2N/A /* Now it's safe to clear out the BSS. */
2N/A sethi %hi(__bss_start), %o2
2N/A or %o2, %lo(__bss_start), %o2
2N/A sethi %hi(_end), %o3
2N/A or %o3, %lo(_end), %o3
2N/A1: stx %g0, [%o2]
2N/A add %o2, 8, %o2
2N/A cmp %o2, %o3
2N/A blt,pt %xcc, 1b
2N/A nop
2N/A sethi %hi(grub_ieee1275_original_stack), %o2
2N/A stx %o1, [%o2 + %lo(grub_ieee1275_original_stack)]
2N/A sethi %hi(grub_ieee1275_entry_fn), %o2
2N/A call grub_main
2N/A stx %o0, [%o2 + %lo(grub_ieee1275_entry_fn)]
2N/A1: ba,a 1b