| 1 | #ifndef __wasilibc___macro_PAGESIZE_h |
| 2 | #define __wasilibc___macro_PAGESIZE_h |
| 3 | |
| 4 | /* |
| 5 | * Without custom-page-sizes proposal, the page size in WebAssembly |
| 6 | * is fixed at 64 KiB. |
| 7 | * |
| 8 | * The LLVM versions with a support of custom-page-sizes proposal |
| 9 | * provides __wasm_first_page_end global to allow page-size-agnostic |
| 10 | * objects. |
| 11 | * |
| 12 | * If this ever needs to be a value outside the range of an `int`, the |
| 13 | * `getpagesize` function which returns this value will need special |
| 14 | * consideration. POSIX has deprecated `getpagesize` in favor of |
| 15 | * `sysconf(_SC_PAGESIZE)` which does not have this problem. |
| 16 | */ |
| 17 | #if __clang_major__ >= 22 |
| 18 | extern char __wasm_first_page_end; |
| 19 | #define PAGESIZE ((unsigned long)&__wasm_first_page_end) |
| 20 | #else |
| 21 | #define PAGESIZE (0x10000) |
| 22 | #endif |
| 23 | |
| 24 | #endif |