1*530d68baSNigel Croxon//++ 2*530d68baSNigel Croxon// Copyright (c) 1996-99 Intel Corp. 3*530d68baSNigel Croxon// 4*530d68baSNigel Croxon// 5*530d68baSNigel Croxon// Module Name: 6*530d68baSNigel Croxon// 7*530d68baSNigel Croxon// palproc.s 8*530d68baSNigel Croxon// 9*530d68baSNigel Croxon// Abstract: 10*530d68baSNigel Croxon// 11*530d68baSNigel Croxon// Contains an implementation for making PAL PROC calls on 12*530d68baSNigel Croxon// IA-64 architecture. 13*530d68baSNigel Croxon// 14*530d68baSNigel Croxon// 15*530d68baSNigel Croxon// 16*530d68baSNigel Croxon// Revision History: 17*530d68baSNigel Croxon// 18*530d68baSNigel Croxon//-- 19*530d68baSNigel Croxon 20*530d68baSNigel Croxon .file "palproc.s" 21*530d68baSNigel Croxon 22*530d68baSNigel Croxon#include "palproc.h" 23*530d68baSNigel Croxon 24*530d68baSNigel Croxon 25*530d68baSNigel Croxon//----------------------------------------------------------------------------- 26*530d68baSNigel Croxon//++ 27*530d68baSNigel Croxon// MakeStaticPALCall 28*530d68baSNigel Croxon// 29*530d68baSNigel Croxon// This routine is called whenever an architected static calling convention 30*530d68baSNigel Croxon// based PAL call is to be made. This call does use RSE actually, but our policy 31*530d68baSNigel Croxon// in making static PAL calls before memory is available is to make sure that 32*530d68baSNigel Croxon// we do not nest too deep and allocate beyond 96 banked registers. In other 33*530d68baSNigel Croxon// words we carefully code calls and control flow before memory is available. 34*530d68baSNigel Croxon// 35*530d68baSNigel Croxon// Arguments : All parameters set up to do static PAL call. 36*530d68baSNigel Croxon// 37*530d68baSNigel Croxon// On Entry : 38*530d68baSNigel Croxon// 39*530d68baSNigel Croxon// Return Value: 40*530d68baSNigel Croxon// 41*530d68baSNigel Croxon// As per static calling conventions. 42*530d68baSNigel Croxon// 43*530d68baSNigel Croxon//-- 44*530d68baSNigel Croxon//--------------------------------------------------------------------------- 45*530d68baSNigel CroxonPROCEDURE_ENTRY(MakeStaticPALCall) 46*530d68baSNigel Croxon 47*530d68baSNigel Croxon NESTED_SETUP (5,8,0,0) 48*530d68baSNigel Croxon mov loc3 = b5 49*530d68baSNigel Croxon mov loc4 = r2 50*530d68baSNigel Croxon mov loc7 = r1;; 51*530d68baSNigel Croxon 52*530d68baSNigel Croxon movl loc6 = PAL_MC_CLEAR_LOG 53*530d68baSNigel Croxon mov r2 = psr;; 54*530d68baSNigel Croxon mov loc5 = r2 55*530d68baSNigel Croxon 56*530d68baSNigel Croxon cmp.eq p6,p7 = r28,loc6;; 57*530d68baSNigel Croxon (p7)movl loc6 = PAL_MC_DYNAMIC_STATE;; 58*530d68baSNigel Croxon (p7)cmp.eq p6,p7 = r28,loc6;; 59*530d68baSNigel Croxon 60*530d68baSNigel Croxon (p7)movl loc6 = PAL_MC_ERROR_INFO;; 61*530d68baSNigel Croxon (p7)cmp.eq p6,p7 = r28,loc6;; 62*530d68baSNigel Croxon 63*530d68baSNigel Croxon (p7)movl loc6 = PAL_MC_RESUME;; 64*530d68baSNigel Croxon (p7)cmp.eq p6,p7 = r28,loc6 65*530d68baSNigel Croxon 66*530d68baSNigel Croxon mov loc6 = 0x1;; 67*530d68baSNigel Croxon (p7)dep r2 = loc6,r2,13,1;; // psr.ic = 1 68*530d68baSNigel Croxon 69*530d68baSNigel Croxon// p6 will be true, if it is one of the MCHK calls. There has been lots of debate 70*530d68baSNigel Croxon// on psr.ic for these values. For now, do not do any thing to psr.ic 71*530d68baSNigel Croxon 72*530d68baSNigel Croxon// (p6)dep r2 = r0,r2,13,1;; // psr.ic = 0 73*530d68baSNigel Croxon dep r2 = r0,r2,14,1;; // psr.i = 0 74*530d68baSNigel Croxon 75*530d68baSNigel Croxon mov psr.l = r2 76*530d68baSNigel Croxon srlz.d;; // Needs data serailization. 77*530d68baSNigel Croxon srlz.i;; // Needs instruction serailization. 78*530d68baSNigel Croxon 79*530d68baSNigel CroxonStaticGetPALLocalIP: 80*530d68baSNigel Croxon mov loc2 = ip;; 81*530d68baSNigel Croxon add loc2 = StaticComeBackFromPALCall - StaticGetPALLocalIP,loc2;; 82*530d68baSNigel Croxon mov b0 = loc2 // return address after Pal call 83*530d68baSNigel Croxon mov r28 = in1 // get the input parameters to PAL call 84*530d68baSNigel Croxon mov r29 = in2 85*530d68baSNigel Croxon mov r30 = in3;; 86*530d68baSNigel Croxon mov r31 = in4 87*530d68baSNigel Croxon mov b5 = in0;; // get the PalProcEntrypt from input 88*530d68baSNigel Croxon br.sptk b5 // Take the plunge. 89*530d68baSNigel Croxon 90*530d68baSNigel CroxonStaticComeBackFromPALCall: 91*530d68baSNigel Croxon 92*530d68baSNigel Croxon mov psr.l = loc5;; 93*530d68baSNigel Croxon srlz.d;; // Needs data serailization. 94*530d68baSNigel Croxon srlz.i;; // Needs instruction serailization. 95*530d68baSNigel Croxon 96*530d68baSNigel Croxon mov b5 = loc3 97*530d68baSNigel Croxon mov r2 = loc4 98*530d68baSNigel Croxon mov r1 = loc7 99*530d68baSNigel Croxon 100*530d68baSNigel Croxon NESTED_RETURN 101*530d68baSNigel Croxon 102*530d68baSNigel CroxonPROCEDURE_EXIT(MakeStaticPALCall) 103*530d68baSNigel Croxon 104*530d68baSNigel Croxon 105*530d68baSNigel Croxon//----------------------------------------------------------------------------- 106*530d68baSNigel Croxon//++ 107*530d68baSNigel Croxon// MakeStackedPALCall 108*530d68baSNigel Croxon// 109*530d68baSNigel Croxon// This routine is called whenever an architected stacked calling convention 110*530d68baSNigel Croxon// based PAL call is to be made. This call is made after memory is available. 111*530d68baSNigel Croxon// Although stacked calls could be made directly from 'C', there is a PAL 112*530d68baSNigel Croxon// requirement which forces the index to be in GR28 and hence this stub is 113*530d68baSNigel Croxon// needed 114*530d68baSNigel Croxon// 115*530d68baSNigel Croxon// Arguments : All parameters set up to do stacted PAL call. 116*530d68baSNigel Croxon// 117*530d68baSNigel Croxon// On Entry : 118*530d68baSNigel Croxon// in0: PAL_PROC entrypoint 119*530d68baSNigel Croxon// in1-in4 : PAL_PROC arguments 120*530d68baSNigel Croxon// 121*530d68baSNigel Croxon// Return Value: 122*530d68baSNigel Croxon// 123*530d68baSNigel Croxon// As per stacked calling conventions. 124*530d68baSNigel Croxon// 125*530d68baSNigel Croxon//-- 126*530d68baSNigel Croxon//--------------------------------------------------------------------------- 127*530d68baSNigel CroxonPROCEDURE_ENTRY(MakeStackedPALCall) 128*530d68baSNigel Croxon 129*530d68baSNigel Croxon NESTED_SETUP (5,8,4,0) 130*530d68baSNigel Croxon mov loc3 = b5 131*530d68baSNigel Croxon mov loc4 = r2 132*530d68baSNigel Croxon mov loc7 = r1 133*530d68baSNigel Croxon mov r2 = psr;; 134*530d68baSNigel Croxon mov loc5 = r2;; 135*530d68baSNigel Croxon dep r2 = r0,r2,14,1;; // psr.i = 0 136*530d68baSNigel Croxon mov psr.l = r2 137*530d68baSNigel Croxon srlz.d;; // Needs data serailization. 138*530d68baSNigel Croxon srlz.i;; // Needs instruction serailization. 139*530d68baSNigel Croxon 140*530d68baSNigel CroxonStackedGetPALLocalIP: 141*530d68baSNigel Croxon mov r28 = in1 // get the input parameters to PAL call 142*530d68baSNigel Croxon mov out0 = in1 143*530d68baSNigel Croxon mov out1 = in2;; 144*530d68baSNigel Croxon mov out2 = in3 145*530d68baSNigel Croxon mov out3 = in4 146*530d68baSNigel Croxon mov b5 = in0;; // get the PalProcEntrypt from input 147*530d68baSNigel Croxon br.call.dpnt b0=b5;; // Take the plunge. 148*530d68baSNigel Croxon 149*530d68baSNigel CroxonStackedComeBackFromPALCall: 150*530d68baSNigel Croxon 151*530d68baSNigel Croxon mov psr.l = loc5;; 152*530d68baSNigel Croxon srlz.d;; // Needs data serailization. 153*530d68baSNigel Croxon srlz.i;; // Needs instruction serailization. 154*530d68baSNigel Croxon mov b5 = loc3 155*530d68baSNigel Croxon mov r2 = loc4 156*530d68baSNigel Croxon mov r1 = loc7 157*530d68baSNigel Croxon 158*530d68baSNigel Croxon NESTED_RETURN 159*530d68baSNigel Croxon 160*530d68baSNigel CroxonPROCEDURE_EXIT(MakeStackedPALCall) 161*530d68baSNigel Croxon 162