CHERIoT RTOS
A compartmentalised RTOS for CHERIoT hardware
Toggle main menu visibility
Loading...
Searching...
No Matches
sdk
include
platform
sail
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
/**
9
* Read the least significant word of something like a "cycle" counter.
10
*
11
* On sail, this reports the number of instructions retired; the cycle count is
12
* meaningless.
13
*/
14
__always_inline
static
int
rdcycle()
15
{
16
int
cycles;
17
__asm__
volatile
(
"csrr %0, minstret"
:
"=r"
(cycles));
18
return
cycles;
19
}
Generated by
1.18.0