Common: Use an asm file for WoA

This commit is contained in:
TheLastRar
2026-09-19 13:07:54 -04:00
committed by Ty
parent e73e868a57
commit b08d734c75
6 changed files with 80 additions and 6 deletions
+5 -2
View File
@@ -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("$<$<COMPILE_LANGUAGE:C,CXX>:-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>
$<$<AND:${CONFIG_REL_NO_DEB},$<COMPILE_LANGUAGE:C,CXX,ASM_MASM>>:/Zi>
)
add_compile_options(
$<$<AND:${CONFIG_REL_NO_DEB},$<COMPILE_LANGUAGE:ASM_MARMASM>>:-g>
)
add_link_options(
$<${CONFIG_REL_NO_DEB}:/DEBUG>
+10 -2
View File
@@ -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
+1 -1
View File
@@ -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 "_"
+50
View File
@@ -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
+9 -1
View File
@@ -18,6 +18,7 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
<Import Project="$(VCTargetsPath)\BuildCustomizations\marmasm.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="vsprops\common.props" />
@@ -51,7 +52,7 @@
<ClCompile Include="DynamicLibrary.cpp" />
<ClCompile Include="Error.cpp" />
<ClCompile Include="FastJmp.cpp">
<ExcludedFromBuild Condition="'$(Platform)'!='ARM64'">true</ExcludedFromBuild>
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="FileSystem.cpp" />
<ClCompile Include="Image.cpp" />
@@ -116,6 +117,12 @@
<ExcludedFromBuild Condition="'$(Platform)'!='x64'">true</ExcludedFromBuild>
</MASM>
</ItemGroup>
<ItemGroup>
<MARMASM Include="FastJmp_arm64.asm">
<ExcludedFromBuild Condition="'$(Platform)'!='ARM64'">true</ExcludedFromBuild>
<PreprocessWithCl>false</PreprocessWithCl>
</MARMASM>
</ItemGroup>
<ItemGroup>
<ClInclude Include="BitUtils.h" />
<ClInclude Include="AlignedMalloc.h" />
@@ -194,5 +201,6 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
<Import Project="$(VCTargetsPath)\BuildCustomizations\marmasm.targets" />
</ImportGroup>
</Project>
+5
View File
@@ -361,4 +361,9 @@
<Filter>Source Files</Filter>
</MASM>
</ItemGroup>
<ItemGroup>
<MARMASM Include="FastJmp_arm64.asm">
<Filter>Source Files</Filter>
</MARMASM>
</ItemGroup>
</Project>