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

M68000: Implement BKPT opcode #6437

Closed

Conversation

vkoskiv
Copy link

@vkoskiv vkoskiv commented Apr 19, 2024

This enables BKPT (Breakpoint) instructions to show up in the decompiler in the same way as trap is shown - with a new pcode __m68k_bkpt(#)

Technically, this instruction was only added in the 68010. From the Motorola manual:

For the MC68000 and MC68008, the breakpoint cycle is not run, but an illegal
instruction exception is taken.

For the MC68010, a breakpoint acknowledge bus cycle is run with function codes driven high and zeros on all address lines. Whether the breakpoint acknowledge bus cycle is terminated with DTACK, BERR, or VPA, the processor always takes an illegal instruction exception. During exception processing, a debug monitor can distinguish different software breakpoints by decoding the field in the BKPT instruction.

It may therefore be more correct to specify this only for 68010 and newer, and only show ILLEGAL on 68000, but Ghidra currently makes no distinction between the 000 and 010, so I opted to keep this PR minimal by not adding the multiple files needed. This patch already enables a better decompile of affected code.

Added a new __m68k_bkpt() pcode to indicate it is a CPU intrinsic
@ryanmkurtz ryanmkurtz added Feature: Processor/68000 Status: Triage Information is being gathered labels Apr 23, 2024
@GhidorahRex GhidorahRex added Status: Internal This is being tracked internally by the Ghidra team and removed Status: Triage Information is being gathered labels Apr 23, 2024
@ryanmkurtz
Copy link
Collaborator

ryanmkurtz commented May 9, 2024

An equivalent fix has been incorporated into 197a18a

@ryanmkurtz ryanmkurtz closed this May 9, 2024
@ryanmkurtz ryanmkurtz added this to the 11.1 milestone May 9, 2024
@ryanmkurtz ryanmkurtz added the Reason: Internal effort This will be solved internally label May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature: Processor/68000 Reason: Internal effort This will be solved internally Status: Internal This is being tracked internally by the Ghidra team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants