Compare commits

..

11 Commits

Author SHA1 Message Date
Dr-Noob
c4a7761a12 Add description for missign extensions 2025-10-30 19:28:34 +01:00
Dr-Noob
d36123a363 Completing extension strings... 2025-10-30 09:07:04 +01:00
Dr-Noob
8f40c45211 Fixes 2025-10-30 08:49:25 +01:00
Dr-Noob
6713af7de1 Fixes 2025-10-30 08:49:07 +01:00
Dr-Noob
9bd50264b3 Fixes 2025-10-30 08:36:50 +01:00
Dr-Noob
bdadac5dd8 Fixes 2025-10-30 08:35:58 +01:00
Dr-Noob
e823c769ff Attempting to replace 64-bit mask with bool array 2025-10-30 08:33:27 +01:00
Dr-Noob
2116f19073 Delete repeated entry 2025-10-30 07:48:21 +01:00
Dr-Noob
8ce24150e7 Add IME 2025-10-29 22:44:22 +01:00
Dr-Noob
a0cb54dc8b Add IME 2025-10-29 22:43:50 +01:00
Dr-Noob
8e6b0b1a2b Crazy amount of new extensions! 2025-10-29 22:39:22 +01:00
4 changed files with 3 additions and 59 deletions

View File

@@ -30,7 +30,7 @@ ifneq ($(OS),Windows_NT)
HEADERS += $(SRC_DIR)freq/freq.h
CFLAGS += -pthread
endif
ifeq ($(os), $(filter $(os), FreeBSD Darwin))
ifeq ($(os), FreeBSD)
SOURCE += $(SRC_COMMON)sysctl.c
HEADERS += $(SRC_COMMON)sysctl.h
endif

56
msr.c
View File

@@ -1,56 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#define MSR_PSTATE_0 0xC0010064
// Reads a 64-bit MSR value from a given CPU core
int read_msr(int cpu, uint64_t msr_addr, uint64_t *value) {
char msr_path[64];
snprintf(msr_path, sizeof(msr_path), "/dev/cpu/%d/msr", cpu);
int fd = open(msr_path, O_RDONLY);
if (fd < 0) {
perror("open");
return -1;
}
if (lseek(fd, msr_addr, SEEK_SET) == -1) {
perror("lseek");
close(fd);
return -1;
}
if (read(fd, value, sizeof(*value)) != sizeof(*value)) {
perror("read");
close(fd);
return -1;
}
close(fd);
return 0;
}
int main(int argc, char **argv) {
int cpu = 0;
if (argc > 1) cpu = atoi(argv[1]);
uint64_t val;
if (read_msr(cpu, MSR_PSTATE_0, &val) != 0) {
fprintf(stderr, "Failed to read MSR on CPU %d\n", cpu);
return 1;
}
unsigned int fid = val & 0xff; // bits [7:0]
unsigned int did = (val >> 8) & 0x3f; // bits [13:8]
double freq_mhz = (fid * 25.0) / (1 << did); // 25 MHz ref clock on Zen CPUs
printf("CPU%d: MSR[0x%lx] = 0x%016llx\n", cpu, (unsigned long)MSR_PSTATE_0, (unsigned long long)val);
printf("FID: %u, DID: %u\n", fid, did);
printf("Estimated frequency: %.2f MHz\n", freq_mhz);
return 0;
}

View File

@@ -138,7 +138,7 @@ struct features {
struct extensions {
char* str;
bool* mask; // allocated at runtime with size RISCV_ISA_EXT_ID_MAX
bool* mask; // allocated at runtime with size RISCV_ISA_EXT_ID_MAX-1
};
struct cpuInfo {

View File

@@ -62,7 +62,7 @@
#endif
#ifndef GIT_FULL_VERSION
static const char* VERSION = "1.07";
static const char* VERSION = "1.06";
#endif
enum {