Skip to content

[Bug]: MOV from/to CRx/DRx vs FLAGS #96

Open

Description

@ludloff

Both the pdf SDM and the website SDM state...

MOV from/to CRx – The OF, SF, ZF, AF, PF, and CF flags are undefined.
MOV from/to DRx – The OF, SF, ZF, AF, PF, and CF flags are undefined.

https://intel.github.io/SDM/instruction/MOV_CR.html
https://intel.github.io/SDM/instruction/MOV_DR.html

There is plenty of existing x86 code in the wild which successfully expects
that arithmetic FLAGS to remain unchanged during MOV from/to CRx/DRx.

That existing code pretty much also precludes any future redefinition of it.

So that section/statement should probably simply be removed altogether.

Activity

  1. added
    SDM PDF issueThis problem is present in the SDM PDF and is/may be present in the website as a consequence
    on Nov 3, 2026
  2. alastairreid commented on Nov 3, 2026

    @alastairreid
    Contributor

    Thanks for the report.

    Both the old pseudocode and the new executable spec agree that flags are not modified.
    XED says nothing which I think means that flags are unmodified
    An internal simulator that is based on XED doesn't seem to touch the flags (but I am not an expert on this codebase)

    So I think this is likely an error in the SDM PDF (that we are then copying into the website).

    I think the best way to fix this is to automatically generate the Flags Affected section of the SDM from the XED database.
    This will be a bit tedious to do because we will want to review every case where the wording changes to check

    • Are we changing the meaning?
    • Is the old wording better than the auto-generated wording?
    • Is the change benign?
      But maybe we should fix it manually before then?
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

    SDM PDF issueThis problem is present in the SDM PDF and is/may be present in the website as a consequenceenhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions