/*-1* Copyright (c) 2007 Semihalf, Rafal Jaworowski <[email protected]>2* All rights reserved.3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7* 1. Redistributions of source code must retain the above copyright8* notice, this list of conditions and the following disclaimer.9* 2. Redistributions in binary form must reproduce the above copyright10* notice, this list of conditions and the following disclaimer in the11* documentation and/or other materials provided with the distribution.12*13* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND14* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE15* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE16* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE17* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL18* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS19* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)20* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT21* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY22* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF23* SUCH DAMAGE.24*/2526#include <machine/asm.h>2728/*29* Entry point to the loader that U-Boot passes control to.30*/31.text32.globl _start33_start:34/* Hint where to look for the API signature */35lis %r11, uboot_address@ha36addi %r11, %r11, uboot_address@l37stw %r1, 0(%r11)38/* Save U-Boot's r14 and r30 */39lis %r11, saved_regs@ha40addi %r11, %r11, saved_regs@l41stw %r14, 0(%r11)42stw %r30, 4(%r11)43/* Disable interrupts */44mfmsr %r1145andi. %r11, %r11, ~0x8000@l46mtmsr %r1147b main4849/*50* syscall()51*/52ENTRY(syscall)53stwu %r1, -32(%r1)54mflr %r055stw %r14, 8(%r1)56stw %r30, 12(%r1)57stw %r0, 36(%r1)58/* Restore U-Boot's r14 and r30 */59lis %r11, saved_regs@ha60addi %r11, %r11, saved_regs@l61lwz %r14, 0(%r11)62lwz %r30, 4(%r11)63/* Enable interrupts */64mfmsr %r1165ori %r11, %r11, 0x8000@l66mtmsr %r1167/* Call into U-Boot */68lis %r11, syscall_ptr@ha69addi %r11, %r11, syscall_ptr@l70lwz %r11, 0(%r11)71mtctr %r1172bctrl73/* Disable interrupts */74mfmsr %r1175andi. %r11, %r11, ~0x8000@l76mtmsr %r1177/* Epilogue */78lwz %r11, 0(%r1)79lwz %r0, 4(%r11)80mtlr %r081lwz %r14, 8(%r1)82lwz %r30, 12(%r1)83mr %r1, %r1184blr85END(syscall)8687/*88* Data section89*/90.data91GLOBAL(syscall_ptr)92.long 093GLOBAL(saved_regs)94.long 0 /* R14 */95.long 0 /* R30 */96GLOBAL(uboot_address)97.long 09899100