- stack = make_pv_area (RX_SP_REGNUM, gdbarch_addr_bit (target_gdbarch));
- back_to = make_cleanup_free_pv_area (stack);
+ pv_area stack (RX_SP_REGNUM, gdbarch_addr_bit (target_gdbarch ()));
+
+ if (frame_type == RX_FRAME_TYPE_FAST_INTERRUPT)
+ {
+ /* This code won't do anything useful at present, but this is
+ what happens for fast interrupts. */
+ reg[RX_BPSW_REGNUM] = reg[RX_PSW_REGNUM];
+ reg[RX_BPC_REGNUM] = reg[RX_PC_REGNUM];
+ }
+ else
+ {
+ /* When an exception occurs, the PSW is saved to the interrupt stack
+ first. */
+ if (frame_type == RX_FRAME_TYPE_EXCEPTION)
+ {
+ reg[RX_SP_REGNUM] = pv_add_constant (reg[RX_SP_REGNUM], -4);
+ stack.store (reg[RX_SP_REGNUM], 4, reg[RX_PSW_REGNUM]);
+ }
+
+ /* The call instruction (or an exception/interrupt) has saved the return
+ address on the stack. */
+ reg[RX_SP_REGNUM] = pv_add_constant (reg[RX_SP_REGNUM], -4);
+ stack.store (reg[RX_SP_REGNUM], 4, reg[RX_PC_REGNUM]);
+
+ }