]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseLib/LoongArch64/GetInterruptState.S
MdePkg/BaseLib: BaseLib for LOONGARCH64 architecture.
[mirror_edk2.git] / MdePkg / Library / BaseLib / LoongArch64 / GetInterruptState.S
1 #------------------------------------------------------------------------------
2 #
3 # Get LoongArch interrupt status
4 #
5 # Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
6 #
7 # SPDX-License-Identifier: BSD-2-Clause-Patent
8 #
9 #------------------------------------------------------------------------------
10
11 ASM_GLOBAL ASM_PFX(GetInterruptState)
12
13 #/**
14 # Retrieves the current CPU interrupt state.
15 #
16 # Returns TRUE means interrupts are currently enabled. Otherwise,
17 # returns FALSE.
18 #
19 # @retval TRUE CPU interrupts are enabled.
20 # @retval FALSE CPU interrupts are disabled.
21 #
22 #**/
23
24 ASM_PFX(GetInterruptState):
25 li.w $t1, 0x4
26 csrrd $t0, 0x0
27 and $t0, $t0, $t1
28 beqz $t0, 1f
29 li.w $a0, 0x1
30 b 2f
31 1:
32 li.w $a0, 0x0
33 2:
34 jirl $zero, $ra, 0
35 .end