Skip to content

Zabha and Zacas stay enabled after software clears misa.A #2387

Description

@akifejaz

misa_csr_t::unlogged_write() re-gates EXT_ZAAMO and EXT_ZALRSC whenever software writes misa, so the base atomics correctly become illegal once misa.A is cleared. EXT_ZABHA and EXT_ZACAS should be added to that list I believe.

A byte or halfword AMO, or a compare-and-swap, therefore keeps executing after misa.A reads zero.

I cannot share the test (its long ) but these are the relevant prints.

misa before 0x8000000000141101  A=1
misa after  0x8000000000141100  A=0
control OK: misa.A really is clear
amoadd.b returned 0x0000000000000000, cell is now 0x0000000000000001
BUG: amoadd.b executed with misa.A clear
exit=1

while the expected (I believe) should be "IllegalInstruction (mcause = 2)".

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions