I have to admit that was pretty awesome.

Alex

On Jun 14, 2011, at 2:46 PM, Josh Marshall <joshua.r.marshall.1991@gmail.com> wrote:

Is there a resource whereby I could pickup this kind of debug skill, or is this experience, and assembly knowledge?

On Mon, Jun 13, 2011 at 3:01 AM, <cinap_lenrek@gmx.de> wrote:
ok, i think i can explain the "unlock of ilock: pc f0140fc5, held by ..." message.

i extracted that 9pcflop kernel with muzgos cdfpart from the current iso and
disassembled with acid arround.

the routine that calls unlock looks like this:

the routine that calls the unlock (shutdown from ether79c970.c)
0xf0140f79 0xf0140f79   SUBL    $0x14,SP
0xf0140f7c 0xf0140f7c   MOVL    0x18(SP),AX
# ctlr = arg->foobar
0xf0140f80 0xf0140f80   MOVL    0x78(AX),CX
0xf0140f83 0xf0140f83   MOVL    CX,0x10(SP)
0xf0140f87 0xf0140f87   MOVL    CX,0x0(SP)
# ilock(ctlr)
0xf0140f8a 0xf0140f8a   CALL    0xf019af31
0xf0140f8f 0xf0140f8f   MOVL    0x10(SP),AX
0xf0140f93 0xf0140f93   MOVL    AX,0x0(SP)
0xf0140f96 0xf0140f96   MOVL    $0x18,AX
0xf0140f9b 0xf0140f9b   MOVL    AX,0x4(SP)
# io32r(ctlr, 0x18) ???
0xf0140f9f 0xf0140f9f   CALL    0xf01409b4
0xf0140fa4 0xf0140fa4   MOVL    0x10(SP),AX
0xf0140fa8 0xf0140fa8   MOVL    AX,0x0(SP)
0xf0140fab 0xf0140fab   MOVL    $0x18,AX
0xf0140fb0 0xf0140fb0   MOVL    AX,0x4(SP)
# io16r(ctlr, 0x18);
0xf0140fb4 0xf0140fb4   CALL    0xf014093f
0xf0140fb9 0xf0140fb9   MOVL    0x10(SP),AX
0xf0140fbd 0xf0140fbd   MOVL    AX,0x0(SP)
# unlock(ctlr)
0xf0140fc0 0xf0140fc0   CALL    0xf019b0be
0xf0140fc5 0xf0140fc5   ADDL    $0x14,SP
0xf0140fc8 0xf0140fc8   RET

it have no debug symbols so i looked for magic numbers
arround (in this case 0x18)

wich turned out to be:

ether79c970.c:31:       Sreset          = 0x0018,       /* software reset */

# this looks like io32r() from ether79c970.c
acid: asm(0xf01409b4)
0xf01409b4 0xf01409b4   SUBL    $0x8,SP
0xf01409b7 0xf01409b7   MOVL    0xc(SP),CX
# port = arg2
0xf01409bb 0xf01409bb   MOVL    0x1c(CX),CX
# port += arg1
0xf01409be 0xf01409be   ADDL    0x10(SP),CX
0xf01409c2 0xf01409c2   MOVL    CX,0x0(SP)
# inl(port)
0xf01409c5 0xf01409c5   CALL    0xf010036e
0xf01409ca 0xf01409ca   ADDL    $0x8,SP
0xf01409cd 0xf01409cd   RET

# this is inl()
acid: asm(0xf010036e)
0xf010036e 0xf010036e   MOVL    0x4(SP),DX
0xf0100372 0xf0100372   INL     DX,AX
0xf0100373 0xf0100373   RET

so there is your bug!

static void
shutdown(Ether *ether)
{
       Ctlr *ctlr;

       ctlr = ether->ctlr;
       ilock(ctlr);
       io32r(ctlr, Sreset);
       io16r(ctlr, Sreset);
       unlock(ctlr);
}

it was commented out before...

the file just changed... i think they try to fix it right now...

--
cinap