]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseLib/RiscV64/ReadTimer.S
MdePkg/BaseLib: RISC-V: Add few more helper functions
[mirror_edk2.git] / MdePkg / Library / BaseLib / RiscV64 / ReadTimer.S
diff --git a/MdePkg/Library/BaseLib/RiscV64/ReadTimer.S b/MdePkg/Library/BaseLib/RiscV64/ReadTimer.S
new file mode 100644 (file)
index 0000000..39a06ef
--- /dev/null
@@ -0,0 +1,23 @@
+//------------------------------------------------------------------------------\r
+//\r
+// Read CPU timer\r
+//\r
+// Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>\r
+//\r
+// SPDX-License-Identifier: BSD-2-Clause-Patent\r
+//\r
+//------------------------------------------------------------------------------\r
+\r
+#include <Register/RiscV64/RiscVImpl.h>\r
+\r
+.data\r
+.align 3\r
+.section .text\r
+\r
+//\r
+// Read TIME CSR.\r
+// @retval a0 : 64-bit timer.\r
+//\r
+ASM_FUNC (RiscVReadTimer)\r
+    csrr a0, CSR_TIME\r
+    ret\r