11 January 2020, 18:05 | #1 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
Calling convention for gcc (m68k-amigaos)
When I call an assembler function, d0/d1 and a0/a1 don't need to be saved?
The first four params are passed in d0/d1 and a0/a1, or does this depend on wether it's a pointer or value? Is there some compiler hint to tell the compiler which registers a param might be expected in? |
11 January 2020, 18:13 | #2 | |
Total Chaos forever!
Join Date: Aug 2007
Location: Waterville, MN, USA
Age: 49
Posts: 2,216
|
Quote:
Whether it's a pointer or not matters. Yes, GCC has register directives for passing parameters in to subroutines and especially inline Assembly. |
|
11 January 2020, 18:13 | #3 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,406
|
With gcc, the params are passed on stack if you don't specify anything (that's empiric, it worked for a quick test I did).
Bebbo gcc 6 supports SDI_compiler include. You can specify "passing by register" and which register. Return value is always taken from D0 (here the return type is void so it doesn't matter) Code:
#ifndef SDI_COMPILER_H #include <SDI_compiler.h> #endif void ASM mt_install_cia(REG(a6, void *custom), REG(a0, void *VectorBase), REG(d0, UBYTE PALflag)); |
11 January 2020, 18:36 | #4 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
Thanks! When I use that REG() notation, do I still need to preserve the register, or does the compiler know in this case that it can get scratched?
It's still faster if I don't have to translate the registers, so it still makes sense to use this anyway. Which include is this defined in? I'm using the 1.3 includes, is this also supported there because I can't find any traces of this (also not in the OS 2.x+ includes). |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
m68k-amigaos-gdb | bebbo | Coders. C/C++ | 94 | 06 May 2023 21:56 |
trying to make m68k-amigaos-gdb on windows | jotd | Coders. C/C++ | 12 | 30 December 2020 06:09 |
Motorola m68k support saved from being removed In GCC 11 | nogginthenog | Coders. General | 4 | 28 November 2019 19:29 |
m68k-amigaos-ld.exe bug ? | FrenchShark | Coders. General | 2 | 30 November 2009 09:54 |
Shorten ported to AmigaOS m68k and WarpOS | Paul | News | 0 | 20 August 2006 12:05 |
|
|