Subject: Interesting observation in if_mc_obio.c
To: NetBSD <port-mac68k@netbsd.org>
From: Michael R. Zucca <mrz5149@acm.org>
List: port-mac68k
Date: 12/15/2001 15:27:44
I'm playing around with AV DMA and I was looking at a disassembly of ROM
code in the ResEdit CODE editor. At first I interpreted the code one way
and I thought it was doing a weird thing then I looked more closely and I
noticed that the code was offset by 16 bits and that when I disassembled
the code by hand, starting at the new offset, it made more sense.
Basically, it looked like my code was ORing itself and then looping on
whether the OR changed. When I checked it again it was really just doing a
bit test, which was more in line with another function I was looking at
that did the same thing.

My observation has to do with the following mysterious code in if_mc_obio.c:

/*
  * Not sure what this does... figure out if this interrupt is
  * really ours?
  */
while ((which = psc_reg4(0x804)) != psc_reg4(0x804))
    ;
if ((which & 0x60000000) == 0)
                return 0;

Basically, 0x0804 is the beginning of a BTST xxxx,D4 instruction. And I
would be willing to bet that  0x60000000 is the xxxx. Perhaps this was
supposed to be disassembled BTST 0x6,D4?

The whole psc_reg4(0x804) thing just looks out of place to me. So I'm
wondering if whoever did the disassembly, could go back and see if this
interpretation makes more sense, like checking an interrupt bit or a bit in
the DMA channel's control register or something.

Thanks!



____________________________________________________________________
 Michael Zucca - mrz5149@acm.org
 "I will choose a path that's clear. I will choose Freewill. "
  --Rush, Freewill
____________________________________________________________________