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