mirror of https://github.com/acidanthera/audk.git
MdePkg: Add LoongArch64 exception function set into BaseLib
Adding SetExceptionBaseAddress and SetTlbRebaseAddress functions for LoongArch64. BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=4584 Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
parent
e5b5073153
commit
57684402e4
|
@ -287,6 +287,26 @@ typedef struct {
|
||||||
|
|
||||||
#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8
|
#define BASE_LIBRARY_JUMP_BUFFER_ALIGNMENT 8
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the exception base address for LoongArch.
|
||||||
|
*
|
||||||
|
* @param ExceptionBaseAddress The exception base address, must be aligned greater than or qeual to 4K .
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
SetExceptionBaseAddress (
|
||||||
|
IN UINT64
|
||||||
|
);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the TlbRebase address for LoongArch.
|
||||||
|
*
|
||||||
|
* @param TlbRebaseAddress The TlbRebase address, must be aligned greater than or qeual to 4K .
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
SetTlbRebaseAddress (
|
||||||
|
IN UINT64
|
||||||
|
);
|
||||||
|
|
||||||
#endif // defined (MDE_CPU_LOONGARCH64)
|
#endif // defined (MDE_CPU_LOONGARCH64)
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -420,6 +420,7 @@
|
||||||
LoongArch64/CpuPause.S | GCC
|
LoongArch64/CpuPause.S | GCC
|
||||||
LoongArch64/SetJumpLongJump.S | GCC
|
LoongArch64/SetJumpLongJump.S | GCC
|
||||||
LoongArch64/SwitchStack.S | GCC
|
LoongArch64/SwitchStack.S | GCC
|
||||||
|
LoongArch64/ExceptionBase.S | GCC
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# LoongArch set exception base address operations
|
||||||
|
#
|
||||||
|
# Copyright (c) 2024, Loongson Technology Corporation Limited. All rights reserved.<BR>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||||
|
#
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#include <Base.h>
|
||||||
|
#include <Register/LoongArch64/Csr.h>
|
||||||
|
|
||||||
|
ASM_GLOBAL ASM_PFX(SetExceptionBaseAddress)
|
||||||
|
ASM_GLOBAL ASM_PFX(SetTlbRebaseAddress)
|
||||||
|
|
||||||
|
#/**
|
||||||
|
# Set the exception base address for LoongArch.
|
||||||
|
#
|
||||||
|
# @param ExceptionBaseAddress The exception base address, must be aligned greater than or qeual to 4K .
|
||||||
|
#**/
|
||||||
|
ASM_PFX(SetExceptionBaseAddress):
|
||||||
|
csrrd $t0, LOONGARCH_CSR_ECFG
|
||||||
|
li.d $t1, ~(BIT16 | BIT17 | BIT18)
|
||||||
|
and $t0, $t0, $t1
|
||||||
|
csrwr $t0, LOONGARCH_CSR_ECFG
|
||||||
|
|
||||||
|
move $t0, $a0
|
||||||
|
csrwr $t0, LOONGARCH_CSR_EBASE
|
||||||
|
jirl $zero, $ra, 0
|
||||||
|
|
||||||
|
#/**
|
||||||
|
# Set the TlbRebase address for LoongArch.
|
||||||
|
#
|
||||||
|
# @param TlbRebaseAddress The TlbRebase address, must be aligned greater than or qeual to 4K .
|
||||||
|
#**/
|
||||||
|
ASM_PFX(SetTlbRebaseAddress):
|
||||||
|
move $t0, $a0
|
||||||
|
csrwr $t0, LOONGARCH_CSR_TLBREBASE
|
||||||
|
jirl $zero, $ra, 0
|
||||||
|
.end
|
Loading…
Reference in New Issue