code wiki / (root) / nx_g22_adversary.nx

nx_g22_adversary.nx

buildroot/runtime/nx_g22_adversary.nx

2667 B55 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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

nx_syscalls_x86_64.nx nx_g22_adversary.nx

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

main g22_stale_pos g22_stale_neg g22_ride_ok

structs

none

consts

11const K_MAGIC_1000000000: i64 = 1000000000
12const K_MAGIC_9223372036854775807: i64 = 9223372036854775807
13const K_MAGIC_4611686018427387904: i64 = 4611686018427387904

functions

19func g22_stale_pos(x: i64, p: i64, q: i64) -> i64
called by 1: main
28func g22_stale_neg(x: i64, p: i64, q: i64) -> i64
called by 1: main
37func g22_ride_ok(p: i64, q: i64) -> i64
called by 1: main
42func main() -> i64