CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Toggle main menu visibility
Loading...
Searching...
No Matches
sdk
include
platform
kudu
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
// CHERIoT-Kudu does not yet implement the "cycle" CSR, so read mcycle.
13
__asm__
volatile
(
"csrr %0, mcycle"
:
"=r"
(cycles));
14
return
cycles;
15
}
Generated by
1.18.0