[haiku-bugs] Re: [Haiku] #5956: PPC boot fails on double lock of mutex

  • From: "stevenh" <trac@xxxxxxxxxxxx>
  • Date: Thu, 13 May 2010 12:56:55 -0000

#5956: PPC boot fails on double lock of mutex
---------------------------+------------------------------------------------
 Reporter:  stevenh        |       Owner:  axeld         
     Type:  bug            |      Status:  new           
 Priority:  normal         |   Milestone:  R1            
Component:  System/Kernel  |     Version:  R1/Development
 Keywords:                 |   Blockedby:                
 Platform:  PowerPC        |    Blocking:  1048          
---------------------------+------------------------------------------------

Comment(by stevenh):

 Right, I've been trying to make sense of this... and I miss my push/pop
 stack calls!
 I've commented out the code from arch_debug.cpp and moved to arch_asm.S;
 since it's mentioned that this should be implemented in assembler.

 I've tried to understand the basic idea from x86 (http://dev.haiku-
 os.org/browser/haiku/trunk/src/system/kernel/arch/x86/arch_x86.S) and came
 up with the following. My goal has just been to call the stack_trace
 method... and implement the fault handling logic once i've conquered the
 call. It seems that either the null pointer is killing me, or I'm not
 passing in parameters properly:

 {{{
 //call a debugging command but make sure that we have a fault handler
 handy?
 //      \param cpu details on the current cpu this is on (smp? maybe?)
 [%r3?]
 //      \param jumpBuffer Buffer to be used for setjmp()/longjmp().
 [%r4?]
 //      \param function The function to be called.
 [%r5?]
 //      \param parameter The parameter to be passed to the
 [%r6?]
 //              function to be called.
 FUNCTION(arch_debug_call_with_fault_handler):
         mlr     %r3             //move the jump target to LR
         mtctr   %r5             //r5 contains our debug call
         li      %r3, 0x1        // argc = 1?
         mr      %r4, %r6        // argv = r6? .. should contain the params
 to pass to it
         bctr

         blr
 }}}

 I attempted two blr calls, instead of bctr and blr respectively, but the
 latter seems to work a little better... unfortunately it ends up with a
 'circular stack' error.

 The output is:
 {{{
 stack trace for thread 0x0 ---
     kernel stack: 0x00000000 to 0x00000000
 frame     caller    <image>:function + offset
 80087a90  (+1682632) 00000002
 80222758  (+   0)  0000002
 circular stack frame: x80222758
 }}}

 Meanwhile:
 kernel entry: 0x8010dfd0
 kernel stack top at: 0x80088000

 Apart from an easy answer, I'd really love to get my head around this..
 I'm continuing reading on PPC ASM howtos/manuals/tutorials, but not many
 people are as low level as this.

 Any help is appreciated.

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/5956#comment:3>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: