summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library/BaseLib/RiscV64/ReadTimer.S
blob: 36781c29c0b9d66119bf28f36ec225decfb52670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//------------------------------------------------------------------------------
//
// Read CPU timer
//
// Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
//------------------------------------------------------------------------------

#include <Register/RiscV64/RiscVImpl.h>

.data
.align 3
.section .text

//
// Read TIME CSR.
// @retval a0 : 64-bit timer.
//
ASM_FUNC (RiscVReadTimer)
    csrr a0, CSR_TIME
    ret

//
// Set Supervisor Time Compare Register
//
ASM_FUNC (RiscVSetSupervisorTimeCompareRegister)
    csrw  CSR_STIMECMP, a0
    ret