summaryrefslogtreecommitdiff
path: root/cmd/x86/mtrr.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-04-07 16:40:02 -0600
committerTom Rini <trini@konsulko.com>2025-04-08 11:43:23 -0600
commitff61d6bfd1c9534d3fc2397846a5899639f2e55d (patch)
treedcfe4bc52848a5637c975a3352b57885e5b8a06d /cmd/x86/mtrr.c
parent34820924edbc4ec7803eb89d9852f4b870fa760a (diff)
parentf892a7f397a66d8d09f418d1e0e06dfb48bac27d (diff)
Merge branch 'next'
Note that this undoes the changes of commit cf6d4535cc4c ("x86: emulation: Disable bloblist for now") as that was intended only for the release due to time.
Diffstat (limited to 'cmd/x86/mtrr.c')
-rw-r--r--cmd/x86/mtrr.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/cmd/x86/mtrr.c b/cmd/x86/mtrr.c
index b2afb598c73..289865515ef 100644
--- a/cmd/x86/mtrr.c
+++ b/cmd/x86/mtrr.c
@@ -13,8 +13,8 @@
static int do_mtrr_set(int cpu_select, uint reg, int argc, char *const argv[])
{
const char *typename = argv[0];
- uint32_t start, size;
- uint64_t base, mask;
+ u64 start, size;
+ u64 base, mask;
int type = -1;
bool valid;
int ret;
@@ -26,13 +26,12 @@ static int do_mtrr_set(int cpu_select, uint reg, int argc, char *const argv[])
printf("Invalid type name %s\n", typename);
return CMD_RET_USAGE;
}
- start = hextoul(argv[1], NULL);
- size = hextoul(argv[2], NULL);
+ start = hextoull(argv[1], NULL);
+ size = hextoull(argv[2], NULL);
base = start | type;
valid = native_read_msr(MTRR_PHYS_MASK_MSR(reg)) & MTRR_PHYS_MASK_VALID;
- mask = ~((uint64_t)size - 1);
- mask &= (1ULL << CONFIG_CPU_ADDR_BITS) - 1;
+ mask = mtrr_to_mask(size);
if (valid)
mask |= MTRR_PHYS_MASK_VALID;