Skip navigation.
 
mlRe: Intel Assembly Language on a Mac
FROM : Greg
DATE : Mon Jul 31 21:50:27 2006

On Jul 31, 2006, at 9:43 AM, George Warner wrote:

> On Sun, 30 Jul 2006 06:33:45 -0700, Greg <<email_removed>> 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.

>
> Actually there are differences between Mac OS X & "other" Intel 
> based OSes.
> The first one I remember was that the stack on Mac OS X is always 4-
> byte
> aligned where on the "other" OSes it's not. This has caused 
> performance
> problem for some emulators (since it can only be "fixed" in an 
> exception
> handler).
>
> There's also differences in the calling conventions specifically how
> parameters are passed (IIRC we attempt to pass as much as possible in
> registers while reserving room on the stack in case the routine 
> being called
> needs to (temporarily?) use those registers.


The Mac OS X ABI Guide states that there are only three differences 
between the System V Intel386 Application Binary Interface and Mac OS 
X's own conventions. These three Mac OS X conventions are:
Structures 8 bytes or smaller in size are returned in registers
The stack is 16-byte aligned at the point of function calls
Large data types (larger than 4 bytes) are kept at their natural 
alignment

Greg

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