Port-macppc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Trying to boot on PowerMac 7200/90



Hello

News from booting 7200/90
Based on the advice I compiled the kernel with options PPC_OEA601.
Now the kernel once loaded gets almost immediately trapped by
a call to mftb() because this instruction is not
implemented on PPC601 and results in illegal instruction exception.

I plan to change the offending definiton of mftb() in
src/sys/arch/powerpc/include/cpu.h to use mfspr instead for the
case of PPC601 to see what happens

mftbl(void)
{
uint32_t tbl;
__asm volatile (
#ifdef PPC_IBM403
" mftblo %0 \n"
#else
" mftbl %0 \n"
#endif
: "=r" (tbl));
return tbl;
}

Do you think I can use remote debugging or kgdb is not yet
fully functional at this early stage of booting?
Should I compile full symbol table or I can dig into the kernel without it?
A full symbol table may cause the kernel to grow larger than 4 MB and then
OpenFirmware will choke on this.
Your comments are welcome

Details follow (to confirm I am not mistaken)

0 > boot enet:,\b4.xcf wg2

file: 192.168.2.31,/b4.xcf
loading XCOFF
tsize=EBF0 dsize=268 bsize=2A30 entry=E00000
SECTIONS:
.text    00E00000 00E00000 0000EBF0 000000E0
.data    00E0F000 00E0F000 00000268 0000ECD0
.bss     00E0F268 00E0F268 00002A30 00000000
loading .text, done..
loading .data, done..
clearing .bss, done..

>> NetBSD/macppc OpenFirmware Boot, Revision 1.10
>> (n4%pmg4.wg.net@localhost, Mon Aug 18 20:50:19 UTC 2008)
>> Open Firmware version 1.x
|2325856+307016 [161088+154397]=0x2d00d4
start=0x100000

trap: pid 0.1 (system): kernel PGM trap @ 0x29a65c (SRR1=0x81030)
panic: trap
Stopped in pid 0.1 (system) at  netbsd:cpu_Debugger+0x10:       lwz
 r0, r1, 0
x14
db> trace
0x003d6d20: at panic+0x21c
0x003d6d70: at trap+0x100
0x003d6e00: kernel PGM trap by ofwoea_initppc+0x2e0: srr1=0x81030
            r1=0x3d6ec0 cr=0x50000035 xer=0xe000be6f ctr=0 mq=0
0x003d6ec0: at ofwoea_initppc+0x3f8
0x003d6f20: at initppc+0xc
0x003d6f30: at 0x100090
db> show registers
...
msr         0x1030

SRR1 decoding
00 08 10 30
0000 0000 0000 1000 0001 0000 0011 0000
0123 4567 8901 2345 6789 0123 4567 8901
bit 12 illegal instructiuon program exception

dissassembly
-------------------------------------------------
0029a37c <ofwoea_initppc>:
...
  29a5fc: 4b f5 5c 7d bl      1f0278 <ksyms_init>
  29a600: 3d 20 00 33 lis     r9,51
  29a604: 80 09 7c d8 lwz     r0,31960(r9)
  29a608: 2f 80 00 00 cmpwi   cr7,r0,0
  29a60c: 41 9e 00 c0 beq-    cr7,29a6cc <ofwoea_initppc+0x350>
  29a610: 3f c0 00 34 lis     r30,52
  29a614: 90 1e 87 60 stw     r0,-30880(r30)
  29a618: 7c e0 00 a6 mfmsr   r7
  29a61c: 70 e0 7f ff andi.   r0,r7,32767
  29a620: 7c 00 01 24 mtmsr   r0
  29a624: 3d 20 00 33 lis     r9,51
  29a628: 81 7e 87 60 lwz     r11,-30880(r30)
  29a62c: 81 49 75 f8 lwz     r10,30200(r9)
  29a630: 3c 00 3b 9a lis     r0,15258
  29a634: 3d 20 00 34 lis     r9,52
  29a638: 60 00 ca 00 ori     r0,r0,51712
  29a63c: 7c 00 5b 96 divwu   r0,r0,r11
  29a640: 91 69 86 ec stw     r11,-30996(r9)
  29a644: 3d 00 00 33 lis     r8,51
  29a648: 3d 20 00 34 lis     r9,52
  29a64c: 7d 6b 53 96 divwu   r11,r11,r10
  29a650: 90 09 87 5c stw     r0,-30884(r9)
  29a654: 91 68 7c d4 stw     r11,31956(r8)
  29a658: 7d 50 42 a6 mfsprg  r10,0
  29a65c: 7d 2c 42 e6 mftb    r9              << gets trapped here
  29a660: 91 2a 01 14 stw     r9,276(r10)
  29a664: 80 08 7c d4 lwz     r0,31956(r8)
  29a668: 7c 16 03 a6 mtdec   r0
  29a66c: 7c e0 01 24 mtmsr   r7
  29a670: 80 01 00 64 lwz     r0,100(r1)
  29a674: 82 c1 00 38 lwz     r22,56(r1)
  29a678: 82 e1 00 3c lwz     r23,60(r1)
  29a67c: 7c 08 03 a6 mtlr    r0
  29a680: 83 01 00 40 lwz     r24,64(r1)
  29a684: 83 21 00 44 lwz     r25,68(r1)
  29a688: 83 41 00 48 lwz     r26,72(r1)
  29a68c: 83 61 00 4c lwz     r27,76(r1)
  29a690: 83 81 00 50 lwz     r28,80(r1)
  29a694: 83 a1 00 54 lwz     r29,84(r1)
  29a698: 83 c1 00 58 lwz     r30,88(r1)
  29a69c: 83 e1 00 5c lwz     r31,92(r1)
  29a6a0: 38 21 00 60 addi    r1,r1,96
  29a6a4: 4e 80 00 20 blr

---------------------------
source code
sys/arch/powerpc/oea/ofwoea_machdep.c

void
set_timebase(void)
{
int qhandle, phandle, msr, scratch;
char type[32];

if (timebase_freq != 0) {
ticks_per_sec = timebase_freq;
goto found;
}

for (qhandle = OF_peer(0); qhandle; qhandle = phandle) {
if (OF_getprop(qhandle, "device_type", type, sizeof type) > 0
    && strcmp(type, "cpu") == 0
    && OF_getprop(qhandle, "timebase-frequency",
&ticks_per_sec, sizeof ticks_per_sec) > 0) {
goto found;
}
if ((phandle = OF_child(qhandle)))
continue;
while (qhandle) {
if ((phandle = OF_peer(qhandle)))
break;
qhandle = OF_parent(qhandle);
}
}
panic("no cpu node");

found:
__asm volatile ("mfmsr %0; andi. %1,%0,%2; mtmsr %1"
: "=r"(msr), "=r"(scratch) : "K"((u_short)~PSL_EE));
ns_per_tick = 1000000000 / ticks_per_sec;
ticks_per_intr = ticks_per_sec / hz;
cpu_timebase = ticks_per_sec;
curcpu()->ci_lasttb = mftbl(); << gets trapped here
mtspr(SPR_DEC, ticks_per_intr);
mtmsr(msr);
}


Home | Main Index | Thread Index | Old Index