[OpenBIOS] sparc32 trap recovery

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Sat Jun 29 02:30:32 CEST 2013


On 25/06/13 16:40, Bob Breuer wrote:

> On 6/19/2013 9:44 AM, Bob Breuer wrote:
>> So how about if I setup an interrupt handler that skips over the
>> faulting instruction when a global flag is set, otherwise continues as
>> is today.  Then cpeek can become:
>>   - set skip_datafault flag
>>   - clear SFSR
>>   - chain to c@
>>   - clear skip_datafault flag
>>   - check SFSR
>>   - if fault, fixup stack and return false, else return true
>>
>> Now, I might be able to code up this cpeek version in forth, or just
>> leave it in C?
>
>
> Here's what I've got.  If it looks ok, I will finish it off by also catching
> trap 0x29, modify wpeek/lpeek to also use the wrapper, and make a similar change
> for the poke commands.

Hi Bob,

Great work - this is definitely looking closer to what I was expecting 
:) My initial feeling was that we could try and do a bit more in Forth, 
so I've had a go at converting spark_peek() into Forth (minus the SFSR 
register access), the result of which I've attached to this email.

I made a few other changes too: I renamed allow_dfault to ignore_dfault 
(as that seemed to better reflect its behaviour in that we don't fault 
if it is non-zero), removed the get_sfsr() function (as a similar 
prototype already existed in pgtsrmmu.h) and mapped the address of 
ignore_dfault to the ignore-dfault word.

By unifying C/Forth in this way you get the advantage that you can 
control the fault handler from either language, e.g.

0 > -1 ignore-dfault !  ok
0 > 0 c@  ok
1 > u. ffffffff  ok
0 > 0 ignore-dfault !  ok
0 > 0 c@ Unhandled Exception 0x00000009
PC = 0xffd074f0 NPC = 0xffd074f4
Stopping execution

Anyway I'm happy that the patch is on the right track if you would like 
to fill in the missing bits - thanks once again!


ATB,

Mark.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openbios-sparc32-trap.patch
Type: text/x-diff
Size: 3851 bytes
Desc: not available
URL: <http://www.openfirmware.info/pipermail/openbios/attachments/20130629/9d840f98/attachment-0001.bin>


More information about the OpenBIOS mailing list