[rtems commit] bsps/powerpc: Fix PAGE_ALIGN() macros

Sebastian Huber sebh at rtems.org
Mon Mar 4 08:25:35 UTC 2019


Module:    rtems
Branch:    master
Commit:    e1fc23f057822b54ae7dceedcca025febdf4dcc2
Changeset: http://git.rtems.org/rtems/commit/?id=e1fc23f057822b54ae7dceedcca025febdf4dcc2

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Mon Mar  4 09:20:43 2019 +0100

bsps/powerpc: Fix PAGE_ALIGN() macros

Previous warning fixes which include <sys/param.h> broke this macro.
The definition of PAGE_MASK changed.

---

 bsps/powerpc/motorola_powerpc/bootloader/misc.c | 2 +-
 bsps/powerpc/motorola_powerpc/bootloader/mm.c   | 2 +-
 bsps/powerpc/shared/start/pgtbl_setup.c         | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bsps/powerpc/motorola_powerpc/bootloader/misc.c b/bsps/powerpc/motorola_powerpc/bootloader/misc.c
index 40bd8a7..0b8e42c 100644
--- a/bsps/powerpc/motorola_powerpc/bootloader/misc.c
+++ b/bsps/powerpc/motorola_powerpc/bootloader/misc.c
@@ -25,7 +25,7 @@
 #include <bsp.h>
 
 /* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
+#define PAGE_ALIGN(addr)	(((addr) + PAGE_MASK) & ~PAGE_MASK)
 
 SPR_RO(PPC_PVR)
 
diff --git a/bsps/powerpc/motorola_powerpc/bootloader/mm.c b/bsps/powerpc/motorola_powerpc/bootloader/mm.c
index 13479cb..1b3df41 100644
--- a/bsps/powerpc/motorola_powerpc/bootloader/mm.c
+++ b/bsps/powerpc/motorola_powerpc/bootloader/mm.c
@@ -45,7 +45,7 @@
 #include <limits.h>
 
 /* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
+#define PAGE_ALIGN(addr)	(((addr) + PAGE_MASK) & ~PAGE_MASK)
 
 extern void (tlb_handlers)(void);
 extern void (_handler_glue)(void);
diff --git a/bsps/powerpc/shared/start/pgtbl_setup.c b/bsps/powerpc/shared/start/pgtbl_setup.c
index f2543f5..a52e73b 100644
--- a/bsps/powerpc/shared/start/pgtbl_setup.c
+++ b/bsps/powerpc/shared/start/pgtbl_setup.c
@@ -16,7 +16,7 @@
  *       *pmemsize by the size of the page table.
  */
 /* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)	(((addr)+PAGE_SIZE-1)&PAGE_MASK)
+#define PAGE_ALIGN(addr)	(((addr) + PAGE_MASK) & ~PAGE_MASK)
 
 
 /*




More information about the vc mailing list