/*-1* Copyright (C) 2010 Andreas Tobler2* 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 ``AS IS'' AND ANY EXPRESS OR14* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES15* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.16* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,17* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,18* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;19* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,20* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR21* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF22* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.23*/24#include <machine/asm.h>2526/* Hypervisor entry call. */27#define hc .long 0x440000222829/*30* Simple HV calls take the same arguments, with the same ABI, as this31* C function32*/33ASENTRY(phyp_hcall)34mflr %r035std %r0,16(%r1)36#if defined(_CALL_ELF) && _CALL_ELF == 237ld %r11,96(%r1) /* Last couple args into volatile regs*/38ld %r12,104(%r1)39#else40ld %r11,112(%r1) /* Last couple args into volatile regs*/41ld %r12,120(%r1)42#endif43hc /* invoke the hypervisor */44ld %r0,16(%r1)45mtlr %r046blr /* return r3 = status */47ASEND(phyp_hcall)4849/*50* PFT HV calls take a special ABI (see PAPR 14.5.4.1)51*52* r3-r7 arguments passed unchanged, r8-r10 are addresses of return values53* HV takes the same r3-r7, but returns values in r3, r4-r654*/55ASENTRY(phyp_pft_hcall)56mflr %r057std %r0,16(%r1)58stdu %r1,-80(%r1)59std %r8,48(%r1) /* save arguments */60std %r9,56(%r1)61std %r10,64(%r1)62hc /* invoke the hypervisor */63ld %r11,48(%r1) /* store results */64std %r4,0(%r11)65ld %r11,56(%r1)66std %r5,0(%r11)67ld %r11,64(%r1)68std %r6,0(%r11)69ld %r1,0(%r1) /* exit */70ld %r0,16(%r1)71mtlr %r072blr /* return r3 = status */73ASEND(phyp_pft_hcall)747576