mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-08 05:53:12 +00:00
Merge pull request #3574 from jasonKercher/i386-syscall6
fix 6 argument syscall on i386
This commit is contained in:
@@ -2835,8 +2835,7 @@ gb_internal lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValu
|
||||
{
|
||||
GB_ASSERT(arg_count <= 7);
|
||||
|
||||
char asm_string_default[] = "int $$0x80";
|
||||
char *asm_string = asm_string_default;
|
||||
char asm_string[] = "int $$0x80";
|
||||
gbString constraints = gb_string_make(heap_allocator(), "={eax}");
|
||||
|
||||
for (unsigned i = 0; i < gb_min(arg_count, 6); i++) {
|
||||
@@ -2848,16 +2847,11 @@ gb_internal lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValu
|
||||
"edx",
|
||||
"esi",
|
||||
"edi",
|
||||
"ebp",
|
||||
};
|
||||
constraints = gb_string_appendc(constraints, regs[i]);
|
||||
constraints = gb_string_appendc(constraints, "}");
|
||||
}
|
||||
if (arg_count == 7) {
|
||||
char asm_string7[] = "push %[arg6]\npush %%ebp\nmov 4(%%esp), %%ebp\nint $0x80\npop %%ebp\nadd $4, %%esp";
|
||||
asm_string = asm_string7;
|
||||
|
||||
constraints = gb_string_appendc(constraints, ",rm");
|
||||
}
|
||||
|
||||
inline_asm = llvm_get_inline_asm(func_type, make_string_c(asm_string), make_string_c(constraints));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user