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
Bob