mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 20:58:22 +00:00
kvmclock: initial implementation
This commit is contained in:
@@ -12,6 +12,8 @@
|
||||
#define MSR_GSBASE 0xC0000101
|
||||
#define MSR_KERNELGSBASE 0xC0000102
|
||||
|
||||
#define MSR_KVM_SYSTEM_TIME_NEW 0x4b564d01
|
||||
|
||||
static inline uint64_t rdmsr(uint32_t which) {
|
||||
uint64_t low,high;
|
||||
asm volatile("rdmsr" : "=a"(low), "=d"(high) : "c"(which));
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef _TSC_H
|
||||
#define _TSC_H
|
||||
|
||||
static inline uint64_t rdtsc_serialized(void) {
|
||||
uint32_t high;
|
||||
uint32_t low;
|
||||
asm volatile("cpuid; rdtsc;" : "=a"(low), "=d"(high) : : "rbx", "rcx");
|
||||
return ((uint64_t)high << 32) | low;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user