Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Dec 2006 16:25:16 -0800
From:      Peter Grehan <grehan@freebsd.org>
To:        Andrew Turner <andrew@fubar.geek.nz>
Cc:        grehan@freebsd.org, freebsd-ppc@freebsd.org
Subject:   Re: FreeBSD on an Efika
Message-ID:  <4587316C.1070500@freebsd.org>
In-Reply-To: <20061219113230.34182787@hermies.int.fubar.geek.nz>
References:  <20061218104841.72ba51ea@hermies.int.fubar.geek.nz>	<4585CCC1.7050005@freebsd.org>	<20061218222327.308dca53@hermies.int.fubar.geek.nz>	<4586CA29.10803@freebsd.org> <20061219113230.34182787@hermies.int.fubar.geek.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4587316C.1070500>