mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-19 10:09:19 +02:00
arm: arm-aros syscall support
git-svn-id: trunk@34809 -
This commit is contained in:
parent
89c1b68b14
commit
657aa06360
@ -30,18 +30,73 @@ interface
|
|||||||
|
|
||||||
type
|
type
|
||||||
tarmcallnode = class(tcgcallnode)
|
tarmcallnode = class(tcgcallnode)
|
||||||
|
procedure gen_syscall_para(para: tcallparanode); override;
|
||||||
procedure set_result_location(realresdef: tstoreddef);override;
|
procedure set_result_location(realresdef: tstoreddef);override;
|
||||||
|
public
|
||||||
|
procedure do_syscall;override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
verbose,globtype,globals,aasmdata,
|
verbose,globtype,globals,aasmdata,aasmtai,
|
||||||
symconst,
|
symconst,symtype,symbase,symsym,symcpu,parabase,paramgr,
|
||||||
cgbase,cgutils,cpuinfo,
|
cgbase,cgobj,cgutils,cpuinfo,cpubase,cutils,
|
||||||
ncgutil,tgobj,
|
ncgutil,tgobj,nld,
|
||||||
systems;
|
systems;
|
||||||
|
|
||||||
|
procedure tarmcallnode.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 tarmcallnode.do_syscall;
|
||||||
|
var
|
||||||
|
tmpref: treference;
|
||||||
|
libparaloc: pcgparalocation;
|
||||||
|
hsym: tsym;
|
||||||
|
begin
|
||||||
|
case target_info.system of
|
||||||
|
system_arm_aros:
|
||||||
|
begin
|
||||||
|
if (po_syscall_baselast in tprocdef(procdefinition).procoptions) then
|
||||||
|
begin
|
||||||
|
current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('AROS SysCall - BaseLast')));
|
||||||
|
|
||||||
|
cg.getcpuregister(current_asmdata.CurrAsmList,NR_R12);
|
||||||
|
hsym:=tsym(procdefinition.parast.Find('syscalllib'));
|
||||||
|
if not assigned(hsym) then
|
||||||
|
internalerror(2016110605);
|
||||||
|
libparaloc:=tparavarsym(hsym).paraloc[callerside].location;
|
||||||
|
if not assigned(libparaloc) then
|
||||||
|
internalerror(2016110604);
|
||||||
|
|
||||||
|
case libparaloc^.loc of
|
||||||
|
LOC_REGISTER:
|
||||||
|
reference_reset_base(tmpref,libparaloc^.register,-tprocdef(procdefinition).extnumber,sizeof(pint));
|
||||||
|
LOC_REFERENCE:
|
||||||
|
begin
|
||||||
|
reference_reset_base(tmpref,libparaloc^.reference.index,libparaloc^.reference.offset,sizeof(pint));
|
||||||
|
cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,tmpref,NR_R12);
|
||||||
|
reference_reset_base(tmpref,NR_R12,-tprocdef(procdefinition).extnumber,sizeof(pint));
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
internalerror(2016110603);
|
||||||
|
end;
|
||||||
|
|
||||||
|
cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,tmpref,NR_R12);
|
||||||
|
cg.a_call_reg(current_asmdata.CurrAsmList,NR_R12);
|
||||||
|
cg.ungetcpuregister(current_asmdata.CurrAsmList,NR_R12);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
internalerror(2016110601);
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
internalerror(2016110602);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure tarmcallnode.set_result_location(realresdef: tstoreddef);
|
procedure tarmcallnode.set_result_location(realresdef: tstoreddef);
|
||||||
begin
|
begin
|
||||||
if (realresdef.typ=floatdef) and
|
if (realresdef.typ=floatdef) and
|
||||||
@ -77,6 +132,8 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
ccallnode:=tarmcallnode;
|
ccallnode:=tarmcallnode;
|
||||||
end.
|
end.
|
||||||
|
@ -26,7 +26,7 @@ unit symcpu;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
symtype,symdef,symsym,globtype;
|
symtype,symdef,symsym,symconst,globtype;
|
||||||
|
|
||||||
type
|
type
|
||||||
{ defs }
|
{ defs }
|
||||||
@ -92,9 +92,18 @@ type
|
|||||||
|
|
||||||
tcpuprocdef = class(tprocdef)
|
tcpuprocdef = class(tprocdef)
|
||||||
{ the arm paramanager might need to know the total size of the stackframe
|
{ the arm paramanager might need to know the total size of the stackframe
|
||||||
to avoid cyclic unit dependencies or global variables, this infomatation is
|
to avoid cyclic unit dependencies or global variables, this information is
|
||||||
stored in total_stackframe_size }
|
stored in total_stackframe_size }
|
||||||
total_stackframe_size : aint;
|
total_stackframe_size : aint;
|
||||||
|
procedure ppuload_platform(ppufile: tcompilerppufile); override;
|
||||||
|
procedure ppuwrite_platform(ppufile: tcompilerppufile); override;
|
||||||
|
public
|
||||||
|
{ library symbol for AROS }
|
||||||
|
libsym : tsym;
|
||||||
|
libsymderef : tderef;
|
||||||
|
function getcopyas(newtyp: tdeftyp; copytyp: tproccopytyp): tstoreddef; override;
|
||||||
|
procedure buildderef; override;
|
||||||
|
procedure deref; override;
|
||||||
end;
|
end;
|
||||||
tcpuprocdefclass = class of tcpuprocdef;
|
tcpuprocdefclass = class of tcpuprocdef;
|
||||||
|
|
||||||
@ -178,6 +187,52 @@ const
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
|
||||||
|
{****************************************************************************
|
||||||
|
tcpuprocdef
|
||||||
|
****************************************************************************}
|
||||||
|
|
||||||
|
procedure tcpuprocdef.ppuload_platform(ppufile: tcompilerppufile);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if po_syscall_has_libsym in procoptions then
|
||||||
|
ppufile.getderef(libsymderef);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tcpuprocdef.ppuwrite_platform(ppufile: tcompilerppufile);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if po_syscall_has_libsym in procoptions then
|
||||||
|
ppufile.putderef(libsymderef);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function tcpuprocdef.getcopyas(newtyp: tdeftyp; copytyp: tproccopytyp): tstoreddef;
|
||||||
|
begin
|
||||||
|
result:=inherited;
|
||||||
|
if newtyp=procdef then
|
||||||
|
tcpuprocdef(result).libsym:=libsym;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tcpuprocdef.buildderef;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if po_syscall_has_libsym in procoptions then
|
||||||
|
libsymderef.build(libsym);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure tcpuprocdef.deref;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if po_syscall_has_libsym in procoptions then
|
||||||
|
libsym:=tsym(libsymderef.resolve)
|
||||||
|
else
|
||||||
|
libsym:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
{ used tdef classes }
|
{ used tdef classes }
|
||||||
cfiledef:=tcpufiledef;
|
cfiledef:=tcpufiledef;
|
||||||
|
@ -119,6 +119,7 @@ implementation
|
|||||||
system_powerpc_amiga,
|
system_powerpc_amiga,
|
||||||
system_powerpc_morphos,
|
system_powerpc_morphos,
|
||||||
system_m68k_amiga,
|
system_m68k_amiga,
|
||||||
|
system_arm_aros,
|
||||||
system_i386_aros,
|
system_i386_aros,
|
||||||
system_x86_64_aros:
|
system_x86_64_aros:
|
||||||
include(supported_calling_conventions,pocall_syscall);
|
include(supported_calling_conventions,pocall_syscall);
|
||||||
|
@ -2108,7 +2108,7 @@ procedure pd_syscall(pd:tabstractprocdef);
|
|||||||
internalerror(2016090101);
|
internalerror(2016090101);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{$if defined(powerpc) or defined(m68k) or defined(i386) or defined(x86_64)}
|
{$if defined(powerpc) or defined(m68k) or defined(i386) or defined(x86_64) or defined(arm)}
|
||||||
const
|
const
|
||||||
syscall_paranr: array[boolean] of aint =
|
syscall_paranr: array[boolean] of aint =
|
||||||
( paranr_syscall_lib_last, paranr_syscall_lib_first );
|
( paranr_syscall_lib_last, paranr_syscall_lib_first );
|
||||||
@ -2119,12 +2119,12 @@ var
|
|||||||
v: Tconstexprint;
|
v: Tconstexprint;
|
||||||
vo: tvaroptions;
|
vo: tvaroptions;
|
||||||
paranr: aint;
|
paranr: aint;
|
||||||
{$endif defined(powerpc) or defined(m68k) or defined(i386) or defined(x86_64)}
|
{$endif defined(powerpc) or defined(m68k) or defined(i386) or defined(x86_64) or defined(arm)}
|
||||||
begin
|
begin
|
||||||
if (pd.typ<>procdef) and (target_info.system <> system_powerpc_amiga) then
|
if (pd.typ<>procdef) and (target_info.system <> system_powerpc_amiga) then
|
||||||
internalerror(2003042614);
|
internalerror(2003042614);
|
||||||
tprocdef(pd).forwarddef:=false;
|
tprocdef(pd).forwarddef:=false;
|
||||||
{$if defined(powerpc) or defined(m68k) or defined(i386) or defined(x86_64)}
|
{$if defined(powerpc) or defined(m68k) or defined(i386) or defined(x86_64) or defined(arm)}
|
||||||
include_po_syscall;
|
include_po_syscall;
|
||||||
|
|
||||||
if target_info.system = system_m68k_atari then
|
if target_info.system = system_m68k_atari then
|
||||||
@ -2173,7 +2173,7 @@ begin
|
|||||||
Tprocdef(pd).extnumber:=v.uvalue * sizeof(pint)
|
Tprocdef(pd).extnumber:=v.uvalue * sizeof(pint)
|
||||||
else
|
else
|
||||||
Tprocdef(pd).extnumber:=v.uvalue;
|
Tprocdef(pd).extnumber:=v.uvalue;
|
||||||
{$endif defined(powerpc) or defined(m68k) or defined(i386) or defined(x86_64)}
|
{$endif defined(powerpc) or defined(m68k) or defined(i386) or defined(x86_64) or defined(arm)}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ type
|
|||||||
{$endif Test_Double_checksum}
|
{$endif Test_Double_checksum}
|
||||||
|
|
||||||
const
|
const
|
||||||
CurrentPPUVersion = 187;
|
CurrentPPUVersion = 188;
|
||||||
|
|
||||||
{ unit flags }
|
{ unit flags }
|
||||||
uf_init = $000001; { unit has initialization section }
|
uf_init = $000001; { unit has initialization section }
|
||||||
|
Loading…
Reference in New Issue
Block a user