-
-/*
- * Early debug code
- */
-
-dumpr7: lis r9,HIGH_ADDR(hexTab) /* (TEST/DEBUG) */
- li r5,8 /* (TEST/DEBUG) */
- ori r9,r9,LOW_ADDR(hexTab) /* (TEST/DEBUG) */
-
-dumpr7n: rlwinm r7,r7,4,0,31 /* (TEST/DEBUG) */
- mr r6,r7 /* (TEST/DEBUG) */
- andi. r6,r6,15 /* (TEST/DEBUG) */
- lbzx r6,r9,r6 /* (TEST/DEBUG) */
- lis r10,0xF301 /* (TEST/DEBUG) */
- ori r10,r10,0x2000 /* (TEST/DEBUG) */
-
-#if 0
-xqrw2: eieio /* (TEST/DEBUG) */
- lbz r7,0(r10) /* (TEST/DEBUG) */
- dcbi 0,r10 /* (TEST/DEBUG) */
- sync /* (TEST/DEBUG) */
- andi. r7,r7,0x04 /* (TEST/DEBUG) */
- beq xqrw2 /* (TEST/DEBUG) */
-#endif
-
- dcbf 0,r10 /* (TEST/DEBUG) */
- sync /* (TEST/DEBUG) */
- dcbi 0,r10 /* (TEST/DEBUG) */
- eieio /* (TEST/DEBUG) */
- stb r6,4(r10) /* (TEST/DEBUG) */
-
- lis r6,10 /* (TEST/DEBUG) */
-dumpr7d: addi r6,r6,-1 /* (TEST/DEBUG) */
- mr. r6,r6 /* (TEST/DEBUG) */
- bne- dumpr7d /* (TEST/DEBUG) */
- dcbf 0,r10 /* (TEST/DEBUG) */
- sync /* (TEST/DEBUG) */
- dcbi 0,r10 /* (TEST/DEBUG) */
- eieio /* (TEST/DEBUG) */
-
- addic. r5,r5,-1 /* (TEST/DEBUG) */
- bne+ dumpr7n /* (TEST/DEBUG) */
-
- blr /* (TEST/DEBUG) */
-
-;
-; Log a special entry in physical memory.
-; This assumes that memory size has been significantly lowered using
-; the maxmem boot option. The buffer starts just after the end of mem_size.
-;
-; This is absolutely for special tracing cases. Do not ever leave in...
-;
-
-ENTRY(dbgLog,TAG_NO_FRAME_USED)
-
- li r11,0 ; Clear callers callers callers return
- li r10,0 ; Clear callers callers callers callers return
- li r9,0 ; Clear callers callers callers callers callers return
- lwz r2,0(r1) ; Get callers callers stack frame
- lis r0,0x4000 ; First invalid address
- lwz r12,8(r2) ; Get our callers return
- lwz r2,0(r2) ; Back chain
-
- mr. r2,r2 ; End of chain?
- cmplw cr1,r2,r0 ; Valid kernel address?
- beq- nosavehere ; Yes, end of chain...
- bge- cr1,nosavehere ; No...
- lwz r11,8(r2) ; Get our callers return
- lwz r2,0(r2) ; Back chain
-
- mr. r2,r2 ; End of chain?
- cmplw cr1,r2,r0 ; Valid kernel address?
- beq- nosavehere ; Yes, end of chain...
- bge- cr1,nosavehere ; No...
- lwz r10,8(r2) ; Get our callers return
- lwz r2,0(r2) ; Back chain
-
- mr. r2,r2 ; End of chain?
- cmplw cr1,r2,r0 ; Valid kernel address?
- beq- nosavehere ; Yes, end of chain...
- bge- cr1,nosavehere ; No...
- lwz r9,8(r2) ; Get our callers return
-
-nosavehere: mfmsr r8 ; Get the MSR
- lis r2,hi16(EXT(DebugWork)) ; High part of area
- lis r7,hi16(EXT(mem_actual)) ; High part of actual
- andi. r0,r8,0x7FCF ; Interrupts and translation off
- ori r2,r2,lo16(EXT(DebugWork)) ; Get the entry
- mtmsr r0 ; Turn stuff off
- ori r7,r7,lo16(EXT(mem_actual)) ; Get the actual
- isync
-
- lwz r0,4(r2) ; Get the flag
- mr. r0,r0 ; Should we log?
- lwz r0,0(r7) ; Get the end of memory
- lwz r7,0(r2) ; Get the position
- bne- waytoofar ; No logging...
- mr. r7,r7 ; Is this the first?
- bne+ gotspot ; Nope...
-
- lis r7,hi16(EXT(mem_size)) ; High part of defined memory
- ori r7,r7,lo16(EXT(mem_size)) ; Low part of defined memory
- lwz r7,0(r7) ; Make it end of defined
-
-gotspot: cmplw r7,r0 ; Do we fit in memory
- addi r0,r7,0x0020 ; Next slot
- bge- waytoofar ; No fit...
-
- stw r0,0(r2) ; Set next time slot
- dcbz 0,r7 ; Zap it
-
- stw r3,0(r7) ; First data
- li r3,32 ; Disp to next line
- stw r4,4(r7) ; Second data
- dcbz r3,r7 ; Zap it
- stw r5,8(r7) ; Third data
- stw r6,12(r7) ; Fourth data
-
- stw r12,16(r7) ; Callers callers
- stw r11,20(r7) ; Callers callers caller
- stw r10,24(r7) ; Callers callers callers caller
- stw r9,28(r7) ; Callers callers callers callers caller
-
-waytoofar: mtmsr r8 ; Back to normal
- isync
- blr
-
-;
-; Same as the other, but no traceback and 16 byte entry
-; Trashes R0, R2, R10, R12
-;
-
- .align 5
- .globl EXT(dbgLog2)
-
-LEXT(dbgLog2)
-
-
- mfmsr r10 ; Get the MSR
- lis r2,hi16(EXT(DebugWork)) ; High part of area
- lis r12,hi16(EXT(mem_actual)) ; High part of actual
- andi. r0,r10,0x7FCF ; Interrupts and translation off
- ori r2,r2,lo16(EXT(DebugWork)) ; Get the entry
- mtmsr r0 ; Turn stuff off
- ori r12,r12,lo16(EXT(mem_actual)) ; Get the actual
- isync
-
- lwz r0,4(r2) ; Get the flag
- mr. r0,r0 ; Should we log?
- lwz r0,0(r12) ; Get the end of memory
- lwz r12,0(r2) ; Get the position
- bne- waytoofar2 ; No logging...
- mr. r12,r12 ; Is this the first?
- bne+ gotspot2 ; Nope...
-
- lis r12,hi16(EXT(mem_size)) ; High part of defined memory
- ori r12,r12,lo16(EXT(mem_size)) ; Low part of defined memory
- lwz r12,0(r12) ; Make it end of defined
-
-gotspot2: cmplw cr1,r12,r0 ; Do we fit in memory
- rlwinm. r0,r12,0,27,27 ; Are we on a new line?
- bge- cr1,waytoofar2 ; No fit...
- addi r0,r12,0x0010 ; Next slot
-
- bne+ nonewline ; Not on a new line...
- dcbz br0,r12 ; Clear it so we do not fetch it
-
-nonewline: cmplwi r3,68 ; Special place for time stamp?
-
- stw r0,0(r2) ; Set next time slot
- bne+ nospcts ; Nope...
-
- lwz r0,0x17C(br0) ; Get special saved time stamp
- b nospctt ; Skip...
-
-nospcts: mftb r0 ; Get the current time
-
-nospctt: stw r3,4(r12) ; First data
- stw r4,8(r12) ; Second data
- stw r5,12(r12) ; Third data
- stw r0,0(r12) ; Time stamp
-
-waytoofar2: mtmsr r10 ; Back to normal
- isync
- blr
-
-