MCPcopy Create free account
hub / github.com/coreboot/coreboot / rdmsr_from_cpu

Function rdmsr_from_cpu

util/inteltool/cpu.c:133–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133static msr_t rdmsr_from_cpu(int cpu, unsigned long addr)
134{
135 int fd;
136 msr_t msr = { 0xffffffff, 0xffffffff };
137 uint32_t buf[2];
138 char temp_string[50];
139
140 if (open_and_seek(cpu, addr, O_RDONLY, &fd) < 0) {
141 snprintf(temp_string, sizeof(temp_string),
142 "Could not read MSR for CPU#%d", cpu);
143 perror(temp_string);
144 }
145
146 if (read(fd, buf, 8) == 8) {
147 msr.lo = buf[0];
148 msr.hi = buf[1];
149 }
150
151 close(fd);
152
153 return msr;
154}
155
156static int get_number_of_cpus(void)
157{

Callers 5

is_sgx_supportedFunction · 0.70
is_sgx_enabledFunction · 0.70
is_sgx_lockedFunction · 0.70
read_tme_activate_msrFunction · 0.70
is_keylocker_supportedFunction · 0.70

Calls 4

perrorFunction · 0.85
readFunction · 0.85
open_and_seekFunction · 0.70
snprintfFunction · 0.50

Tested by

no test coverage detected