Subversion Repositories HelenOS

Rev

Rev 2726 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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