Skip navigation.
 
mlRe: Intel Assembly Language on a Mac
FROM : Ronald Oussoren
DATE : Tue Aug 01 10:40:53 2006

On Jul 30, 2006, at 3:33 PM, Greg wrote:

>
> On Jul 30, 2006, at 4:43 AM, Uli Kusterer wrote:
>

>> Am 29.07.2006 um 22:34 schrieb Andy Armstrong:

>>> OK, but calling a userspace function is not the same as calling 
>>> an O/S function. Disassemble the code your compiler generates for 
>>> a function call and study that.

>>
>>  You're right. Thanks for pointing that out, that looks like code 
>> that is much more easy to understand. Don't know why I didn't 
>> think of that, it's not as if it wasn't similar on other platforms...

>
> All global functions have to follow the same calling conventions - 
> since a caller won't know any other way to call the function. Apple 
> describes the calling conventions as they are defined for both the 
> PowerPC and Intel processors in this document "Mac OS X ABI 
> Function Call Guide" Note that these calling conventions are 
> defined by the architecture in both cases and do not vary by OS.


The last time I checked the ABI description for x86 was slightly 
different from the actual ABI, IIRC all of the differences have to do 
with returning small structures (size <= 8 bytes). It was nothing 
big, but rather annoying when you're trying to port a FFI library 
without knowing much x86 assembly code :-)

The main differences  between the calling conventions on darwin/x86 
and linux are they way you call functions in shared libraries and the 
fact that the stack must be aligned to a multiple of 16 when calling 
functions.

Ronald

Related mailsAuthorDate
mlIntel Assembly Language on a Mac Uli Kusterer Jul 29, 18:11
mlRe: Intel Assembly Language on a Mac Andy Armstrong Jul 29, 18:14
mlRe: Intel Assembly Language on a Mac Uli Kusterer Jul 29, 22:22
mlRe: Intel Assembly Language on a Mac Andy Armstrong Jul 29, 22:34
mlRe: Intel Assembly Language on a Mac Uli Kusterer Jul 30, 13:43
mlRe: Intel Assembly Language on a Mac Andy Armstrong Jul 30, 14:41
mlRe: Intel Assembly Language on a Mac Greg Jul 30, 15:33
mlRe: Intel Assembly Language on a Mac Uli Kusterer Jul 30, 22:08
mlRe: Intel Assembly Language on a Mac Stefan Jul 30, 22:22
mlRe: Intel Assembly Language on a Mac Andy Armstrong Jul 30, 23:57
mlRe: Intel Assembly Language on a Mac George Warner Jul 31, 18:43
mlRe: Intel Assembly Language on a Mac Greg Jul 31, 21:50
mlRe: Intel Assembly Language on a Mac Ronald Oussoren Aug 1, 10:40