diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2022-03-23 10:23:00 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2022-03-23 10:23:00 +0100 |
| commit | fa07a0f3310858c7000762d10778e42ace256a40 (patch) | |
| tree | a23d4e80bb01ae31d58e3468251fff00ffd5a9bf | |
| parent | 44a20349e3d07af9b1e65f261be2ed150e86b11e (diff) | |
| download | box64-fa07a0f3310858c7000762d10778e42ace256a40.tar.gz box64-fa07a0f3310858c7000762d10778e42ace256a40.zip | |
Added a better way to select 16K pages, and added M1 paragraph in COMPILE.md
| -rwxr-xr-x | CMakeLists.txt | 8 | ||||
| -rwxr-xr-x | docs/COMPILE.md | 17 | ||||
| -rw-r--r-- | src/custommem.c | 7 |
3 files changed, 31 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 658f0cff..537a797f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,9 +41,13 @@ if(RK3399 OR ODROIDN2 OR RPI4ARM64 OR RK3326 OR TEGRAX1 OR PHYTIUM OR SD845 OR L set(NOALIGN OFF CACHE BOOL "") set(ARM_DYNAREC ON CACHE BOOL "") endif() +if(M1 OR LARCH64) + set(LD80BITS OFF CACHE BOOL "") +endif() option(LD80BITS "Set to ON if host device have 80bits long double (i.e. i386)" ${LD80BITS}) option(NOALIGN "Set to ON if host device doesn't need re-align (i.e. i386)" ${NOALIGN}) option(ARM_DYNAREC "Set to ON to use ARM Dynamic Recompilation" ${ARM_DYNAREC}) +option(PAGE16K "Set to ON if host device have PageSize of 16K (instead of 4K)" ${PAGE16K}) if(${CMAKE_VERSION} VERSION_LESS "3.12.2") find_package(PythonInterp 3) @@ -123,6 +127,10 @@ elseif(ARM_DYNAREC) set(CMAKE_ASM_FLAGS "-pipe -march=armv8-a+crc+simd+crypto") endif() +if(PAGE16K) + add_definitions(-DPAGE16K) +endif() + if(NOGIT) add_definitions(-DNOGIT) endif() diff --git a/docs/COMPILE.md b/docs/COMPILE.md index 0238a040..175ad170 100755 --- a/docs/COMPILE.md +++ b/docs/COMPILE.md @@ -80,6 +80,23 @@ If it's the first install, you also need: sudo systemctl restart systemd-binfmt ``` +#### for M1 + +Only test on Asahi for now, using the default "16K page" kernel + +``` +git clone https://github.com/ptitSeb/box64 +cd box64 +mkdir build; cd build; cmake .. -DM1=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo +make -j4 +sudo make install +``` +If it's the first install, you also need: +``` +sudo systemctl restart systemd-binfmt +``` + + #### for Other ARM64 Linux platforms `mkdir build; cd build; cmake .. -DARM_DYNAREC=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo; make -j$(nproc)` diff --git a/src/custommem.c b/src/custommem.c index ede78b6f..c11e1557 100644 --- a/src/custommem.c +++ b/src/custommem.c @@ -42,7 +42,7 @@ static uintptr_t* box64_jmptbldefault1[1<<JMPTABL_SHIFT]; static uintptr_t box64_jmptbldefault0[1<<JMPTABL_SHIFT]; #endif static pthread_mutex_t mutex_prot; -#if defined(LA464) || defined(M1) +#if defined(PAGE16K) #define MEMPROT_SHIFT 14 #define MEMPROT_SHIFT2 (16+14) #else @@ -1236,6 +1236,11 @@ void init_custommem_helper(box64context_t* ctx) mapmem->begin = 0x0; mapmem->end = (uintptr_t)LOWEST - 1; loadProtectionFromMap(); + // check if PageSize is correctly defined + if(box64_pagesize != (1<<MEMPROT_SHIFT)) { + printf_log(LOG_NONE, "Error: PageSize configuation is wrong: configured with %d, but got %d\n", 1<<MEMPROT_SHIFT, box64_pagesize); + exit(-1); // abort or let it continue? + } } void fini_custommem_helper(box64context_t *ctx) |