Skip to content

Commit 4c1c871

Browse files
mostobrivbdash
authored andcommitted
Add Apple arm64 syscall calling convention to Apple's platforms
1 parent 5f21429 commit 4c1c871

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

arch/arm64/arch_arm64.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2692,15 +2692,15 @@ class WindowsArm64SystemCallConvention : public CallingConvention
26922692
virtual bool IsEligibleForHeuristics() override { return false; }
26932693
};
26942694

2695-
class MacosArm64SystemCallConvention : public CallingConvention
2695+
class AppleArm64SystemCallConvention : public CallingConvention
26962696
{
26972697
public:
2698-
MacosArm64SystemCallConvention(Architecture* arch) : CallingConvention(arch, "macos-syscall") {}
2698+
AppleArm64SystemCallConvention(Architecture* arch) : CallingConvention(arch, "apple-syscall") {}
26992699

27002700

27012701
virtual vector<uint32_t> GetIntegerArgumentRegisters() override
27022702
{
2703-
return vector<uint32_t> {REG_X16, REG_X0, REG_X1, REG_X2, REG_X3, REG_X4, REG_X5};
2703+
return vector<uint32_t> {REG_X16, REG_X0, REG_X1, REG_X2, REG_X3, REG_X4, REG_X5, REG_X6, REG_X7, REG_X8};
27042704
}
27052705

27062706

@@ -3500,6 +3500,9 @@ extern "C"
35003500
conv = new WindowsArm64SystemCallConvention(arm64);
35013501
arm64->RegisterCallingConvention(conv);
35023502

3503+
conv = new AppleArm64SystemCallConvention(arm64);
3504+
arm64->RegisterCallingConvention(conv);
3505+
35033506
conv = new AppleArm64CallingConvention(arm64);
35043507
arm64->RegisterCallingConvention(conv);
35053508

platform/mac/platform_mac.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ class MacArm64Platform: public Platform
143143
RegisterFastcallCallingConvention(cc);
144144
RegisterStdcallCallingConvention(cc);
145145
}
146+
147+
cc = arch->GetCallingConventionByName("apple-syscall");
148+
if (cc)
149+
SetSystemCallConvention(cc);
146150
}
147151

148152
virtual bool GetFallbackEnabled() override
@@ -232,6 +236,11 @@ class IOSArm64Platform: public Platform
232236
RegisterFastcallCallingConvention(cc);
233237
RegisterStdcallCallingConvention(cc);
234238
}
239+
240+
cc = arch->GetCallingConventionByName("apple-syscall");
241+
if (cc)
242+
SetSystemCallConvention(cc);
243+
235244
}
236245

237246
virtual bool GetFallbackEnabled() override

0 commit comments

Comments
 (0)