Merge changes from topic "bionic no page size macro" into main am: 6e73f92f04

Original change: https://android-review.googlesource.com/c/platform/bionic/+/2702053

Change-Id: I5049679f69de64228bc43bbf52e4df5a3883d0ad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Juan Yescas 2023-08-11 06:47:23 +00:00 committed by Automerger Merge Worker
commit d277b4a2b4
2 changed files with 5 additions and 8 deletions

View file

@ -34,8 +34,10 @@
__BEGIN_DECLS __BEGIN_DECLS
#if !defined(__BIONIC_NO_PAGE_SIZE_MACRO)
#define PAGE_SIZE 4096 #define PAGE_SIZE 4096
#define PAGE_MASK (~(PAGE_SIZE - 1)) #define PAGE_MASK (~(PAGE_SIZE - 1))
#endif
#if defined(__i386__) #if defined(__i386__)

View file

@ -24,16 +24,11 @@
#include <sys/user.h> #include <sys/user.h>
inline size_t page_size() { inline size_t page_size() {
/* #if defined(PAGE_SIZE)
* PAGE_SIZE defines the maximum supported page size. Since 4096 is the
* minimum supported page size we can just let it be constant folded if it's
* also the maximum.
*/
#if PAGE_SIZE == 4096
return PAGE_SIZE; return PAGE_SIZE;
#else #else
static size_t size = getauxval(AT_PAGESZ); static const size_t page_size = getauxval(PAGE_SIZE);
return size; return page_size;
#endif #endif
} }