-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathcpuinfo_facts.c
More file actions
22 lines (20 loc) · 779 Bytes
/
Copy pathcpuinfo_facts.c
File metadata and controls
22 lines (20 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// This file is part of KASLD - https://github.com/bcoles/kasld
//
// Emit SF_PHYS_ADDR_BITS from /proc/cpuinfo: the CPU's physical-address width,
// which caps the physical address space independent of installed RAM.
// ---
// <bcoles@gmail.com>
#include "include/kasld/api.h"
#include "include/kasld/cpuinfo.h"
KASLD_EXPLAIN("Reads the CPU physical-address width from /proc/cpuinfo and "
"emits it as a scalar fact bounding the physical address space. "
"World-readable, no privileges.");
KASLD_META("method:parsed\n"
"phase:inference\n"
"discloses:facts\n");
int main(void) {
int bits = kasld_read_phys_addr_bits();
if (bits > 0)
kasld_emit_scalar(SF_PHYS_ADDR_BITS, (unsigned long)bits, CONF_PARSED);
return 0;
}