PAGESIZE and PAGEMASK seems as common macro

This commit is contained in:
Stanley 2023-09-10 14:35:30 +08:00 committed by Xiang Xiao
parent 83ac6c7c43
commit 56286a72c6

View File

@ -48,17 +48,18 @@
*/ */
#if CONFIG_PAGING_PAGESIZE == 1024 #if CONFIG_PAGING_PAGESIZE == 1024
# define PAGESIZE 1024
# define PAGESHIFT 10 # define PAGESHIFT 10
# define PAGEMASK 0x000003ff
#elif CONFIG_PAGING_PAGESIZE == 4096 #elif CONFIG_PAGING_PAGESIZE == 4096
# define PAGESIZE 4096
# define PAGESHIFT 12 # define PAGESHIFT 12
# define PAGEMASK 0x00000fff
#else #else
# error "Need extended definitions for CONFIG_PAGING_PAGESIZE" # error "Need extended definitions for CONFIG_PAGING_PAGESIZE"
#endif #endif
/* Common page macros */
# define PAGESIZE (1 << PAGESHIFT)
# define PAGEMASK (PAGESIZE - 1)
/* Alignment macros */ /* Alignment macros */
#define PG_ALIGNDOWN(addr) ((addr) & ~PAGEMASK) #define PG_ALIGNDOWN(addr) ((addr) & ~PAGEMASK)