processmission/oh-my-qemu/qemu-tcg-frontend
Claude Code and agent skill by processmission/oh-my-qemu
- community
Checking that the SKILL.md file is still in the repository.
Use for adding, reviewing, or debugging guest ISA decode and translation in a QEMU TCG frontend, including feature gates, exceptions, PC/TB behavior, and focused instruction tests.
Install
npx vskill@latest install processmission/oh-my-qemu/qemu-tcg-frontendSKILL.md
QEMU TCG Frontend
Audit workflow
For a non-trivial task that writes to the workspace, use only the needed entries under .oh-my-qemu/<task-slug>/: audit.md (baseline, plan, decisions, evidence, verification, and gaps), commands.md (redacted commands, working directories, and results), logs/ (decisive build, test, and runtime output), scripts/ (probes, parsers, and harnesses), and output/ (generated deliverables, third-party dependencies, and non-QEMU binaries). Keep QEMU's own build tree at source-root builds/build-<target>/, never an unqualified build/. In a Git worktree, add .agents/, .oh-my-qemu/, and builds/ to the file from git rev-parse --git-path info/exclude before writing artifacts or configuring QEMU; preserve existing entries and avoid duplicates. Never stage or commit these paths; stage source only when the user explicitly requests that separate action. At handoff, reconcile git status --short with the baseline and report the task directory, build directory, source changes, pre-existing changes, and unresolved gaps.
Source comment hygiene
Keep file-header comments minimal: SPDX/copyright plus at most a one-line component identity. Do not put implementation strategy, framework choice/defense, "modeled contract" pointers, neighboring-device convention, or review/audit rationale in source. Comment only key ISA/decode/backend code, in one to three lines with at most one brief public QEMU or ISA reference; do not expand it into a design or translation essay. Never write .oh-my-qemu/..., output/..., audit.md, evidence paths, round/milestone/AC status, review notes, commands, progress, or absolute host paths into source. When qemu-workflow is installed, run its source-comments gate on changed source files.
QEMU upstream boundary
QEMU's official GitLab and mailing lists are upstream channels. A patch becomes an upstream contribution when it is sent to the maintainers selected through MAINTAINERS. Do not prepare or send agent-generated code, documentation, commit messages, or patches for upstream submission; see the checked-out tree's docs/devel/code-provenance.rst. Research, debugging, analysis, local experiments, verification, and workflow guidance remain allowed. Local branches, commits, patch files, pushes, and pull requests are not by themselves upstream contributions; perform those Git actions only when requested.
Workflow
- Record the ISA version, encoding, feature/privilege gates, exception behavior, PC/TB rules,
and allowed source paths.
- Inspect the checked-out decoder and the nearest comparable target before choosing decodetree,
direct TCG ops, or a helper.
- Work in small reviewable rounds; record changed paths, verification, review result, and gaps.
- Build the target and run focused valid, invalid, and disabled-feature instruction tests.
- Capture bounded TCG logs only when needed; distinguish translated, helper, and fallback paths.
Frontend contract
Record in audit.md: ISA version and privilege requirements; instruction encoding, aliases, and operand sign/zero extension; XLEN/vector/FPU constraints; expected illegal-instruction cases; the helper-versus-direct-op decision; and the tests that prove semantics and invalid encodings. Use the ISA coverage template for per-instruction coverage.
Decoder rules
For decodetree targets, reuse existing fields, formats, and argument sets; confirm fixedmask/fixedbits uniqueness; handle overlap groups intentionally; use field functions for transformed immediates; and keep ordering consistent with nearby extensions. For hand decoders, preserve existing fallback and illegal-instruction behavior.
Decoder collision and priority debugging
When an instruction decodes to the wrong pattern or a pattern is unreachable:
- List the patterns that match the same instruction word and compare fixedbits/fixedmask.
- Rebuild and read the decodetree generator error or generated decoder path reported by Meson;
conflicts fail generation or leave a later pattern unreachable.
- Order patterns from most specific to most general; comment intentional overlap groups and add
a negative test for every shadowed encoding.
- Record the pattern order and tested encodings in
audit.md.
trans_* rules
Before emitting IR, gate:
- CPU/ISA feature;
- privilege/virtualization mode;
- XLEN/operand width;
- reserved bits and invalid immediates;
- vector/FPU state where relevant;
- alignment or memory-mode constraints if architectural.
Use direct TCG ops for simple integer/logical/shift/select operations. Use helpers for complex state, softfloat/crypto/vector libraries, or exception-heavy semantics.
Helper side-effect flags
Helper flags tell TCG which globals a helper reads or writes and whether the call has side effects; a helper that raises an exception or mutates guest-visible state must keep those effects visible. Failure example: a raising helper declared with the no-side-effects flag looks removable to TCG, so the call can be dropped or reordered when its result is unused. The build still succeeds; only a guest test that depends on the exception or state write fails. Inspect the checked-out flag definitions (in include/tcg/tcg.h) and add such a test.
PC and TB rules
Check target conventions for:
pc_nextadvancement;- PC update before exceptions;
- branch/direct-block chaining;
ctx->base.is_jmpstate;- page-boundary behavior;
- single-step and interrupt trigger behavior.
Wrong PC state corrupts exceptions, gdbstub state, and replay/debug evidence.
Custom ISA modeling
For a new toy, vendor, or reverse-engineered ISA target, use custom-isa.md: target enablement, decode and translation registration, TCG op mapping, CPU state and control-register helpers, per-instruction functional tests, qtest coverage, and build targets. Keep the frontend testable per instruction group.
Verification expectations
- Build the target translator.
- Add focused
tests/tcg/<target>/coverage when applicable; otherwise add a functional
per-instruction test.
- Cover edge values, invalid encodings, feature-disabled behavior, and privilege errors.
- Use
-accel tcg,one-insn-per-tb=onwhen debugging instruction boundaries. - Store TCG logs under
.oh-my-qemu/<task-slug>/logs/.
Upstream references
docs/devel/code-provenance.rstdocs/devel/decodetree.rstdocs/devel/tcg.rstdocs/devel/tcg-ops.rstdocs/devel/submitting-a-patch.rsttarget/riscv/(decodetree andinsn_trans/implementation examples)
Paths can differ between QEMU versions; locate them in the checked-out tree.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/qemu-tcg-frontend/SKILL.md
Popularity
- Repository stars
- 59
- Repository forks
- 9
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/processmission/oh-my-qemu/qemu-tcg-frontend)