2 /// Contains an implementation of CallPalProcStacked on Itanium-based
5 /// Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
6 /// This program and the accompanying materials
7 /// are licensed and made available under the terms and conditions of the BSD License
8 /// which accompanies this distribution. The full text of the license may be found at
9 /// http://opensource.org/licenses/bsd-license.php.
11 /// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 /// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 /// Module Name: AsmPalCall.s
19 //-----------------------------------------------------------------------------
23 // Makes a PAL procedure call.
24 // This is function to make a PAL procedure call. Based on the Index
25 // value this API will make static or stacked PAL call. The following table
26 // describes the usage of PAL Procedure Index Assignment. Architected procedures
27 // may be designated as required or optional. If a PAL procedure is specified
28 // as optional, a unique return code of 0xFFFFFFFFFFFFFFFF is returned in the
29 // Status field of the PAL_CALL_RETURN structure.
30 // This indicates that the procedure is not present in this PAL implementation.
31 // It is the caller's responsibility to check for this return code after calling
32 // any optional PAL procedure.
33 // No parameter checking is performed on the 5 input parameters, but there are
34 // some common rules that the caller should follow when making a PAL call. Any
35 // address passed to PAL as buffers for return parameters must be 8-byte aligned.
36 // Unaligned addresses may cause undefined results. For those parameters defined
37 // as reserved or some fields defined as reserved must be zero filled or the invalid
38 // argument return value may be returned or undefined result may occur during the
39 // execution of the procedure. If the PalEntryPoint does not point to a valid
40 // PAL entry point then the system behavior is undefined. This function is only
44 // in0: PAL_PROC entrypoint
45 // in1-in4 : PAL_PROC arguments
49 // As per stacked calling conventions.
52 //---------------------------------------------------------------------------
57 #define PAL_MC_CLEAR_LOG 0x0015
58 #define PAL_MC_DYNAMIC_STATE 0x0018
59 #define PAL_MC_ERROR_INFO 0x0019
60 #define PAL_MC_RESUME 0x001a
65 .type AsmPalCall, @function
68 alloc loc1 = ar.pfs,5,8,4,0
78 cmp.ge p6,p7 = r28,loc6;;
80 (p6) movl loc6 = 0x1FF;;
81 (p7) br.dpnt.few PalCallStatic;; // 0 ~ 255 make a static Pal Call
82 (p6) cmp.le p6,p7 = r28,loc6;;
83 (p6) br.dpnt.few PalCallStacked;; // 256 ~ 511 make a stacked Pal Call
84 (p7) movl loc6 = 0x300;;
85 (p7) cmp.ge p6,p7 = r28,loc6;;
86 (p7) br.dpnt.few PalCallStatic;; // 512 ~ 767 make a static Pal Call
87 (p6) movl loc6 = 0x3FF;;
88 (p6) cmp.le p6,p7 = r28,loc6;;
89 (p6) br.dpnt.few PalCallStacked;; // 768 ~ 1023 make a stacked Pal Call
91 (p7) mov r8 = 0xFFFFFFFFFFFFFFFF;; // > 1024 return invalid
92 (p7) br.dpnt.few ComeBackFromPALCall;;
95 movl loc6 = PAL_MC_CLEAR_LOG;;
96 cmp.eq p6,p7 = r28,loc6;;
98 (p7) movl loc6 = PAL_MC_DYNAMIC_STATE;;
99 (p7) cmp.eq p6,p7 = r28,loc6;;
101 (p7) movl loc6 = PAL_MC_ERROR_INFO;;
102 (p7) cmp.eq p6,p7 = r28,loc6;;
104 (p7) movl loc6 = PAL_MC_RESUME;;
105 (p7) cmp.eq p6,p7 = r28,loc6 ;;
108 (p7) dep r2 = loc6,r2,13,1;; // psr.ic = 1
110 // p6 will be true, if it is one of the MCHK calls. There has been lots of debate
111 // on psr.ic for these values. For now, do not do any thing to psr.ic
113 dep r2 = r0,r2,14,1;; // psr.i = 0
116 srlz.d // Needs data serailization.
117 srlz.i // Needs instruction serailization.
121 add loc2 = ComeBackFromPALCall - StaticGetPALLocalIP,loc2;;
122 mov b0 = loc2 // return address after Pal call
127 mov b5 = in0;; // get the PalProcEntrypt from input
128 br.sptk b5;; // Take the plunge.
131 dep r2 = r0,r2,14,1;; // psr.i = 0
133 srlz.d // Needs data serailization.
134 srlz.i // Needs instruction serailization.
136 StackedGetPALLocalIP:
141 mov b5 = in0 ;; // get the PalProcEntrypt from input
142 br.call.dpnt b0 = b5 ;; // Take the plunge.
146 srlz.d // Needs data serailization.
147 srlz.i // Needs instruction serailization.