mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel/riscv64: Implement Processor::read_cpu_counter
This simply reads the current cycle count from the cycle CSR. x86-64 uses the similar rdtsc instruction here, which also may or may not tick at a constant rate.
This commit is contained in:
parent
c57e39d52b
commit
511e411def
Notes:
sideshowbarker
2024-07-16 23:59:28 +09:00
Author: https://github.com/spholz Commit: https://github.com/SerenityOS/serenity/commit/511e411def Pull-request: https://github.com/SerenityOS/serenity/pull/24055 Reviewed-by: https://github.com/ADKaster ✅
2 changed files with 2 additions and 1 deletions
|
@ -30,6 +30,7 @@ enum class Address : u16 {
|
||||||
SATP = 0x180,
|
SATP = 0x180,
|
||||||
|
|
||||||
// Unprivileged Counters/Timers
|
// Unprivileged Counters/Timers
|
||||||
|
CYCLE = 0xc00,
|
||||||
TIME = 0xc01,
|
TIME = 0xc01,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ ALWAYS_INLINE void ProcessorBase<T>::wait_check()
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ALWAYS_INLINE u64 ProcessorBase<T>::read_cpu_counter()
|
ALWAYS_INLINE u64 ProcessorBase<T>::read_cpu_counter()
|
||||||
{
|
{
|
||||||
TODO_RISCV64();
|
return RISCV64::CSR::read(RISCV64::CSR::Address::CYCLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue