Coldfire register ABI documentation

cancel
Showing results for 
Search instead for 
Did you mean: 

Coldfire register ABI documentation

1,591 Views
Contributor II

I'm trying to rewrite some ColdFire assembler routines so they can switch to the Register ABI calling conventions under CW for CF 7.1.2, but I have hit two problems:

- the Build Tools Reference Manual doesn't actually describe the register calling convention, just the standard one.

- nor does it describe what (if any) conditional flags are available; by searching the MSL I have discovered that there is a C symbol __REGABI_, but that doesn't seem to work for assembler source (i.e a .s file)

 

Is this documented somewhere else; I get the impression I'm looking in the wrong place?

 

Thanks,

-- Nigel

Labels (1)
1 Reply

39 Views
Contributor IV

nspon wrote:

  

- the Build Tools Reference Manual doesn't actually describe the register calling convention, just the standard one.

 

- nor does it describe what (if any) conditional flags are available; by searching the MSL I have discovered that there is a C symbol __REGABI_, but that doesn't seem to work for assembler source (i.e a .s file)



I never found a predefined conditional, so I defined __REGABI__ myself in each of 4 assembly source files. There are also declspecs you can use on the function declaration to force a particular function to always use a specified calling convention.

 

The register calling convention puts the first 3 integer arguments in D0, D1, and D2, and the first 2 pointer arguments in A0 and A1. I've never done floating point in coldfire, but I would guess the first 3 double arguments would go to FP0, FP1, and FP2. 

 

Note that GCC uses something like the standard ABI, but with register D2 preserved by functions and pointers returned in D0. If you use .S as the assembly suffix, GCC invokes the preprocessor so you can easily create assembly source compatible with either compiler.