• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/// @file
2///  IPF specific Global Control Registers accessing functions
3///
4/// Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
5/// This program and the accompanying materials
6/// are licensed and made available under the terms and conditions of the BSD License
7/// which accompanies this distribution.  The full text of the license may be found at
8/// http://opensource.org/licenses/bsd-license.php.
9///
10/// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11/// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12///
13/// Module Name: AccessGcr.s
14///
15///
16
17//---------------------------------------------------------------------------------
18//++
19// AsmReadDcr
20//
21// This routine is used to Read the value of Default Control Register (DCR).
22//
23// Arguments :
24//
25// On Entry :
26//
27// Return Value: The current value of DCR.
28//
29//--
30//----------------------------------------------------------------------------------
31.text
32.type   AsmReadDcr, @function
33.proc   AsmReadDcr
34
35AsmReadDcr::
36         mov            r8 = cr.dcr;;
37         br.ret.dpnt    b0;;
38.endp    AsmReadDcr
39
40//---------------------------------------------------------------------------------
41//++
42// AsmWriteDcr
43//
44// This routine is used to write the value to Default Control Register (DCR).
45//
46// Arguments :
47//
48// On Entry : The value need to be written to DCR
49//
50// Return Value: The value written to DCR.
51//
52//--
53//----------------------------------------------------------------------------------
54.text
55.type   AsmWriteDcr, @function
56.proc   AsmWriteDcr
57.regstk 1, 0, 0, 0
58
59AsmWriteDcr::
60         mov            cr.dcr = in0
61         mov            r8 = in0;;
62         srlz.i;;
63         srlz.d;;
64         br.ret.dpnt    b0;;
65.endp    AsmWriteDcr
66
67
68//---------------------------------------------------------------------------------
69//++
70// AsmReadItc
71//
72// This routine is used to Read the value of Interval Timer Counter Register (ITC).
73//
74// Arguments :
75//
76// On Entry :
77//
78// Return Value: The current value of ITC.
79//
80//--
81//----------------------------------------------------------------------------------
82.text
83.type   AsmReadItc, @function
84.proc   AsmReadItc
85
86AsmReadItc::
87         mov            r8 = ar.itc;;
88         br.ret.dpnt    b0;;
89.endp    AsmReadItc
90
91//---------------------------------------------------------------------------------
92//++
93// AsmWriteItc
94//
95// This routine is used to write the value to Interval Timer Counter Register (ITC).
96//
97// Arguments :
98//
99// On Entry : The value need to be written to the ITC
100//
101// Return Value: The value written to the ITC.
102//
103//--
104//----------------------------------------------------------------------------------
105.text
106.type   AsmWriteItc, @function
107.proc   AsmWriteItc
108.regstk 1, 0, 0, 0
109
110AsmWriteItc::
111         mov            ar.itc = in0
112         mov            r8 = in0;;
113         br.ret.dpnt    b0;;
114.endp    AsmWriteItc
115
116
117//---------------------------------------------------------------------------------
118//++
119// AsmReadItm
120//
121// This routine is used to Read the value of Interval Timer Match Register (ITM).
122//
123// Arguments :
124//
125// On Entry :
126//
127// Return Value: The current value of ITM.
128//
129//--
130//----------------------------------------------------------------------------------
131.text
132.type   AsmReadItm, @function
133.proc   AsmReadItm
134
135AsmReadItm::
136         mov            r8 = cr.itm;;
137         br.ret.dpnt    b0;;
138.endp    AsmReadItm
139
140//---------------------------------------------------------------------------------
141//++
142// AsmWriteItm
143//
144// This routine is used to write the value to Interval Timer Match Register (ITM).
145//
146// Arguments :
147//
148// On Entry : The value need to be written to ITM
149//
150// Return Value: The value written to ITM.
151//
152//--
153//----------------------------------------------------------------------------------
154.text
155.type   AsmWriteItm, @function
156.proc   AsmWriteItm
157.regstk 1, 0, 0, 0
158
159AsmWriteItm::
160         mov            cr.itm = in0
161         mov            r8 = in0;;
162         srlz.d;
163         br.ret.dpnt    b0;;
164.endp    AsmWriteItm
165
166
167//---------------------------------------------------------------------------------
168//++
169// AsmReadIva
170//
171// This routine is used to read the value of Interruption Vector Address Register (IVA).
172//
173// Arguments :
174//
175// On Entry :
176//
177// Return Value: The current value of IVA.
178//
179//--
180//----------------------------------------------------------------------------------
181.text
182.type   AsmReadIva, @function
183.proc   AsmReadIva
184
185AsmReadIva::
186         mov            r8 = cr.iva;;
187         br.ret.dpnt    b0;;
188.endp    AsmReadIva
189
190//---------------------------------------------------------------------------------
191//++
192// AsmWriteIva
193//
194// This routine is used to write the value to Interruption Vector Address Register (IVA).
195//
196// Arguments :
197//
198// On Entry : The value need to be written to IVA
199//
200// Return Value: The value written to IVA.
201//
202//--
203//----------------------------------------------------------------------------------
204.text
205.type   AsmWriteIva, @function
206.proc   AsmWriteIva
207.regstk 1, 3, 0, 0
208
209AsmWriteIva::
210        alloc loc1=ar.pfs,1,4,0,0 ;;
211
212        mov         loc2 = psr
213        rsm         0x6000                      // Make sure interrupts are masked
214
215        mov            cr.iva = in0
216        srlz.i;;
217        mov         psr.l = loc2;;
218        srlz.i;;
219        srlz.d;;
220        mov ar.pfs=loc1 ;;
221        mov            r8 = in0;;
222        br.ret.dpnt    b0;;
223.endp   AsmWriteIva
224
225
226//---------------------------------------------------------------------------------
227//++
228// AsmReadPta
229//
230// This routine is used to read the value of Page Table Address Register (PTA).
231//
232// Arguments :
233//
234// On Entry :
235//
236// Return Value: The current value of PTA.
237//
238//--
239//----------------------------------------------------------------------------------
240.text
241.type   AsmReadPta, @function
242.proc   AsmReadPta
243
244AsmReadPta::
245         mov            r8 = cr.pta;;
246         br.ret.dpnt    b0;;
247.endp    AsmReadPta
248
249//---------------------------------------------------------------------------------
250//++
251// AsmWritePta
252//
253// This routine is used to write the value to Page Table Address Register (PTA)).
254//
255// Arguments :
256//
257// On Entry : The value need to be written to PTA
258//
259// Return Value: The value written to PTA.
260//
261//--
262//----------------------------------------------------------------------------------
263.text
264.type   AsmWritePta, @function
265.proc   AsmWritePta
266.regstk 1, 0, 0, 0
267
268AsmWritePta::
269         mov            cr.pta = in0
270         mov            r8 = in0;;
271         srlz.i;;
272         srlz.d;;
273         br.ret.dpnt    b0;;
274.endp    AsmWritePta
275