Skip to content

Commit ccdc8d1

Browse files
committed
Added apple arm64 syscall calling convention to apples platforms
1 parent 78a7827 commit ccdc8d1

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

arch/arm64/arch_arm64.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2684,15 +2684,15 @@ class WindowsArm64SystemCallConvention : public CallingConvention
26842684
virtual bool IsEligibleForHeuristics() override { return false; }
26852685
};
26862686

2687-
class MacosArm64SystemCallConvention : public CallingConvention
2687+
class AppleArm64SystemCallConvention : public CallingConvention
26882688
{
26892689
public:
2690-
MacosArm64SystemCallConvention(Architecture* arch) : CallingConvention(arch, "macos-syscall") {}
2690+
AppleArm64SystemCallConvention(Architecture* arch) : CallingConvention(arch, "apple-syscall") {}
26912691

26922692

26932693
virtual vector<uint32_t> GetIntegerArgumentRegisters() override
26942694
{
2695-
return vector<uint32_t> {REG_X16, REG_X0, REG_X1, REG_X2, REG_X3, REG_X4, REG_X5};
2695+
return vector<uint32_t> {REG_X16, REG_X0, REG_X1, REG_X2, REG_X3, REG_X4, REG_X5, REG_X6, REG_X7, REG_X8};
26962696
}
26972697

26982698

@@ -2708,7 +2708,7 @@ class MacosArm64SystemCallConvention : public CallingConvention
27082708

27092709
virtual uint32_t GetIntegerReturnValueRegister() override { return REG_X0; }
27102710

2711-
2711+
27122712
virtual bool IsEligibleForHeuristics() override { return false; }
27132713
};
27142714

@@ -3492,6 +3492,9 @@ extern "C"
34923492
conv = new WindowsArm64SystemCallConvention(arm64);
34933493
arm64->RegisterCallingConvention(conv);
34943494

3495+
conv = new AppleArm64SystemCallConvention(arm64);
3496+
arm64->RegisterCallingConvention(conv);
3497+
34953498
conv = new AppleArm64CallingConvention(arm64);
34963499
arm64->RegisterCallingConvention(conv);
34973500

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)