Skip to content

Possible problem with 68040+ #5

@th-otto

Description

@th-otto

I think your handling in the exception handler (atleast when called from supervisor) is wrong. In that case, you copy only 4 words of the exception frame to your local stack, but 040+ generate an exception frame with 8 words:

Image

So upon return from the exception, the SP will be wrong, because the CPU pops 4 words more than you pushed. Also, the PC of that frame points behind the extension word (PC of the instruction + 4 bytes). The actual PC of the faulting instruction is contained in the extra words of that frame. See also https://github.com/torvalds/linux/blob/d082ecbc71e9e0bf49883ee4afd435a77a5101b6/arch/m68k/math-emu/fp_entry.S#L52-L59 where that case is handled specially.

I also wonder why you handle TOS 1.x specially. That TOS is not able to handle >= 68010 processors (not even EmuTOS), not only because of the LineF instructions in ROM, but also because of the trap handlers not being able to handle 4-word exception frames.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions