Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent wraparound in SPRAM data access #158

Closed
mchack-work opened this issue Mar 4, 2024 · 3 comments · Fixed by #160
Closed

Prevent wraparound in SPRAM data access #158

mchack-work opened this issue Mar 4, 2024 · 3 comments · Fixed by #160
Assignees

Comments

@mchack-work
Copy link
Member

QEMU and real hardware behave differently if you access RAM. If you access higher than 0x4001ffff real hardware wraps around to the beginning of RAM.

@secworks
Copy link
Contributor

secworks commented Mar 4, 2024

Added an experimental filter to the RAM access in branch https://github.com/tillitis/tillitis-key1/tree/match_qemu_ram_mem
The fix needs testing from SW. The expected behaviour now is that 0xdeadbeef is returned for addresses larger than max ram, but within the RAM prefix.

@secworks
Copy link
Contributor

secworks commented Mar 4, 2024

Ready for testing, se PR #160

@dehanj
Copy link
Member

dehanj commented Mar 19, 2024

Confirming that QEMU detects a read/write outside of RAM as an invalid operation and rejects it. Does seem as it tries to reset, and gets stuck trying to access FW in app-mode.

Invalid write at addr 0x4011FF00, size 4, region '(null)', reason: rejected
tk1_mmio_write: bad write: addr=0xd00007fc size=4 val=0x60 msg='write to FW_RAM in app-mode'
tk1_mmio_write: bad write: addr=0xd00007f8 size=4 val=0x0 msg='write to FW_RAM in app-mode'
tk1_mmio_write: bad write: addr=0xd00007f4 size=4 val=0x0 msg='write to FW_RAM in app-mode'
tk1_mmio_write: bad write: addr=0xd00007f0 size=4 val=0x0 msg='write to FW_RAM in app-mode'
tk1_mmio_write: bad write: addr=0xd00007ec size=4 val=0x0 msg='write to FW_RAM in app-mod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants