From 0e0fd5640e042189d14f366c9a5f5dde931ac93a Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sun, 7 Aug 2016 11:07:29 +0200 Subject: [PATCH] simplify code by using the macros PAGE_2M_FLOOR & PAGE_2M_CEIL --- hermit/arch/x86/include/asm/page.h | 5 +++++ hermit/mm/vma.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hermit/arch/x86/include/asm/page.h b/hermit/arch/x86/include/asm/page.h index 7a860c0ff..8cb6adaa7 100644 --- a/hermit/arch/x86/include/asm/page.h +++ b/hermit/arch/x86/include/asm/page.h @@ -102,6 +102,11 @@ static inline size_t sign_extend(ssize_t addr, int bits) /// Align to page #define PAGE_CEIL(addr) ( (addr) & PAGE_MASK) +/// Align to next 2M boundary +#define PAGE_2M_FLOOR(addr) (((addr) + (1L << 21) - 1) & ((~0L) << 21)) +/// Align to nex 2M boundary +#define PAGE_2M_CEIL(addr) ( (addr) & ((~0L) << 21)) + /// Page is present #define PG_PRESENT (1 << 0) /// Page is read- and writable diff --git a/hermit/mm/vma.c b/hermit/mm/vma.c index c7e863dc3..4186fdd39 100644 --- a/hermit/mm/vma.c +++ b/hermit/mm/vma.c @@ -39,9 +39,6 @@ extern const void kernel_start; extern const void kernel_end; -#define PAGE_2M_FLOOR(addr) (((addr) + (1L << 21) - 1) & ((~0L) << 21)) -#define PAGE_2M_CEIL(addr) ( (addr) & ((~0L) << 21)) - /* * Kernel space VMA list and lock *