Skip to content

Potential UB upon entering unreal mode #241

Description

@refarb

According to the reference all registers not mentioned as clobbered by a block (by using out("<reg>") _) must have the same (undefined) value they had when entering the block when the asm block ends, "otherwise behavior is undefined".

However, both line 76 and line 85 of enter_unreal_mode in the second stage of the bootloader modify registers without stating this to the compiler.

Because I have never programmed any processor, except microprocessors without differing execution modes, I am unsure if this is actually fine (because upon switching into unreal mode all registers are to be considered clobbered for some reason? But then that would also require marking at least one asm block for the compiler?) or an actual bug which causes UB and should be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions