Recent

Author Topic: [Solved] ARM - Registers  (Read 6334 times)

darupe

  • New Member
  • *
  • Posts: 15
[Solved] ARM - Registers
« on: April 07, 2015, 03:00:27 am »
Can anyone tell me which registers are being used for method parameters on 32 bit ARM platforms?

I am currently developing an RTTI library which is basically a clone of the one from Delphi (http://docwiki.embarcadero.com/Libraries/XE7/en/System.Rtti). I already got most of the features working, including dynamic method invocation on x86/x64 platforms. However, I really want to support the ARM architecture as well.

Just to be clear, the library is currently based on FPC 2.6.x which means RTTI support is not as advanced as the Delphi implementation. The classes, however, are identical to the ones from Delphi (except for a few additions) and will simply exclude a particular feature if the FPC version does not support it. An example of this is the CodePage property in TRttiAnsiStringType which is only supported by the development version of FPC.

On a side note, does anyone know if work is being done on extended RTTI support such as information about regular published methods?
« Last Edit: April 08, 2015, 07:09:42 am by darupe »

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1327
Re: ARM - Registers
« Reply #1 on: April 07, 2015, 07:36:49 am »
« Last Edit: April 07, 2015, 07:40:04 am by DonAlfredo »

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1327
Re: ARM - Registers
« Reply #2 on: April 07, 2015, 07:51:53 am »
Included the diff against current FPC trunk of (part of) the RTTI work by Steve (from the mailing list).

darupe

  • New Member
  • *
  • Posts: 15
Re: ARM - Registers
« Reply #3 on: April 07, 2015, 08:06:53 am »
Great! It seems that a lot of the missing features are starting to become available. Until now, I could only extract method names and addresses from the virtual method table. Now it seems that I can also determine the calling convention and parameters, just as with published events.

I will join the discussion shortly. At least no one seems to have begun working on the Delphi compatible RTTI classes so my work has not been a waste of time.

avra

  • Hero Member
  • *****
  • Posts: 2003
    • Additional info
Re: ARM - Registers
« Reply #4 on: April 07, 2015, 09:29:06 am »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

darupe

  • New Member
  • *
  • Posts: 15
Re: ARM - Registers
« Reply #5 on: April 07, 2015, 09:52:42 am »
RTTI: http://mantis.freepascal.org/view.php?id=26774

Already saw it in one of the links posted by DonAlfredo. The part I'm working on is the TRtti<...> classes which is based on the functions provided by the TypInfo unit. So far I've only been able to dynamically invoke methods which have been published as properties (events) but with the latest changes, I will be able to invoke regular methods. Sure I can do that already with my implementation of Invoke() by providing the method address but I won't be able to automatically publish such methods for things like web services. That's what the latest changes will enable me to do.
« Last Edit: April 07, 2015, 09:56:18 am by darupe »

darupe

  • New Member
  • *
  • Posts: 15
Re: ARM - Registers
« Reply #6 on: April 07, 2015, 10:10:17 am »
Back to my main question: Does anyone know which registers are used for parameters on ARM and if some types should just be placed on the stack by default like I'm doing with Int64, Double, ... on x86? Also, are registers matched to parameter indexes as on x64 like if a type doesn't fit, throw it on the stack and increment the register index (basically skipping the use of that register)?

Laksen

  • Hero Member
  • *****
  • Posts: 656
    • J-Software
Re: ARM - Registers
« Reply #7 on: April 07, 2015, 11:32:11 am »
The compiler should respect APCS or EABI depending on what's selected during build. You can see how it's actually implemented in compiler/arm/cpupara.pas

darupe

  • New Member
  • *
  • Posts: 15
Re: ARM - Registers
« Reply #8 on: April 07, 2015, 12:50:11 pm »
The compiler should respect APCS or EABI depending on what's selected during build. You can see how it's actually implemented in compiler/arm/cpupara.pas

Just what I needed. Thanks :)

nasa

  • New Member
  • *
  • Posts: 20
Re: [Solved] ARM - Registers
« Reply #9 on: October 29, 2015, 02:43:52 pm »
Hi all.

I´m working on a solution for raspberry PI2 (ARM) but it´s intended to run on windows and linux PC too.
And i need to invoke methods with parameters using RTTI.
I have seen some examples on how to invoke via rtti using new TProcedureSignature type but i could not figure out how to pass the parameters.
 
So @Darupe your solution is working? how can i get the source code, i´m using FPC version 3.1.1 revision 49.965.

Some usage examples will be welcome.

Thanks.

 

TinyPortal © 2005-2018