Register conventions in FreeBSD assembler

Jonathon McKitrick jcm at
Thu Aug 25 06:42:24 PDT 2005

Hi all,

I'm doing some fun encryption stuff with assembler, and I was wondering if
there are any register usage conventions I should be aware of.  Here's what I
have so far.

These are pretty obvious:

1.  The return value of EAX is the C function return value.
2.  ECX is often used as a counter.
3.  ESI/EDI are used as source/destination for array/string operations.

But I'm looking for less obvious stuff that might be important, like these
I found:

1.  EBX is expected to be unchanged over C function calls.
2.  ESI/EDI are also expected to be unchanged over C calls.

Are there any others I should be aware of?


More information about the Kernel mailing list