Skip to contentSkip to conversation

GCC Register Usage

DISCUSSION [email protected] 2 participants 2 messages Jun 26, 2002 – Jun 27, 2002

lore
Share & tools
lore
#0 lore raw

I'm calling some assembly code from GCC
and I need to know which registers I'm supposed to preserve and which can be trashed.
I believe I can trash EAX (function return result), ECX and EDX, but I want to make sure. Thanks,
Randy Hyde

#1 lore raw
Quoted 5 lines · On Wed, 26 Jun 2002 [email protected] wrote:

I'm calling some assembly code from GCC
and I need to know which registers I'm supposed to preserve and which can be trashed.
I believe I can trash EAX (function return result), ECX and EDX, but I want to make sure.

Yes, you are right (for a common case).
I guess that you can trash everything in GCC inline asm statements (of course then you need to tell GCC to save registers it needs), though I'm not sure.

Signature · 2 lines
Regards,
Konstantin