From 7bff9f4cd19d7cd5a0c5007bb6f8b78d294815a0 Mon Sep 17 00:00:00 2001 From: Axel Heider Date: Mon, 5 Jul 2021 04:29:43 +0200 Subject: [PATCH] use BIT() macro instead of explicit shifts As a side effect, the BIT() macro creates a word_t instead of an int, so it can can handle even shift that exceed the int limits. This makes the code more robust and provides the preferred coding pattern. Signed-off-by: Axel Heider --- src/arch/arm/machine/hardware.c | 2 +- src/arch/riscv/machine/hardware.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arch/arm/machine/hardware.c b/src/arch/arm/machine/hardware.c index 840f910ab..98476b456 100644 --- a/src/arch/arm/machine/hardware.c +++ b/src/arch/arm/machine/hardware.c @@ -34,7 +34,7 @@ BOOT_CODE void map_kernel_devices(void) if (!kernel_devices[i].userAvailable) { p_region_t reg = { .start = kernel_devices[i].paddr, - .end = kernel_devices[i].paddr + (1 << PAGE_BITS), + .end = kernel_devices[i].paddr + BIT(PAGE_BITS), }; reserve_region(reg); } diff --git a/src/arch/riscv/machine/hardware.c b/src/arch/riscv/machine/hardware.c index aee9ddb44..d441ceb28 100644 --- a/src/arch/riscv/machine/hardware.c +++ b/src/arch/riscv/machine/hardware.c @@ -50,7 +50,7 @@ BOOT_CODE void map_kernel_devices(void) if (!kernel_devices[i].userAvailable) { p_region_t reg = { .start = kernel_devices[i].paddr, - .end = kernel_devices[i].paddr + (1 << seL4_LargePageBits), + .end = kernel_devices[i].paddr + BIT(seL4_LargePageBits), }; reserve_region(reg); }