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

Function rdmsr

util/intelmetool/src/msr.c:16–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14static int fd_msr = 0;
15
16static int rdmsr(int addr, uint64_t *msr)
17{
18 if (lseek(fd_msr, (off_t) addr, SEEK_SET) == -1) {
19 perror("Could not lseek() to MSR");
20 close(fd_msr);
21 return -1;
22 }
23
24 if (read(fd_msr, msr, 8) == 8) {
25 close(fd_msr);
26 return 0;
27 }
28
29 if (errno == EIO) {
30 perror("IO error couldn't read MSR.");
31 close(fd_msr);
32 /* On older platforms the MSR might not exists */
33 return -2;
34 }
35
36 perror("Couldn't read() MSR");
37 close(fd_msr);
38 return -1;
39}
40#endif
41
42int msr_bootguard(uint64_t *msr)

Callers 1

msr_bootguardFunction · 0.70

Calls 2

perrorFunction · 0.85
readFunction · 0.85

Tested by

no test coverage detected