nx_g22_adversary.nx
buildroot/runtime/nx_g22_adversary.nx
about
nx_g22_adversary.nx -- G22 bias-via-cmov FLAG-RIDE adversary (T9 class).
Crafts the exact hazard the testq protects against: the textually-previous
ALU result is POSITIVE (SF=0) while the DIVIDEND is negative and NON-EXACT,
so a stale-flag ride (negctl X86_NEGCTL_G22_RIDE_ALWAYS=1) skips the bias
and truncation-toward-zero silently becomes floor: -101/4 = -25, floor -26.
Self-checking: exit 0 = all correct; a nonzero exit names the failing case.
The shipped ride gate never fires here (the previous ALU produced t, NOT the
dividend), so the testq is emitted and this stays GREEN; RIDE_ALWAYS -> RED.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 0 importers
imports: nx_syscalls_x86_64.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 11 | const K_MAGIC_1000000000: i64 = 1000000000 |
| 12 | const K_MAGIC_9223372036854775807: i64 = 9223372036854775807 |
| 13 | const K_MAGIC_4611686018427387904: i64 = 4611686018427387904 |
functions
| 19 | func g22_stale_pos(x: i64, p: i64, q: i64) -> i64 called by 1: main |
| 28 | func g22_stale_neg(x: i64, p: i64, q: i64) -> i64 called by 1: main |
| 37 | func g22_ride_ok(p: i64, q: i64) -> i64 called by 1: main |
| 42 | func main() -> i64 |