cal wrote:Hmm but you are modifying the stack, too and doing a call to the exception handler.Code: Select allmovi a1, stack + STACK_SIZE - 20
I have to take a closer look how that works together with gdb dummy_frame "call" handling.
'- 20' looks suspicious here, it should've been -16 or -32.
I must admit I never tried to call functions from gdb with this gdbstub.
Saving all windowed registers unconditionally and switching to separate stack makes access to all registers easy and straightforward.
cal wrote:Why do you clear EXCM?
EXCM makes things more complex if possible at all:
- it disables normal windowed registers behaviour, making it impossible to use C code in the handler (this does not affect call0 ABI code as long as the current register window is completely available);
- it disables zero overhead loops which now may be generated by the compiler (lx106 doesn't have this option);
- exceptions go to the double exception vector instead of normal kernel/user vectors.
cal wrote:Does your debug handler run with interrupts enabled?
Do you recommend that?
It runs with ps.intlevel set to debuglevel, so only NMI is possible.
I haven't tried running it with interrupts enabled and at least stack manipulations need to be reconsidered before allowing that.