Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
5620900
fix LLIL for 3.0 API
mblsha Jun 26, 2022
a743fe3
porit to get_address_il2 as a workaround to require il.append() every…
mblsha Jun 26, 2022
b49e06e
fix llil-generation. il.mult returns a tuple???
mblsha Jun 26, 2022
70f2358
disable non-base m68k variants
mblsha Jan 30, 2022
ab02a1f
Revert "disable non-base m68k variants"
mblsha Jun 26, 2022
76ccf8b
splitting into several files
mblsha Jun 26, 2022
bbb227b
was 'comment out 68k variants'. Run tests when loading plugin.
mblsha Jun 26, 2022
7f8fcec
clean up imports.
mblsha Jun 26, 2022
41d0b94
split out ops and disasm
mblsha Jun 26, 2022
d233dac
set address size to 4
mblsha Jun 26, 2022
993456b
run all tests
mblsha Mar 6, 2022
b5c1fa3
Simplify register by not using bit masks.
mblsha Mar 6, 2022
1dd3e6e
Updated lifting of the 'bcc', 'dbcc', 'bra', and 'jmp' instructions s…
mblsha Mar 6, 2022
a94588b
Fix OpRegisterDirect.get_dest_il when value is 0
mblsha Mar 9, 2022
d3a41fb
try to correctly lift some flags
mblsha Jun 26, 2022
354fefd
ANDI + ORI: set c and v flags
mblsha Mar 11, 2022
37b9156
EORI: set c and v flags
mblsha Mar 11, 2022
db26105
handle NEG/NEGX flags differently.
mblsha Jun 26, 2022
3f94092
Add default calling convention where everything is passed via registers.
mblsha Jun 26, 2022
726f3c4
Add tests for calling functions.
mblsha May 1, 2022
7c2c65a
Fix arguments not being shown in binja when calling OpAbsolute functi…
mblsha May 1, 2022
e83c774
slightly improve TST flags
mblsha May 28, 2022
18d239c
fix MOVE for negative displacement
mblsha May 28, 2022
9c6d0ff
Add FIXMEs for potentially incorrect LLIL
mblsha Jun 26, 2022
f713fb7
remove obsolete comment.
mblsha Jun 26, 2022
aae0287
Add testcases for get_address_il2 handling.
mblsha Jun 14, 2022
03e6a0b
Replaced print with log_debug.
mblsha Oct 9, 2022
bf2e0cd
Hack for programs that rely on `c` flag to not being modified after `…
mblsha Dec 23, 2022
48c66a2
Add tests that check direct `ccr` modification.
mblsha Dec 23, 2022
fe77391
Make tests pass on latest dev binary ninja.
mblsha Jan 26, 2023
f668b41
Add test for current 'swap' behaviour.
mblsha Jan 26, 2023
cbace44
Adopt uv, CI, and mock-based tests
mblsha Dec 25, 2025
adbc5a1
Docs: note PR target repo
mblsha Dec 25, 2025
57ec152
Make plugin __init__ safe for pytest
mblsha Dec 25, 2025
41db1fa
Switch LLIL tests to structural mocks
mblsha Dec 25, 2025
1047a6e
Add disasm assertions and align plugin init
mblsha Dec 25, 2025
c2992ab
Guard test mocks from plugin load
mblsha Dec 25, 2025
2094487
Use binja-esr init pattern
mblsha Dec 25, 2025
783a7ff
Put binja-test-mocks in dev deps
mblsha Dec 25, 2025
0efc190
Adopt src layout
mblsha Dec 25, 2025
968380f
Add m68k package entrypoints
mblsha Dec 25, 2025
d8f725a
Make plugin shim safe under mocks
mblsha Dec 25, 2025
ec66c9d
Add optional debug prints to plugin register
mblsha Dec 25, 2025
54993fb
Always print plugin registration debug
mblsha Dec 25, 2025
b52b7dd
Remove temporary debug prints
mblsha Dec 25, 2025
3fb33f6
Make RTS flag passing arch-specific
mblsha Dec 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CI

on:
push:
branches: [main, master]
pull_request:

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install dependencies
run: uv sync --frozen --extra dev

- name: Ruff
run: uv run ruff check .

pytest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install dependencies
run: uv sync --frozen --extra dev

- name: Pytest
env:
FORCE_BINJA_MOCK: 1
run: uv run pytest
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Python / tooling
.venv/
__pycache__/
*.py[cod]
.pytest_cache/
.ruff_cache/
.mypy_cache/
.DS_Store

# Local reference checkout (not part of this repo)
binja-esr/

46 changes: 46 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Repository Guidelines

## Project Structure & Module Organization

- `__init__.py`: Binary Ninja plugin shim (registers architectures/commands when loaded by Binary Ninja).
- `src/m68k/m68k.py`: core Architecture + lifter (LLIL generation).
- `src/m68k/m68k_disasm.py` / `src/m68k/m68k_ops.py`: instruction decoding and operand helpers.
- `plugin.json`: Plugin Manager metadata.
- `src/m68k/test.py`: regression case data for unit tests (disassembly + LLIL expectations).
- `binja-esr/`: newer, more fully-tooled variant; follow `binja-esr/AGENTS.md` when contributing there.

## Build, Test, and Development Commands

Tooling: use `uv` for dependency management and running commands.

- Install dev deps: `uv sync --extra dev`
- Lint: `uv run ruff check .`
- Unit tests (uses mocks, no Binary Ninja required): `uv run pytest`

- Load locally: place this folder in your Binary Ninja plugins directory and restart Binary Ninja.
- Syntax-only check (no Binary Ninja required): `python3 -m compileall .`

## Coding Style & Naming Conventions

- Python 3, 4-space indentation; keep changes small and readable.
- Prefer type hints where practical (matches the existing `m68k.py` style).
- Naming: `snake_case` for functions/variables, `CamelCase` for classes, `UPPER_SNAKE_CASE` for constants.
- Prefer plain `print(...)` for lightweight diagnostics; avoid importing `binaryninja.log` at import time so unit tests (and mocks) stay simple.

## Testing Guidelines

- Add/adjust cases in `src/m68k/test.py` when changing decode or lifting behavior.
- Tests validate both disassembly output (string) and lifted LLIL (structural `MockLLIL` trees).
- For mock-based tests, use the shared helper dependency (`binja-test-mocks` / “binja-test-helpers”) instead of duplicating Binary Ninja API stubs in this repo; if an API surface is missing, expand it upstream and bump the dependency.

## Commit & Pull Request Guidelines

- Commits use short, imperative summaries (e.g., “Fix TST flags”, “Add tests for calling functions”).
- PRs should include: what instructions/flags changed, how to reproduce, and confirmation that `uv run pytest` passes (or why it cannot).
- Open PRs against `mblsha/binaryninja-m68k` (this fork) unless explicitly coordinating with upstream; with GitHub CLI use `gh pr create --repo mblsha/binaryninja-m68k ...` to avoid targeting `galenbwill/binaryninja-m68k` by default.

## CI & Git Tips

- Watch required checks (use `--watch`; there is no `--wait`): `gh pr checks <number> --watch --interval 5 --required` (add `--fail-fast` if desired).
- Continue a rebase without an editor prompt: `GIT_EDITOR=true git rebase --continue`
- Scripted interactive rebase todo editing: `GIT_SEQUENCE_EDITOR=true git rebase -i <base>` (keep these env vars per-command; don’t export globally).
Loading