Link to home
Start Free TrialLog in
Avatar of norsethomas
norsethomas

asked on

Linux Assembler: which registers to preserve?


When calling an assembler routine from within a Win32
context, it is clear that the values of EAX, ECX, and EDX
don't have to be preserved (while e.g. EBX, EBP, and ...
have to be preserved).

Can anyone enlighten me, which registers have to be preserved
when calling an assembler routine from within a Linux context?

(context = c or c++ program)
Avatar of trigger-happy
trigger-happy
Flag of Philippines image

It depends on the calling convention that use since both platforms adhere to it:
http://www.programmersheaven.com/2/Calling-conventions

--trigger-happy
Avatar of norsethomas
norsethomas

ASKER


trigger-happy,

thanks for the link, but it doesn't answer my question.

Thomas
oh sorry >.<

I must admit now that i'm not a complete expert in assembly so forgive me if i can't seem to answer your question, although one thing bothers me, is this homework? Because its in EE policies that we don't give answers to homework but instead guide you in finding the answer.

http://www.digitalmars.com/ctg/ctgInlineAsm.html (check the part about using asm registers)

--trigger-happy

No, this is a real world problem, since I have to know
if I have to recode my assembler routines when
porting to Linux (i.e. saving more registers).

Your second link just gives an answer for Win32,
which I already know ;-)

Thomas
SOLUTION
Avatar of trigger-happy
trigger-happy
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial