]>
Commit | Line | Data |
---|---|---|
f1baef62 | 1 | /// @file\r |
2 | /// Contains an implementation of CallPalProcStacked on Itanium-based\r | |
3 | /// architecture.\r | |
4 | ///\r | |
5 | /// Copyright (c) 2006, Intel Corporation\r | |
6 | /// All rights reserved. This program and the accompanying materials\r | |
7 | /// are licensed and made available under the terms and conditions of the BSD License\r | |
8 | /// which accompanies this distribution. The full text of the license may be found at\r | |
9 | /// http://opensource.org/licenses/bsd-license.php\r | |
10 | ///\r | |
11 | /// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | /// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | ///\r | |
14 | /// Module Name: AsmPalCall.s\r | |
15 | ///\r | |
16 | ///\r | |
17 | \r | |
18 | \r | |
19 | //-----------------------------------------------------------------------------\r | |
20 | //++\r | |
21 | // AsmPalCall\r | |
22 | //\r | |
23 | // Makes a PAL procedure call.\r | |
24 | // This is function to make a PAL procedure call. Based on the Index\r | |
25 | // value this API will make static or stacked PAL call. The following table\r | |
26 | // describes the usage of PAL Procedure Index Assignment. Architected procedures\r | |
27 | // may be designated as required or optional. If a PAL procedure is specified\r | |
28 | // as optional, a unique return code of 0xFFFFFFFFFFFFFFFF is returned in the\r | |
29 | // Status field of the PAL_CALL_RETURN structure.\r | |
30 | // This indicates that the procedure is not present in this PAL implementation.\r | |
ac644614 | 31 | // It is the caller's responsibility to check for this return code after calling\r |
f1baef62 | 32 | // any optional PAL procedure.\r |
33 | // No parameter checking is performed on the 5 input parameters, but there are\r | |
34 | // some common rules that the caller should follow when making a PAL call. Any\r | |
35 | // address passed to PAL as buffers for return parameters must be 8-byte aligned.\r | |
36 | // Unaligned addresses may cause undefined results. For those parameters defined\r | |
37 | // as reserved or some fields defined as reserved must be zero filled or the invalid\r | |
38 | // argument return value may be returned or undefined result may occur during the\r | |
39 | // execution of the procedure. If the PalEntryPoint does not point to a valid\r | |
40 | // PAL entry point then the system behavior is undefined. This function is only\r | |
41 | // available on IPF.\r | |
42 | //\r | |
43 | // On Entry :\r | |
44 | // in0: PAL_PROC entrypoint\r | |
45 | // in1-in4 : PAL_PROC arguments\r | |
46 | //\r | |
47 | // Return Value:\r | |
48 | //\r | |
49 | // As per stacked calling conventions.\r | |
50 | //\r | |
51 | //--\r | |
52 | //---------------------------------------------------------------------------\r | |
53 | \r | |
54 | //\r | |
55 | // PAL function calls\r | |
56 | //\r | |
57 | #define PAL_MC_CLEAR_LOG 0x0015\r | |
58 | #define PAL_MC_DYNAMIC_STATE 0x0018\r | |
59 | #define PAL_MC_ERROR_INFO 0x0019\r | |
60 | #define PAL_MC_RESUME 0x001a\r | |
61 | \r | |
62 | \r | |
63 | .text\r | |
64 | .proc AsmPalCall\r | |
65 | .type AsmPalCall, @function\r | |
66 | \r | |
67 | AsmPalCall::\r | |
68 | alloc loc1 = ar.pfs,5,8,4,0\r | |
69 | mov loc0 = b0\r | |
70 | mov loc3 = b5\r | |
71 | mov loc4 = r2\r | |
72 | mov loc7 = r1\r | |
73 | mov r2 = psr;;\r | |
74 | mov r28 = in1\r | |
75 | mov loc5 = r2;;\r | |
76 | \r | |
77 | movl loc6 = 0x100;;\r | |
78 | cmp.ge p6,p7 = r28,loc6;;\r | |
79 | \r | |
80 | (p6) movl loc6 = 0x1FF;;\r | |
81 | (p7) br.dpnt.few PalCallStatic;; // 0 ~ 255 make a static Pal Call\r | |
82 | (p6) cmp.le p6,p7 = r28,loc6;;\r | |
83 | (p6) br.dpnt.few PalCallStacked;; // 256 ~ 511 make a stacked Pal Call\r | |
84 | (p7) movl loc6 = 0x300;;\r | |
85 | (p7) cmp.ge p6,p7 = r28,loc6;;\r | |
86 | (p7) br.dpnt.few PalCallStatic;; // 512 ~ 767 make a static Pal Call\r | |
87 | (p6) movl loc6 = 0x3FF;;\r | |
88 | (p6) cmp.le p6,p7 = r28,loc6;;\r | |
89 | (p6) br.dpnt.few PalCallStacked;; // 768 ~ 1023 make a stacked Pal Call\r | |
90 | \r | |
91 | (p7) mov r8 = 0xFFFFFFFFFFFFFFFF;; // > 1024 return invalid\r | |
92 | (p7) br.dpnt.few ComeBackFromPALCall;;\r | |
93 | \r | |
94 | PalCallStatic:\r | |
95 | movl loc6 = PAL_MC_CLEAR_LOG;;\r | |
96 | cmp.eq p6,p7 = r28,loc6;;\r | |
97 | \r | |
98 | (p7) movl loc6 = PAL_MC_DYNAMIC_STATE;;\r | |
99 | (p7) cmp.eq p6,p7 = r28,loc6;;\r | |
100 | \r | |
101 | (p7) movl loc6 = PAL_MC_ERROR_INFO;;\r | |
102 | (p7) cmp.eq p6,p7 = r28,loc6;;\r | |
103 | \r | |
104 | (p7) movl loc6 = PAL_MC_RESUME;;\r | |
105 | (p7) cmp.eq p6,p7 = r28,loc6 ;;\r | |
106 | \r | |
107 | mov loc6 = 0x1;;\r | |
108 | (p7) dep r2 = loc6,r2,13,1;; // psr.ic = 1\r | |
109 | \r | |
110 | // p6 will be true, if it is one of the MCHK calls. There has been lots of debate\r | |
111 | // on psr.ic for these values. For now, do not do any thing to psr.ic\r | |
112 | \r | |
113 | dep r2 = r0,r2,14,1;; // psr.i = 0\r | |
114 | \r | |
115 | mov psr.l = r2\r | |
116 | srlz.d // Needs data serailization.\r | |
117 | srlz.i // Needs instruction serailization.\r | |
118 | \r | |
119 | StaticGetPALLocalIP:\r | |
120 | mov loc2 = ip;;\r | |
121 | add loc2 = ComeBackFromPALCall - StaticGetPALLocalIP,loc2;;\r | |
122 | mov b0 = loc2 // return address after Pal call\r | |
123 | \r | |
124 | mov r29 = in2\r | |
125 | mov r30 = in3\r | |
126 | mov r31 = in4\r | |
127 | mov b5 = in0;; // get the PalProcEntrypt from input\r | |
128 | br.sptk b5;; // Take the plunge.\r | |
129 | \r | |
130 | PalCallStacked:\r | |
131 | dep r2 = r0,r2,14,1;; // psr.i = 0\r | |
132 | mov psr.l = r2;;\r | |
133 | srlz.d // Needs data serailization.\r | |
134 | srlz.i // Needs instruction serailization.\r | |
135 | \r | |
136 | StackedGetPALLocalIP:\r | |
137 | mov out0 = in1\r | |
138 | mov out1 = in2\r | |
139 | mov out2 = in3\r | |
140 | mov out3 = in4\r | |
141 | mov b5 = in0 ;; // get the PalProcEntrypt from input\r | |
142 | br.call.dpnt b0 = b5 ;; // Take the plunge.\r | |
143 | \r | |
144 | ComeBackFromPALCall:\r | |
145 | mov psr.l = loc5 ;;\r | |
146 | srlz.d // Needs data serailization.\r | |
147 | srlz.i // Needs instruction serailization.\r | |
148 | \r | |
149 | mov b5 = loc3\r | |
150 | mov r2 = loc4\r | |
151 | mov r1 = loc7\r | |
152 | \r | |
153 | mov b0 = loc0\r | |
154 | mov ar.pfs = loc1;;\r | |
155 | br.ret.dpnt b0;;\r | |
156 | \r | |
157 | .endp AsmPalCall\r | |
158 | \r |