[OpenBIOS] sparc32 trap recovery
odanet at caramail.com
Sat Jun 15 22:20:50 CEST 2013
On 15/06/2013 19:50, Bob Breuer wrote:
> I'm aiming for a cpeek that catches the data faults on sparc32, so I've
> coded up the attached test code.
> The fault handler here is almost trivially simple: set a new instruction
> pointer and return to it. All the magic is done in push_trap_handler
> and do_trap_handler, and they act similar to setjmp/longjmp. Nesting is
> allowed, so it should be possible to use this at the top level for
> printing out pretty error messages for any fault just like OBP.
> I'm looking for any comments and suggestions. This proof of concept
> only handles mmu data faults, but is extendable. Example tests:
> deadbeef try-fault
> returns false (0),
> 10000 try-fault
> returns true (-1) and the value at 0x10000
If you only need to check MMU data faults, you can alternatively use the
"No Fault" flag in the MMU Control register (SparcV8 standard, appendix
H, page 253).
Your solution is certainly more flexible, though.
Clearing the fault by reading the "MMU fault status register" may be
useful, some OSes could be disturbed during boot by a still pending MMU
More information about the OpenBIOS