On Wed, Feb 14, 2024 at 10:35:26PM -0500, Charlie Jenkins wrote: > On Wed, Feb 14, 2024 at 10:00:37PM -0500, John David Anglin wrote: > > On 2024-02-14 8:58 p.m., Guenter Roeck wrote: > > > Specifically: Yes, the carry/borrow bits should be restored. Question is > > > if the Linux kernel's interrupt handler doesn't restore the carry bits > > > or if the problem is on the qemu side. > > The carry/borrow bits in the PSW should be saved and restored by the save_specials > > and rest_specials macros. They are defined in arch/parisc/include/asm/assembly.h. To clarify my previous point, even if rest_specials is restoring PSW, the "restored" values are going to be overwritten during the rfi instruction, since that instruction is defined to restore PSW. The handshake here seems to be lost, with both the hardware and linux messing with PSW and IPSW and both expecting the other to not mess with the values. > > Why would they be needed to be restored in linux? The manual says "The > PSW is set to the contents of the IPSW by the RETURN FROM INTERRUPTION > instruction". This means that the PSW must be restored by the hardware. > > We can see the QEMU implementation in: > > rfi: > https://github.com/qemu/qemu/blob/v8.2.1/target/hppa/sys_helper.c#L93 > > handling interrupt: > https://github.com/qemu/qemu/blob/v8.2.1/target/hppa/int_helper.c#L109 > > However the implementation appears to be faulty. During an RFI, the PSW > is always set to 0x804000e (regardless of what the PSW was before the > interrupt). > > - Charlie > > > > > > However, it appears the tophys macro might clobber the carry bits before they > > are saved in intr_save. > > > > Dave > > > > -- > > John David Anglin dave.anglin@xxxxxxxx > >