CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Toggle main menu visibility
Loading...
Searching...
No Matches
sdk
include
platform
generic-riscv
platform-rdcycle.h
1
// Copyright Microsoft and CHERIoT Contributors.
2
// SPDX-License-Identifier: MIT
3
4
#pragma once
5
6
#include <cdefs.h>
7
8
/// Read the least significant word of the cycle counter.
9
__always_inline
static
int
rdcycle()
10
{
11
int
cycles;
12
// rdcycle is just "csrr %0, cycle" (CSR 0xC00, not mcycle (0xB00)).
13
__asm__
volatile
(
"rdcycle %0"
:
"=r"
(cycles));
14
return
cycles;
15
}
Generated by
1.18.0