diff options
Diffstat (limited to 'anim/scenes')
| -rw-r--r-- | anim/scenes/asan.zig | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/anim/scenes/asan.zig b/anim/scenes/asan.zig index 2fe743f..a68a40a 100644 --- a/anim/scenes/asan.zig +++ b/anim/scenes/asan.zig @@ -184,6 +184,7 @@ fn frame(s: *anim.Frame) void { const q_head = asan.register(on(asan, q_line4, "cmp dword ptr"), "rip"); var q_turn: [17]u64 = undefined; for (&q_turn, 0..) |*m, i| m.* = nth(asan, q_line4, q_head, i); + // The first moment from `from` whose instruction is at the shadow: a check's load, or the prologue's poisoning store. const q_load = struct { fn of(rec: *canim.Recording, from: u64) u64 { var buf: [256]u8 = undefined; @@ -192,7 +193,13 @@ fn frame(s: *anim.Frame) void { return rec.end(); } }.of; - const report_call = on(asan, q_load(asan, q_turn[16]), "call"); + // The parting turn's check, by what each instruction is: the load, its `je` (not taken), the partial check's + // compare and its branch, the call (the recording ends in it: `--until __asan_report_store1`). + const q_check16 = q_load(asan, q_turn[16]); + const q_je16 = on(asan, q_check16, "je"); + const q_partial = on(asan, q_je16 + 1, "cmp"); + const q_branch = on(asan, q_partial, "j"); + const report_call = on(asan, q_branch, "call"); // The frames: plain's from rbp at line 4 (`i` at rbp-0x14, `buf` at rbp-0x10, then the saved rbp and the // return address); ASan's fake frame, where `__asan_stack_malloc_0` put it, by its descriptor. @@ -229,11 +236,13 @@ fn frame(s: *anim.Frame) void { const framed = s.value(0); const source = canim.add(s, canim.Source{ .cursor = at, .stage = left, .tag = "both builds" }); - const dis_l = canim.add(s, canim.Disasm{ .cursor = at, .stage = left }); + // Each run's disassembly by its name, aligned by line; ASan's stopped on its report's call once its run stops (A9). + const dis_l = canim.add(s, canim.Disasm{ .cursor = at, .stage = left, .run = "plain", .aligned = true }); + const stopped_r = s.value(0); // In the column (A10 to A13) plain's disassembly is a descent: main's window, the row // its return address names among them, over fill's whole (motion.md, the column's panes). const desc_l = canim.add(s, canim.Descent{ .cursor = at, .stage = left }); - const dis_r = canim.add(s, canim.Disasm{ .cursor = as, .stage = right, .rows = 9 }); + const dis_r = canim.add(s, canim.Disasm{ .cursor = as, .stage = right, .rows = 9, .run = "asan", .aligned = true, .stopped = stopped_r }); const reg_moves = struct { fn of(names: []const []const u8) u32 { var mask: u32 = 0; @@ -361,7 +370,7 @@ fn frame(s: *anim.Frame) void { const made = s.cursor; s.play(.{fake_in.to(1)}, .{ .seconds = t.quick }); s.cursor = made; - runTo(s, as, q_line3 - 1, 5, &.{ 0.3, 0.36, 0.5 }); + runTo(s, as, q_load(asan, q_back), 5, &.{ 0.3, 0.36, 0.5 }); s.play(.{ as.veil.to(0), as.hurried.to(0) }, .{ .seconds = t.veil }); s.wait(t.beat); walk(s, as, q_line3, null); @@ -383,7 +392,7 @@ fn frame(s: *anim.Frame) void { runTo(s, as, q_turn[0] + 2, 1, &.{ 0.4, 0.3, 0.3 }); walk(s, as, q_check0, 0.5); walk(s, as, q_check0 + 1, 0.9); - walk(s, as, q_check0 + 3, 0.5); + walk(s, as, on(asan, q_check0, "je"), 0.5); tg.done(s); // A5: i = 0, the stores: ASan's rows after the check, then both stores, plain first, and each side's i++. @@ -445,7 +454,6 @@ fn frame(s: *anim.Frame) void { // to reach its check; the two first different rows framed `attention`; plain's store into the saved // rbp, its `differs` bar 12 f after; ASan's load reads f3, its compare, its `je` not taken. says.line(s, "i = 16, one past `buf`: plain writes an A into the saved rbp;\nASan reads `f3`, a redzone."); - const q_check16 = q_load(asan, q_turn[16]); tg = Together.begin(s); runTo(s, at, p_store[16], 1, &.{ 0.4, 0.4, 0.4 }); tg.next(s); @@ -464,7 +472,7 @@ fn frame(s: *anim.Frame) void { } tg.next(s); s.wait(30.0 / 60.0); - for (q_check16..q_check16 + 3) |m| { + for (q_check16..q_je16) |m| { const plan = as.reading(m, m + 1); as.step(s, m + 1, plan, plan.total * 0.75); } @@ -474,11 +482,11 @@ fn frame(s: *anim.Frame) void { // A9: ASan's partial check and its call walked; its run stops: its registers give way to its stderr. says.line(s, "ASan does not store: it calls its report,\nwhich names `buf` and the write."); // The partial check's compare and branch walked; the loads round them at a run. - runTo(s, as, q_check16 + 7, 1, &.{0.3}); - walk(s, as, q_check16 + 9, 0.9); + runTo(s, as, q_partial, 1, &.{0.3}); + walk(s, as, q_branch + 1, 0.9); runTo(s, as, report_call, 1, &.{0.3}); s.wait(t.beat); - s.play(.{regs_r.fadeOut()}, .{ .seconds = t.quick, .ease = anim.ease.linear }); + s.play(.{ regs_r.fadeOut(), stopped_r.to(1) }, .{ .seconds = t.quick, .ease = anim.ease.linear }); right.glide(s, pair.split(.right, true), 0.4); s.play(.{stderr.fadeIn()}, .{ .seconds = t.quick, .ease = anim.ease.linear }); s.play(.{framed.to(3)}, .{ .seconds = 18.0 / 60.0, .ease = anim.ease.linear }); |
