Re: Asm question (port from linux ppc)
site_archiver@lists.apple.com Delivered-To: Darwin-dev@lists.apple.com On Nov 27, 2004, at 05:03, darwin@qbjnet.com wrote: $cat setsp.s .globl _setstack _setstack: lis 1, newstackptr@ha lwz 1, newstackptr@l(1) blr .align 4 % cc setsp.S setsp.s:5:Parameter syntax error (parameter 1) setsp.s:5:Invalid mnemonic 'ha' setsp.s:6:Parameter syntax error (parameter 2) setsp.s:6:Invalid mnemonic 'l(r1)' --- .text .globl _setstack _setstack: lis r3,ha16(_newstackptr) lwz r1,lo16(_newstackptr)(r3) blr --- --- .text .globl _setstack _setstack: lis r3,ha16(L_newstackptr$non_lazy_ptr) lwz r3,lo16(L_newstackptr$non_lazy_ptr)(r3) lwz r1,0(r3) blr .data .non_lazy_symbol_pointer L_newstackptr$non_lazy_ptr: .indirect_symbol _newstackptr .long 0 --- Jonas _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... 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: (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) If it's a variable imported from another shared library or if you're compiling PIC code, then you need something like this: In general, check the output of "gcc -S somefile.c" to see how things are done under Darwin/Mac OS X. This email sent to site_archiver@lists.apple.com
participants (1)
-
Jonas Maebe