Skip to content

Inhibit interrupts after MOV SS and POP SS #1631

Description

@jlxip

With this fixed, I've been able to install Windows 98 SE three times in a row from within v86. It's super stable now. I have not tried Windows 95.

Intel's Manual, Volume 2B for POP, says:
Loading the SS register with a POP instruction suppresses or inhibits some debug exceptions and inhibits interrupts on the following instruction boundary. (The inhibition ends after delivery of an exception or the execution of the next instruction.) This behavior allows a stack pointer to be loaded into the ESP register with the next instruction (POP ESP) before an event can be delivered.

Turns out POP SS + MOV SP is performed by Windows 9x's SMARTDRV.EXE. Without the documented behavior, a pending IRQ can slip through and corrupt memory. I've seen it manifest in two ways:

  • #GP in KRNL386.EXE during setup: SUWIN at 0001:81E1 and W98SETUP at 0001:813B
  • Random #UDs

Found by Daybreak Blue xhigh in ~4 hours. Feel free to check out this AI commit.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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