|
@@ -31,9 +31,12 @@ interface
|
|
|
|
|
|
type
|
|
|
tx8664callnode = class(tx86callnode)
|
|
|
- protected
|
|
|
+ protected
|
|
|
+ procedure gen_syscall_para(para: tcallparanode); override;
|
|
|
procedure extra_call_code;override;
|
|
|
procedure set_result_location(realresdef: tstoreddef);override;
|
|
|
+ public
|
|
|
+ procedure do_syscall;override;
|
|
|
end;
|
|
|
|
|
|
|
|
@@ -41,10 +44,53 @@ implementation
|
|
|
|
|
|
uses
|
|
|
globtype,
|
|
|
- systems,
|
|
|
+ systems,verbose,cutils,
|
|
|
cpubase,cgbase,cgutils,cgobj,
|
|
|
+ symsym,symcpu,nld,
|
|
|
aasmtai,aasmdata,aasmcpu;
|
|
|
|
|
|
+{ uses
|
|
|
+ globtype,systems,
|
|
|
+ cutils,verbose,globals,
|
|
|
+ cgbase,cgutils,
|
|
|
+ cpubase,paramgr,
|
|
|
+ aasmtai,aasmdata,aasmcpu,
|
|
|
+ nbas,nmem,nld,ncnv,
|
|
|
+ symdef,symsym,symcpu,
|
|
|
+ cga,cgobj,cpuinfo;}
|
|
|
+
|
|
|
+
|
|
|
+ procedure tx8664callnode.do_syscall;
|
|
|
+ var
|
|
|
+ tmpref: treference;
|
|
|
+ begin
|
|
|
+ case target_info.system of
|
|
|
+ system_x86_64_aros:
|
|
|
+ begin
|
|
|
+ // one syscall convention for AROS
|
|
|
+ current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('AROS SysCall')));
|
|
|
+ reference_reset(tmpref,sizeof(pint));
|
|
|
+ tmpref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(tcpuprocdef(procdefinition).libsym).mangledname);
|
|
|
+ cg.getcpuregister(current_asmdata.CurrAsmList,NR_RAX);
|
|
|
+ cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,tmpref,NR_RAX);
|
|
|
+ reference_reset_base(tmpref,NR_EAX,-tprocdef(procdefinition).extnumber,sizeof(pint));
|
|
|
+ cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,tmpref,NR_RAX);
|
|
|
+ cg.a_call_reg(current_asmdata.CurrAsmList,NR_RAX);
|
|
|
+ cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_RAX);
|
|
|
+ end;
|
|
|
+ else
|
|
|
+ internalerror(2015062801);
|
|
|
+ end;
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
+ procedure tx8664callnode.gen_syscall_para(para: tcallparanode);
|
|
|
+ begin
|
|
|
+ { lib parameter has no special type but proccalloptions must be a syscall }
|
|
|
+ para.left:=cloadnode.create(tcpuprocdef(procdefinition).libsym,tcpuprocdef(procdefinition).libsym.owner);
|
|
|
+ end;
|
|
|
+
|
|
|
+
|
|
|
procedure tx8664callnode.extra_call_code;
|
|
|
var
|
|
|
mmregs : aint;
|