Replies: 2 comments 2 replies
-
|
Definitely a good thing to do. Can you send pull req?
Thanks
…On Wed, 29 Oct 2025, 21:36 tbe, ***@***.***> wrote:
I have seen the call for help with the pending 2.2.0 release and QEMU
upgrades by @wtdcode <https://github.com/wtdcode>.
In my opinion, missing code annotations in Unicorn modifications are a
major pain point.
Problem
QEMU upgrades are painful because we can't easily see:
- Why code was changed
- What type of modification it is
- Which QEMU changes might break our stuff
Solution
Annotate Unicorn-specific code with inline comments:
/* UNICORN-BEGIN: hook-system, intercept exceptions before do_interrupt */if (cpu->exception_index < EXCP_INTERRUPT) {
struct uc_struct *uc = cpu->uc; /* UNICORN-MOD: api-change */
HOOK_FOREACH(uc, hook, UC_HOOK_INTR) {
...
}
}/* UNICORN-END */
/* UNICORN-STUB: device-removal, NVIC not needed */void armv7m_nvic_set_pending(void *opaque, int irq, bool secure) { }
Categories
Modifications could be placed in categories. Some common ones I found
during analysis of the codebase:
- api-change - Function signatures (adding uc_struct param)
- hook-system - Hook code generation
- state-management - Execution control (stop_request, etc)
- device-removal - Stubbed device code
- context-passing - Threading uc_struct everywhere
- memory-hook - Memory instrumentation
How This Would Help
*Maintenance:*
- Contributors get a clear understanding of changes to upstream
- Easy to search code for existing, similar changes
*QEMU upgrades:*
- Scripts can extract all annotations and generate a list of affected
areas
- Compare QEMU changes against our modifications
*New contributors:*
- Learn what we changed and why
- Follow established patterns
Basic Tooling Ideas
- *Commit hooks:* Ensure changes to QEMU are documented
- *Diff analysis:* Scripts could compare a target QEMU version and
identify conflicts and resolutions
AI Assistance
While I am against using AI coding agents to actually write code,
leveraging them to identify what needs to be done for:
- Upgrading QEMU to a higher version
- Backporting fixes
- Implementing/replacing features
could allow contributors with less time on their hand, to provide fixes
and features, while outsourcing some of the research work to AI.
Questions
- What is the stance from @aquynh <https://github.com/aquynh> and
@wtdcode <https://github.com/wtdcode> on this?
- Are there other projects that do similar things?
Next Steps
I don't think it would be wise to backfill the current code, as a QEMU
upgrade is incoming. I would suggest implementing such a concept DURING
this rebase.
Tooling can be added later, once the foundation is there.
—
Reply to this email directly, view it on GitHub
<#2252>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABNQNYBQVJUTLZEWVKCTP7D32C7F7AVCNFSM6AAAAACKRWFBPKVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZZGA4DIOJYGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
|
I once tried the porting with AI tools. Honestly, the process is incredibly smooth and in most cases the code generated is expected. BUT, a few issues prevent me from going this way further:
But yeah, I'm not against annotating the region Unicorn hacks and actually if you read a bit through the code, you will find that I'm already more or less doing this. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have seen the call for help with the pending 2.2.0 release and QEMU upgrades by @wtdcode.
In my opinion, missing code annotations in Unicorn modifications are a major pain point.
Problem
QEMU upgrades are painful because we can't easily see:
Solution
Annotate Unicorn-specific code with inline comments:
Categories
Modifications could be placed in categories. Some common ones I found during analysis of the codebase:
api-change- Function signatures (adding uc_struct param)hook-system- Hook code generationstate-management- Execution control (stop_request, etc)device-removal- Stubbed device codecontext-passing- Threading uc_struct everywherememory-hook- Memory instrumentationHow This Would Help
Maintenance:
QEMU upgrades:
New contributors:
Basic Tooling Ideas
AI Assistance
While I am against using AI coding agents to actually write code, leveraging them to identify what needs to be done for:
could allow contributors with less time on their hand, to provide fixes and features, while outsourcing some of the research work to AI.
Questions
Next Steps
I don't think it would be wise to backfill the current code, as a QEMU upgrade is incoming. I would suggest implementing such a concept DURING this rebase.
Tooling can be added later, once the foundation is there.
Beta Was this translation helpful? Give feedback.
All reactions