Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Asm question (port from linux ppc)



Thanks Jonas. That first example did the trick. I found something similar
about the same time in a tutorial at:

http://developer.apple.com/documentation/DeveloperTools/Reference/Assembler/index.html?http://developer.apple.com/documentation/DeveloperTools/Reference/Assembler/PPCInstructions/chapter_6_section_6.html

I didn't know about the need for r1 to change atomically so that was really
useful too for fixing the linux code.

Regards,
Bob

Jonas Maebe wrote:

> What the correct code on Darwin is depends. If newstackptr is simply a 
> global variable in another object file and you're compiling without 
> PIC, then you can use code like this:
> 
> ---
> .text
> 
>             .globl  _setstack
> _setstack:
>       lis     r3,ha16(_newstackptr)
>       lwz     r1,lo16(_newstackptr)(r3)
>       blr
> ---
> 
> (note that r1 must always be valid and thus mist always changed using a 
> single instruction under any PPC ABI I know of; your original linux 
> code is wrong in that respect)
> 
.
.
> In general, check the output of "gcc -S somefile.c" to see how things 
> are done under Darwin/Mac OS X.
> 
> 
> Jonas

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.