]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Implementation of Application Register reading functions on Itanium platform.\r | |
3 | \r | |
4 | Copyright (c) 2008, Intel Corporation<BR>\r | |
5 | All rights reserved. This program and the accompanying materials\r | |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
12 | \r | |
13 | **/\r | |
14 | \r | |
15 | #include "BaseLibInternals.h"\r | |
16 | \r | |
17 | \r | |
18 | //\r | |
19 | // Loop up table for Index and corresponding application register access routines. \r | |
20 | //\r | |
21 | GLOBAL_REMOVE_IF_UNREFERENCED REGISTER_ENTRY mApplicationRegisterAccessEntries[] = {\r | |
22 | {IPF_APPLICATION_REGISTER_K0, AsmReadApplicationRegisterK0},\r | |
23 | {IPF_APPLICATION_REGISTER_K1, AsmReadApplicationRegisterK1},\r | |
24 | {IPF_APPLICATION_REGISTER_K2, AsmReadApplicationRegisterK2},\r | |
25 | {IPF_APPLICATION_REGISTER_K3, AsmReadApplicationRegisterK3},\r | |
26 | {IPF_APPLICATION_REGISTER_K4, AsmReadApplicationRegisterK4},\r | |
27 | {IPF_APPLICATION_REGISTER_K5, AsmReadApplicationRegisterK5},\r | |
28 | {IPF_APPLICATION_REGISTER_K6, AsmReadApplicationRegisterK6},\r | |
29 | {IPF_APPLICATION_REGISTER_K7, AsmReadApplicationRegisterK7},\r | |
30 | {IPF_APPLICATION_REGISTER_RSC, AsmReadApplicationRegisterRsc},\r | |
31 | {IPF_APPLICATION_REGISTER_BSP, AsmReadApplicationRegisterBsp},\r | |
32 | {IPF_APPLICATION_REGISTER_BSPSTORE, AsmReadApplicationRegisterBspstore},\r | |
33 | {IPF_APPLICATION_REGISTER_RNAT, AsmReadApplicationRegisterRnat},\r | |
34 | {IPF_APPLICATION_REGISTER_FCR, AsmReadApplicationRegisterFcr},\r | |
35 | {IPF_APPLICATION_REGISTER_EFLAG, AsmReadApplicationRegisterEflag},\r | |
36 | {IPF_APPLICATION_REGISTER_CSD, AsmReadApplicationRegisterCsd},\r | |
37 | {IPF_APPLICATION_REGISTER_SSD, AsmReadApplicationRegisterSsd},\r | |
38 | {IPF_APPLICATION_REGISTER_CFLG, AsmReadApplicationRegisterCflg},\r | |
39 | {IPF_APPLICATION_REGISTER_FSR, AsmReadApplicationRegisterFsr},\r | |
40 | {IPF_APPLICATION_REGISTER_FIR, AsmReadApplicationRegisterFir},\r | |
41 | {IPF_APPLICATION_REGISTER_FDR, AsmReadApplicationRegisterFdr},\r | |
42 | {IPF_APPLICATION_REGISTER_CCV, AsmReadApplicationRegisterCcv},\r | |
43 | {IPF_APPLICATION_REGISTER_UNAT, AsmReadApplicationRegisterUnat},\r | |
44 | {IPF_APPLICATION_REGISTER_FPSR, AsmReadApplicationRegisterFpsr},\r | |
45 | {IPF_APPLICATION_REGISTER_ITC, AsmReadApplicationRegisterItc},\r | |
46 | {IPF_APPLICATION_REGISTER_PFS, AsmReadApplicationRegisterPfs},\r | |
47 | {IPF_APPLICATION_REGISTER_LC, AsmReadApplicationRegisterLc},\r | |
48 | {IPF_APPLICATION_REGISTER_EC, AsmReadApplicationRegisterEc}\r | |
49 | };\r | |
50 | \r | |
51 | \r | |
52 | /**\r | |
53 | Reads a 64-bit application register.\r | |
54 | \r | |
55 | Reads and returns the application register specified by Index. The valid Index valued are defined\r | |
56 | above in "Related Definitions".\r | |
57 | If Index is invalid then 0xFFFFFFFFFFFFFFFF is returned. This function is only available on IPF.\r | |
58 | \r | |
59 | @param Index The index of the application register to read.\r | |
60 | \r | |
61 | @return The application register specified by Index.\r | |
62 | \r | |
63 | **/\r | |
64 | UINT64\r | |
65 | EFIAPI\r | |
66 | AsmReadApplicationRegister (\r | |
67 | IN UINT64 Index\r | |
68 | )\r | |
69 | {\r | |
70 | UINTN Item;\r | |
71 | \r | |
72 | for (Item = 0; Item < sizeof (mApplicationRegisterAccessEntries) / sizeof (mApplicationRegisterAccessEntries[0]); Item++) {\r | |
73 | if (mApplicationRegisterAccessEntries[Item].Index == Index) {\r | |
74 | return mApplicationRegisterAccessEntries[Item].Function ();\r | |
75 | }\r | |
76 | }\r | |
77 | \r | |
78 | return 0xFFFFFFFFFFFFFFFF;\r | |
79 | }\r |