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