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
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 mails | Author | Date |
|---|---|---|
| Uli Kusterer | Jul 29, 18:11 | |
| Andy Armstrong | Jul 29, 18:14 | |
| Uli Kusterer | Jul 29, 22:22 | |
| Andy Armstrong | Jul 29, 22:34 | |
| Uli Kusterer | Jul 30, 13:43 | |
| Andy Armstrong | Jul 30, 14:41 | |
| Greg | Jul 30, 15:33 | |
| Uli Kusterer | Jul 30, 22:08 | |
| Stefan | Jul 30, 22:22 | |
| Andy Armstrong | Jul 30, 23:57 | |
| George Warner | Jul 31, 18:43 | |
| Greg | Jul 31, 21:50 | |
| Ronald Oussoren | Aug 1, 10:40 |






Cocoa mail archive

