Coldfire register ABI documentation

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Coldfire register ABI documentation

2,762 次查看
nspon
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

标签 (1)
1 回复

1,210 次查看
bkatt
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.