mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Merge pull request #1407 from Platin21/feature/fix-supervisor-call
Fix Syscall Intrinsic on ARM64 MacOS
This commit is contained in:
@@ -2060,6 +2060,26 @@ lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValue const &tv,
|
|||||||
{
|
{
|
||||||
GB_ASSERT(arg_count <= 7);
|
GB_ASSERT(arg_count <= 7);
|
||||||
|
|
||||||
|
if(build_context.metrics.os == TargetOs_darwin) {
|
||||||
|
char asm_string[] = "svc #0x80";
|
||||||
|
gbString constraints = gb_string_make(heap_allocator(), "={x0}");
|
||||||
|
for (unsigned i = 0; i < arg_count; i++) {
|
||||||
|
constraints = gb_string_appendc(constraints, ",{");
|
||||||
|
static char const *regs[] = {
|
||||||
|
"x16",
|
||||||
|
"x0",
|
||||||
|
"x1",
|
||||||
|
"x2",
|
||||||
|
"x3",
|
||||||
|
"x4",
|
||||||
|
"x5",
|
||||||
|
};
|
||||||
|
constraints = gb_string_appendc(constraints, regs[i]);
|
||||||
|
constraints = gb_string_appendc(constraints, "}");
|
||||||
|
}
|
||||||
|
|
||||||
|
inline_asm = llvm_get_inline_asm(func_type, make_string_c(asm_string), make_string_c(constraints));
|
||||||
|
} else {
|
||||||
char asm_string[] = "svc #0";
|
char asm_string[] = "svc #0";
|
||||||
gbString constraints = gb_string_make(heap_allocator(), "={x0}");
|
gbString constraints = gb_string_make(heap_allocator(), "={x0}");
|
||||||
for (unsigned i = 0; i < arg_count; i++) {
|
for (unsigned i = 0; i < arg_count; i++) {
|
||||||
@@ -2078,6 +2098,7 @@ lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValue const &tv,
|
|||||||
}
|
}
|
||||||
|
|
||||||
inline_asm = llvm_get_inline_asm(func_type, make_string_c(asm_string), make_string_c(constraints));
|
inline_asm = llvm_get_inline_asm(func_type, make_string_c(asm_string), make_string_c(constraints));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user