Skip to content

feat: add x86 RDRAND instruction hook - #2398

Open
Jvlegod wants to merge 1 commit into
unicorn-engine:devfrom
Jvlegod:feature/x86-rdrand-hook
Open

feat: add x86 RDRAND instruction hook#2398
Jvlegod wants to merge 1 commit into
unicorn-engine:devfrom
Jvlegod:feature/x86-rdrand-hook

Conversation

@Jvlegod

@Jvlegod Jvlegod commented Aug 14, 2026

Copy link
Copy Markdown

Hello maintainers,

This PR close #1902

We have support UC_X86_INS_RDTSC, now this PR adds UC_X86_INS_RDRAND's hook.

@PhilippTakacs

Copy link
Copy Markdown
Contributor

The API you propose is a bit limited. I would expect a way to change the generated random. Your change just call the hook and after that use the normal implementation. So there is no simple way to change the result.

@Jvlegod
Jvlegod force-pushed the feature/x86-rdrand-hook branch from a3aecb5 to 2384e8d Compare August 14, 2026 07:16
@Jvlegod

Jvlegod commented Aug 14, 2026

Copy link
Copy Markdown
Author

I would expect a way to change the generated random.

I have now added a hook that executes after the instruction successfully completes.

This hook allows for controlling the CF flag (indicating whether the instruction succeeded) and modifying the random value.

The CF flag is set according to the result (see the “Operation” section above). The OF, SF, ZF, AF, and PF flags are set to 0.

@Jvlegod
Jvlegod force-pushed the feature/x86-rdrand-hook branch from 2384e8d to 621502b Compare August 14, 2026 07:18
Signed-off-by: Jvle <keke.oerv@isrc.iscas.ac.cn>
@Jvlegod
Jvlegod force-pushed the feature/x86-rdrand-hook branch from 621502b to cb4d01c Compare August 14, 2026 07:19
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