Register variables notation style = SOLVED!! Thanks Migario

Have a question about our Software Developer Kit? Ask them here.
Post Reply
Belxjander
Posts: 314
Joined: Mon May 14, 2012 10:26 pm
Location: 日本千葉県松戸市 / Matsudo City, Chiba, Japan
Contact:

Register variables notation style = SOLVED!! Thanks Migario

Post by Belxjander »

I'm currently walking into a problem with GCC refusing to follow what is documented for which register to have a named variable placed into.

Ive got ~24 variables I need fixated into a defined register layout around the SysV ABI calling style and I have to keep all changes to these variables when they are in use from a private process across two libraries worth of functions in addition to the private process functionality...

Has anyone else looked at what constraints or other options there are for the current SDK edition of GCC?

If there is any equivalent to declaring a variable in a register and using it from that register for the duration of a function (where the register *will* keep state into the next function call) without leaving the compiler to handle which register the variable ends up in...(I need a specific direct layout for use with inline assembly), I would like to get my hands on some examples please...

this is so that I can actively define an extended API/ABI calling convention within polymorph for its extensive plugin mechanism...
I have tried to follow what I can in the GCC documentation and so far failed to have any C variables retained in a register on calling into inline assembly...

Defining an Inline Assembly block so far has been the easy part... but retaining state on-entry and on-exit from that assembly without the entire system getting mangled in the process has been annoying (so far I have not seen GCC place any variable where I want it and it also insists on prologue and epilogue doing save/restore of the registers concerned... I do not need nor want this... this actively breaks what I am writing)

I was originally able to do this with SAS/C6.58 on the 680x0 series however I would like to get to grips with the same facilities inside GCC as that is the native compiler in the SDK that I can make use of (yes, I admit I am being a picky pain in the ass about this and I have my reasons)

any assistance with examples would be more appreciated than getting the same documentation thrown at me which I have already tried to deal with.
Last edited by Belxjander on Tue Oct 09, 2012 6:08 am, edited 1 time in total.
User avatar
ssolie
Beta Tester
Beta Tester
Posts: 1010
Joined: Mon Dec 20, 2010 8:51 pm
Location: Canada
Contact:

Re: what notation style to use for register variables?

Post by ssolie »

Belxjander wrote:Has anyone else looked at what constraints or other options there are for the current SDK edition of GCC?
GCC is just ported from the standard GCC baseline. There is ample documentation on GCC available on the web. Just use Google to locate it.
ExecSG Team Lead
Belxjander
Posts: 314
Joined: Mon May 14, 2012 10:26 pm
Location: 日本千葉県松戸市 / Matsudo City, Chiba, Japan
Contact:

Re: what notation style to use for register variables?

Post by Belxjander »

I've been working *from* the "generally available documentation" and it does not have any examples that are not x86 based where I can get testable results...

I know I am not seeing something that is there... but the way the current documentation reads to me...the inline assembly and the C language around it don't apparently have any connection at all?

How to know which variable is in what register or tell GCC to put "variable X" into "register 7" for examples?

this is what I am trying to specifically get at in my attempts to make this work properly

--- EDIT ---

I am still not getting anything usable from online documents,

I need at least two tables of functions to accept an extended SysV register layout for arguments and nothing I have found covers this

*ALL* of the existing examples never cross the entry or exit of any functions

is this just one step too much for GCC to accept?

I can't say which order functions in the tables will be called

Also each table is compiled in separate library files so letting GCC handle all that is leaving it all to chance

I have done this in C using SAS/C however that included writing one table module in assembly

Is there nothing for GCC to do anything like this?

I have already wasted a lot of time dealing with ゛existing ゛ documents I refuse to waste any more time following documents that get me nowhere and waste time


Is this too much to ask?
Belxjander
Posts: 314
Joined: Mon May 14, 2012 10:26 pm
Location: 日本千葉県松戸市 / Matsudo City, Chiba, Japan
Contact:

Re: Register variables notation style = SOLVED!! Thanks Mig

Post by Belxjander »

This is actually a three part problem

in older 68K compilers like SAS/C and StormC

variables were able to be register backed in declarations
in GCC this is no longer true

inline assembly is used and requires extra formatting information which is only documented for x86 or amd64 so reading the documentation is futile when dealing with use cases outside that scope

additionally to the above GCC provides access to its internal RTL for function ABI definitions

anyway now that I have gotten the help I originally asked for I will be pushing an update to the relevant projects at the first opportunity



hopefully I can find a workable usage beyond the limited GCC documentation
Post Reply