Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
PPC help request
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC
View previous topic :: View next topic  
Author Message
therealjrd
Tux's lil' helper
Tux's lil' helper


Joined: 18 May 2006
Posts: 120

PostPosted: Sat Dec 15, 2007 12:34 am    Post subject: PPC help request Reply with quote

Hi all. This is probably not a gentoo issue, though that is what I'm running. I suspect it's a PPC issue, and there's something I'm not understanding about this processor.

I have a piece of code that I'm trying to port from netbsd/freebsd to gentoo on my ppc mac. I'm able to compile it ok, but when I go to execute it, it appears to branch to 0. Debugging a bit, it gets into a piece of asm code which calls into C. Before the call, it saves a bunch of registers and things, then creates space at the top of the stack by doing

stwu r1,-28(r1)

The call into C returns, and the next instruction is

addi r1,r1,28

That instruction appears to send me into hyperspace.

I've tried sticking nops around it, tried, moving r1 to another register to compute the new value then moving it back etc. Everything works fine until I change r1, then poof. R1 is being preserved correctly across the call.

I've done some research in ppc docs, and couldn't find any place that mentioned side effects of updating r1. I suspect there's some other wierd interaction going on, but it's not obvious what.

Does this ring any bells with any of the ppc wizards out there? Hints on other places I could ask? TIA...
Back to top
View user's profile Send private message
rangerpb
Retired Dev
Retired Dev


Joined: 19 Jan 2005
Posts: 147

PostPosted: Mon Dec 24, 2007 8:07 pm    Post subject: ask on irc Reply with quote

Your best bet is to ask on IRC. Someone on #gentoo-ppc64 or #gentoo-ppc is likely to know
_________________
-->
rangerpb
<--
Back to top
View user's profile Send private message
corsair
Retired Dev
Retired Dev


Joined: 06 Oct 2003
Posts: 451
Location: Aachen, Germany

PostPosted: Mon Dec 24, 2007 9:15 pm    Post subject: Reply with quote

take a look at {1}. it helped me a lot understanding the branch processor of the powerpc architecture. be aware that the site only applies to 64bit powerpc processors. some instructions might not work on 32bit processors? I haven't done much with those things yet. ;-)

Another option would be to read the PowerPC ISA: {2} It is chapter 2 of Book I. I would read {1} first, because it doesn't describe as much details as the ISA.

best regards,

-corsair

{1} http://www.ibm.com/developerworks/linux/library/l-powasm3.html
{2} http://www.power.org/resources/reading/PowerISA_V2.05.pdf

EDIT: if you post the function which is written in assembler we *might* be able to help a bit more.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on PPC All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum