1 /// Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
2 /// This program and the accompanying materials
3 /// are licensed and made available under the terms and conditions of the BSD License
4 /// which accompanies this distribution. The full text of the license may be found at
5 /// http://opensource.org/licenses/bsd-license.php
7 /// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
8 /// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10 /// Module Name: AccessPsr.s
13 /// IPF specific Processor Status Register accessing functions
16 #define CpuModeMask 0x0000001008020000
18 #define CpuInVirtualMode 0x1
19 #define CpuInPhysicalMode 0x0
20 #define CpuInMixMode (0x0 - 0x1)
22 //---------------------------------------------------------------------------------
26 // This routine is used to read the current value of Processor Status Register (PSR).
32 // Return Value: The current PSR value.
35 //----------------------------------------------------------------------------------
37 .type AsmReadPsr, @function
45 //---------------------------------------------------------------------------------
49 // This routine is used to write the value of Processor Status Register (PSR).
53 // On Entry : The value need to be written.
55 // Return Value: The value have been written.
58 //----------------------------------------------------------------------------------
60 .type AsmWritePsr, @function
72 //---------------------------------------------------------------------------------
76 // This routine is used to determines if the CPU is currently executing
77 // in virtual, physical, or mixed mode.
79 // If the CPU is in virtual mode(PSR.RT=1, PSR.DT=1, PSR.IT=1), then 1 is returned.
80 // If the CPU is in physical mode(PSR.RT=0, PSR.DT=0, PSR.IT=0), then 0 is returned.
81 // If the CPU is not in physical mode or virtual mode, then it is in mixed mode,
82 // and -1 is returned.
88 // Return Value: The CPU mode flag
89 // return 1 The CPU is in virtual mode.
90 // return 0 The CPU is in physical mode.
91 // return -1 The CPU is in mixed mode.
94 //----------------------------------------------------------------------------------
96 .type AsmCpuVirtual, @function
101 movl r30 = CpuModeMask;;
103 cmp.eq p6, p7 = r30, r28;;
104 (p6) mov r8 = CpuInVirtualMode;;
105 (p7) cmp.eq p6, p7 = 0x0, r28;;
106 (p6) mov r8 = CpuInPhysicalMode;;
107 (p7) mov r8 = CpuInMixMode;;