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

Use a Special Temporary BERR Handler for MC68000 #397

Merged
merged 3 commits into from
Dec 17, 2023

Conversation

0xTJ
Copy link
Collaborator

@0xTJ 0xTJ commented Dec 16, 2023

The temporary BERR handler uses the special status word/register to determine the CPU that it's running on, so that it knows how to skip processor rerun when returning from the exception. However, on the MC68000, it will use the upper 4 bits of the stacked instruction register as this format code, which could lead to a false-positive CPU detection.

This PR moves the special-case MC68000 out from the default to be its own short handler if the SDB CPU type field is zero. Only the MC68000 is moved out since it's the only one with incompatible exception stack frames.

I also added a fallback to the handler in BERR_SAVED for unknown stack frame formats (since this isn't MC68000 anymore) and for non-data faults on MC68020/MC68030.

I can only test on MC68010, so I haven't confirmed that these changes work on the other CPUs. The MC68000 routine should work since it's just the default-case code pulled out, without popping the stacked D0.

roscopeco
roscopeco previously approved these changes Dec 17, 2023
Copy link
Collaborator

@roscopeco roscopeco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks!

Tested on 68000, 010, 020 and 030 - all seem to work great 😀

code/firmware/rosco_m68k_firmware/bootstrap.asm Outdated Show resolved Hide resolved
Copy link
Collaborator

@roscopeco roscopeco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, good spot on this one 👍

@0xTJ 0xTJ merged commit 1bcd383 into develop Dec 17, 2023
1 check passed
@0xTJ 0xTJ deleted the feature/cleanup-berr-handler branch December 17, 2023 01:32
roscopeco added a commit that referenced this pull request Jan 7, 2024
* Feture/release 2.4 roll develop (#369)

* Roll 2.4 release

* Roll 2.5.dev

* Roll 2.5.dev release (#370)

* ignore files/dirs starting with dot, tweak prompt

* Ignore static libs

* ROM kernel: initial integration

* Add FW tests to CI

* Add <vector> include

* 🤷 Try fix GITHUB_WORKSPACE thing [3]

* Revert "🤷 Try fix GITHUB_WORKSPACE thing [3]"

This reverts commit 4369599.

* Revert "Add FW tests to CI"

This reverts commit 4073f71.

* Test in CI, take 2 🤞

* Include user.mk

* Make program responsible for pmm setup

* Change usgae message

* Don't use impl-reserved ids

* Flush all read/writes to stdio

* Cleanup Outdated Equates (#377)

* Remove equates.S

* Remove revision-specific defines from public
Except for MFP, which is the only place that IOBASE was actually used

* Fix comment about equates.S

* Delete firmware attic (#379)

* Fix #359 (#378)

* Feature/gdb lib (#381)

* Add GDB remote debugging support as a library

* Us FSINFO hints

* Fix outdated IC14 reference (#384)

* Fix outdated IC14 reference
* Use reference instead of hardcoding

* Update README.md (#386)

* Feature/68000 probe support (#387)

* Support device probes on 68000

* Switch default CPU to 68000

* Disable memcheck on 68000

* Don't (ab)use SDB_STATUS for BERR_HANDLER return

* Replace nasty label address hack

* Consistently use INSTALL_TEMP_BERR_HANDLER

* Update typos in documentation

* Fix SD Card write failures by increasing timeout

* Feature/kicad 7 (#388)

* Update r2 to Kicad 7
* Update r2020 to Kicad 7
* Complete Kicad 7 migration

* Update README.md

* Feature/swap tx rx again (#395)

* Swap TX/RX & CTS/RTS silkscreen r2

* Swap over labels
* Add arrows
* Some board tidy up

* Swap TX/RX & CTS/RTS silkscreen r2020

    * Swap over labels
    * Add arrows
    * Some board tidy up

* Feature/fix weird kermit thing (#396)

* We've been lucky - it won't last. Fix it 😅

* Also include header

* Use a Special Temporary BERR Handler for MC68000 (#397)

* Always use helper routines

* Use special temporary BERR handler for MC68000

* Fix comment typo

* Align packed structs externally (#394)

* Align packed structs externally

* Pack nested exception structs

* Feature/020 docs (#400)

* Add 020 information docs

* Bring r2 010 docs in line with new 020 docs

* Fix numbering

* Fix incorrect number of 4k7s (#399)

* Fix incorrect number of 4k7s

* Fix RNs in BOM

* Feature/r2030 (#393)

* Ignore bak
* Initial work r2030 board
* Silk fixes
* Update for proto manufacturing
* Update to Kicad 7
* Fix pre-prod bugs
* Cleanup
* Add multiplier for 030
* EXPSEL on J6
* Swap TX/RX & CTS/RTS silkscreen r2030
  * Swap over labels
  * Add arrows
  * Some board tidy up
* Silkscreen fixes to match r2/r2020
* Tidy up for fab
* Internal & commercial BOM updates
* Silkscreen fixes
* Add 030 information doc
* Fix numbering
* Ignore KiCad lock files
* Finalize gerbers & schematic render

* Release FW2.42

* [WIP] Feature/030 caches (#401)

* Add basic cache control to libs

* Update to use caches on 020/030

* First cut keyboard support (#398)

* First cut keyboard support

* Support keyboard in sdfat_menu

* Add missing define for check input

* Switch to defines for check/get input

* Support keyboard in memcheck

* Address PR comments

* Fix master README notice

---------

Co-authored-by: Xark <[email protected]>
Co-authored-by: Xark <[email protected]>
Co-authored-by: Malcolm Harrow <[email protected]>
Co-authored-by: Malcolm Harrow <[email protected]>
Co-authored-by: Thomas Jager <[email protected]>
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 this pull request may close these issues.

2 participants