diff options
author | Takashi Kokubun <[email protected]> | 2025-02-06 12:23:31 -0500 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2025-04-18 21:52:56 +0900 |
commit | cf2e305d737c2d217f0509079b86f246aefdae68 (patch) | |
tree | 664764835688f2fc2971079b1d7e6bb52c5a5518 /zjit.c | |
parent | f9b03b237c29993f293c0d17a26cbb2246d489bd (diff) |
Initialize VirtualMem
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/13131
Diffstat (limited to 'zjit.c')
-rw-r--r-- | zjit.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -31,6 +31,24 @@ #include <errno.h> +uint32_t +rb_zjit_get_page_size(void) +{ +#if defined(_SC_PAGESIZE) + long page_size = sysconf(_SC_PAGESIZE); + if (page_size <= 0) rb_bug("zjit: failed to get page size"); + + // 1 GiB limit. x86 CPUs with PDPE1GB can do this and anything larger is unexpected. + // Though our design sort of assume we have fine grained control over memory protection + // which require small page sizes. + if (page_size > 0x40000000l) rb_bug("zjit page size too large"); + + return (uint32_t)page_size; +#else +#error "YJIT supports POSIX only for now" +#endif +} + // Address space reservation. Memory pages are mapped on an as needed basis. // See the Rust mm module for details. uint8_t * |