Squashed backup commit (no shallow-clone history issues) of xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream commit 9eece662e) plus all fixes applied to get everpal_defconfig building clean against a modern (GCC 15.2.0) toolchain -- see the previous commit message on the lineage-23.2 branch (also in this repo history is not available here since this is a squashed snapshot; full incremental history lives in the local DL380 checkout and the upstream GitHub remote). Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
41 lines
679 B
C
41 lines
679 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <math.h>
|
|
#include <unistd.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
#include <sys/timeb.h>
|
|
#include <sched.h>
|
|
#include <errno.h>
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
int cpu, fd;
|
|
long long msr;
|
|
char msr_file_name[64];
|
|
|
|
if (argc != 2)
|
|
return 1;
|
|
|
|
errno = 0;
|
|
cpu = strtol(argv[1], (char **) NULL, 10);
|
|
|
|
if (errno)
|
|
return 1;
|
|
|
|
sprintf(msr_file_name, "/dev/cpu/%d/msr", cpu);
|
|
fd = open(msr_file_name, O_RDONLY);
|
|
|
|
if (fd == -1) {
|
|
perror("Failed to open");
|
|
return 1;
|
|
}
|
|
|
|
pread(fd, &msr, sizeof(msr), 0x199);
|
|
|
|
printf("msr 0x199: 0x%llx\n", msr);
|
|
return 0;
|
|
}
|