Subversion Repositories HelenOS

Rev

Rev 2726 | Details | Compare with Previous | Last modification | View Log | RSS feed

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