FreeBSD on an Efika
Peter Grehan
grehan at freebsd.org
Mon Dec 18 16:25:04 PST 2006
Hi Andrew,
>>Do you end up in the trap handler if you touch msgbuf ?
>
> Not as far as I can tell.
..
>> pmap_kenter() is fundamental to the operation of the system and
>>probably OK, so something else must be afoot.
A quick re-read of the G2 core manual gives the answer. I was under
the impression that the G2 was similar to the G3/G4 in that it did a
hardware table walk on TLB miss, but, that's not right. It's up to
software to handle a miss, using the itlb/dtlb-load/dtlb-store exception
vectors. See 6.5.2.1 of the G2 Core ref manual:
http://www.freescale.com/files/32bit/doc/ref_manual/G2CORERM.pdf
Since the relevant trap vectors aren't initialised, they will be
either 0 or whatever OpenFirmware left in there, most likely resulting
in an endless loop of unhandled exceptions.
The path I'd suggest is
a) Put in exception handlers at 0x1000, 0x1100 and 0x1200 to catch the
TLB miss e.g.
bcopy(&trapcode, (void *)0x1000, (size_t)&trapsize);
As you can see in <machine/trap.h>, the existing vector definition
don't match these, or are incorrect for the G2 core.
b) In powerpc/trap.c, panic if those vectors are hit to verify that
touching a virtual address will cause one of these exceptions. Do it for
both data read and write.
c) Manually install a TLB to cover the first page of the message
buffer to see if this allows a read/write without a trap occuring.
d) Now the fun part: for those exceptions, change the handler to point
to code that will walk the PTEG table and insert a TLB if found. If not
found, fake a DSI or ISI trap. This can be done in C, though you will
have to be careful to use a pre-allocated stack and not touch any
virtual addresses while doing this, since it could result in another fault.
later,
Peter.
More information about the freebsd-ppc
mailing list