summaryrefslogtreecommitdiff
path: root/cmd/x86
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/x86')
-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;