Skip to content

Commit d7d90c6

Browse files
committed
add detection for riscv sv48 and sv57 mmu's
1 parent ccac92e commit d7d90c6

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -475,13 +475,21 @@ else()
475475
# list(APPEND mi_defines MI_WIN_INIT_USE_CRT_TLS=1)
476476
endif()
477477

478-
# Check /proc/cpuinfo for an SV39 MMU and limit the virtual address bits.
479-
# (this will skip the aligned hinting in that case. Issue #939, #949)
478+
# Check /proc/cpuinfo for an SV39/48/57 MMU and limit the virtual address bits.
479+
# (for sv39, this will skip the aligned hinting in that case. Issue #939, #949)
480480
if (EXISTS /proc/cpuinfo)
481481
file(STRINGS /proc/cpuinfo mi_sv39_mmu REGEX "^mmu[ \t]+:[ \t]+sv39$")
482+
file(STRINGS /proc/cpuinfo mi_sv48_mmu REGEX "^mmu[ \t]+:[ \t]+sv48$")
483+
file(STRINGS /proc/cpuinfo mi_sv57_mmu REGEX "^mmu[ \t]+:[ \t]+sv57$")
482484
if (mi_sv39_mmu)
483485
MESSAGE( STATUS "Set virtual address bits to 39 (SV39 MMU detected)" )
484486
list(APPEND mi_defines MI_DEFAULT_VIRTUAL_ADDRESS_BITS=39)
487+
elseif (mi_sv48_mmu)
488+
MESSAGE( STATUS "Set virtual address bits to 48 (SV48 MMU detected)" )
489+
list(APPEND mi_defines MI_DEFAULT_VIRTUAL_ADDRESS_BITS=48)
490+
elseif (mi_sv57_mmu)
491+
MESSAGE( STATUS "Set virtual address bits to 57 (SV57 MMU detected)" )
492+
list(APPEND mi_defines MI_DEFAULT_VIRTUAL_ADDRESS_BITS=57)
485493
endif()
486494
endif()
487495

0 commit comments

Comments
 (0)