Repository navigation
m68k: read and write the VBR register - #2456
Open
bacescuandrei wants to merge 1 commit into
Open
bacescuandrei wants to merge 1 commit into
bacescuandrei wants to merge 1 commit into
Conversation
UC_M68K_REG_CR_VBR is declared but neither reg_read nor reg_write handled it, so accesses were a no-op (with the deprecation warning) and exceptions used whatever vector base the CPU had.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
UC_M68K_REG_CR_VBRis declared inm68k.h, but neitherreg_readnorreg_writeinqemu/target/m68k/unicorn.chandled it. Accesses were a no-op that printed the deprecation warning ("Your register accessing on id 21 is deprecated…"). Setting the vector base therefore had no effect: exceptions andmovec %vbrused whateverenv->vbrheld, and the value could not be read back. Both accessors now map it toenv->vbr, unmasked, which is how QEMU'smovechelpers treat it.test_vbrintests/unit/test_m68k.cruns on an M68040 in supervisor mode. It writes VBR through the API and reads it back. It then runsmovec %vbr, %d0to check that the CPU sees that value, andmovec %d1, %vbrto check that a value the CPU writes can be read through the API.Without the change, all three checks fail (and the warning is printed). With it,
test_m68kpasses. Built withUNICORN_ARCH=m68k.I found this with a scan that round-trips every
UC_*_REG_*id of each architecture throughuc_reg_write/uc_reg_readon current dev. Apart from register fields that are masked by design, VBR was the m68k register that didn't round-trip.