diff --git a/cmake/BuildParameters.cmake b/cmake/BuildParameters.cmake index a1f7b2a326..3e93ec5685 100644 --- a/cmake/BuildParameters.cmake +++ b/cmake/BuildParameters.cmake @@ -119,7 +119,7 @@ elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "arm64" OR "${CMAKE_SYSTEM_PROCESSOR add_compile_options("-march=armv8.4-a" "-mcpu=apple-m1") else() # Require atomic rmw instructions - add_compile_options("-march=armv8.1-a") + add_compile_options("$<$:-march=armv8.1-a>") endif() # If we're running on Linux, we need to detect the page/cache line size. @@ -200,7 +200,10 @@ endif() if(MSVC) # Enable PDB generation in release builds add_compile_options( - $<${CONFIG_REL_NO_DEB}:/Zi> + $<$>:/Zi> + ) + add_compile_options( + $<$>:-g> ) add_link_options( $<${CONFIG_REL_NO_DEB}:/DEBUG> diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index d1bad4494f..0feeb083df 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -126,9 +126,7 @@ if(ARCH_X86) endif() if(WIN32) - enable_language(ASM_MASM) target_sources(common PRIVATE - FastJmp.asm HTTPDownloaderWinHTTP.cpp HTTPDownloaderWinHTTP.h StackWalker.cpp @@ -137,6 +135,16 @@ if(WIN32) Windows/WinHostSys.cpp Windows/WinMisc.cpp ) + + if (ARCH_X86) + enable_language(ASM_MASM) + target_sources(common PRIVATE FastJmp.asm) + elseif (ARCH_ARM64) + enable_language(ASM_MARMASM) + target_sources(common PRIVATE FastJmp_arm64.asm) + set_property(SOURCE FastJmp_arm64.asm PROPERTY VS_SETTINGS "PreprocessWithCl=false") + endif() + target_link_libraries(common PUBLIC WIL::WIL winmm diff --git a/common/FastJmp.cpp b/common/FastJmp.cpp index ad329c2bb9..3eb8ce0910 100644 --- a/common/FastJmp.cpp +++ b/common/FastJmp.cpp @@ -4,7 +4,7 @@ #include "FastJmp.h" // Win32 uses Fastjmp.asm, because MSVC doesn't support inline asm. -#if !defined(_WIN32) || defined(ARCH_ARM64) +#if !defined(_WIN32) #if defined(__APPLE__) #define PREFIX "_" diff --git a/common/FastJmp_arm64.asm b/common/FastJmp_arm64.asm new file mode 100644 index 0000000000..133c3fa68d --- /dev/null +++ b/common/FastJmp_arm64.asm @@ -0,0 +1,50 @@ +; SPDX-FileCopyrightText: 2002-2026 PCSX2 Dev Team +; SPDX-License-Identifier: GPL-3.0+ + +; ----------------------------------------- +; ARM64 +; ----------------------------------------- + AREA |.text|, CODE, ALIGN=4 + + EXPORT fastjmp_set + EXPORT fastjmp_jmp + +; void fastjmp_set(fastjmp_buf*) + ALIGN 16 +fastjmp_set PROC + mov x16, sp + stp x16, x30, [x0] + stp x19, x20, [x0, #16] + stp x21, x22, [x0, #32] + stp x23, x24, [x0, #48] + stp x25, x26, [x0, #64] + stp x27, x28, [x0, #80] + str x29, [x0, #96] + stp d8, d9, [x0, #112] + stp d10, d11, [x0, #128] + stp d12, d13, [x0, #144] + stp d14, d15, [x0, #160] + mov w0, wzr + br x30 +fastjmp_set ENDP + +; void fastjmp_jmp(fastjmp_buf*, int) + ALIGN 16 +fastjmp_jmp PROC + ldp x16, x30, [x0] + mov sp, x16 + ldp x19, x20, [x0, #16] + ldp x21, x22, [x0, #32] + ldp x23, x24, [x0, #48] + ldp x25, x26, [x0, #64] + ldp x27, x28, [x0, #80] + ldr x29, [x0, #96] + ldp d8, d9, [x0, #112] + ldp d10, d11, [x0, #128] + ldp d12, d13, [x0, #144] + ldp d14, d15, [x0, #160] + mov w0, w1 + br x30 +fastjmp_jmp ENDP + + END diff --git a/common/common.vcxproj b/common/common.vcxproj index 3fe40bf9cd..d1bb4f7ac0 100644 --- a/common/common.vcxproj +++ b/common/common.vcxproj @@ -18,6 +18,7 @@ + @@ -51,7 +52,7 @@ - true + true @@ -116,6 +117,12 @@ true + + + true + false + + @@ -194,5 +201,6 @@ + diff --git a/common/common.vcxproj.filters b/common/common.vcxproj.filters index 5e5f3e174b..90128fc5fa 100644 --- a/common/common.vcxproj.filters +++ b/common/common.vcxproj.filters @@ -361,4 +361,9 @@ Source Files + + + Source Files + +