diff options
Diffstat (limited to 'anim/src/disasm.zig')
| -rw-r--r-- | anim/src/disasm.zig | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/anim/src/disasm.zig b/anim/src/disasm.zig index 3fbe4ff..afeef1b 100644 --- a/anim/src/disasm.zig +++ b/anim/src/disasm.zig @@ -792,7 +792,7 @@ const Say = struct { const count = a.argumentRows(row, to, moment); const shown = a.rec.moment(moment); // Flags by name, where a system call of its name says which argument they are. - const nr: ?u64 = if (std.meta.stringToEnum(std.os.linux.SYS, name)) |sys| @intFromEnum(sys) else null; + const nr: ?u64 = if (std.meta.stringToEnum(std.os.linux.SYS, name)) |sys| @backingInt(sys) else null; const names: []const []const u8 = if (nr) |n| zt.syscalls.names(n) else &.{}; for (carriers[0..count], 1..) |reg, k| { const ry = a.y + @as(f32, @floatFromInt(k)) * m.row; @@ -819,7 +819,7 @@ const Say = struct { fn cForm(a: Say, row: Insn, to: u64, moment: u64, result: ?u64, width: f32) []const u8 { const u = a.u; const name = a.functionName(to, moment); - const nr: ?u64 = if (std.meta.stringToEnum(std.os.linux.SYS, name)) |sys| @intFromEnum(sys) else null; + const nr: ?u64 = if (std.meta.stringToEnum(std.os.linux.SYS, name)) |sys| @backingInt(sys) else null; const names: []const []const u8 = if (nr) |n| zt.syscalls.names(n) else &.{}; const count = @min(row.params orelse argumentCount(a.rec, row, name) orelse names.len, 6); // Out of room the arguments go from the right, `…` for them; the result stays. @@ -1081,14 +1081,14 @@ pub fn flagsRead(mn: []const u8) u16 { const cond = if (std.mem.startsWith(u8, mn, "cmov")) mn[4..] else if (std.mem.startsWith(u8, mn, "set")) mn[3..] else if (mn.len > 1 and mn[0] == 'j' and !std.mem.eql(u8, mn, "jmp")) mn[1..] else return 0; const f = flag_bits; const table = [_]struct { []const u8, u16 }{ - .{ "a", f.cf | f.zf }, .{ "nbe", f.cf | f.zf }, .{ "be", f.cf | f.zf }, .{ "na", f.cf | f.zf }, - .{ "ae", f.cf }, .{ "nb", f.cf }, .{ "nc", f.cf }, .{ "b", f.cf }, - .{ "c", f.cf }, .{ "nae", f.cf }, .{ "e", f.zf }, .{ "z", f.zf }, - .{ "ne", f.zf }, .{ "nz", f.zf }, .{ "g", f.zf | f.sf | f.of }, .{ "nle", f.zf | f.sf | f.of }, - .{ "le", f.zf | f.sf | f.of }, .{ "ng", f.zf | f.sf | f.of }, .{ "ge", f.sf | f.of }, .{ "nl", f.sf | f.of }, - .{ "l", f.sf | f.of }, .{ "nge", f.sf | f.of }, .{ "o", f.of }, .{ "no", f.of }, - .{ "s", f.sf }, .{ "ns", f.sf }, .{ "p", f.pf }, .{ "pe", f.pf }, - .{ "np", f.pf }, .{ "po", f.pf }, + .{ "a", f.cf | f.zf }, .{ "nbe", f.cf | f.zf }, .{ "be", f.cf | f.zf }, .{ "na", f.cf | f.zf }, + .{ "ae", f.cf }, .{ "nb", f.cf }, .{ "nc", f.cf }, .{ "b", f.cf }, + .{ "c", f.cf }, .{ "nae", f.cf }, .{ "e", f.zf }, .{ "z", f.zf }, + .{ "ne", f.zf }, .{ "nz", f.zf }, .{ "g", f.zf | f.sf | f.of }, .{ "nle", f.zf | f.sf | f.of }, + .{ "le", f.zf | f.sf | f.of }, .{ "ng", f.zf | f.sf | f.of }, .{ "ge", f.sf | f.of }, .{ "nl", f.sf | f.of }, + .{ "l", f.sf | f.of }, .{ "nge", f.sf | f.of }, .{ "o", f.of }, .{ "no", f.of }, + .{ "s", f.sf }, .{ "ns", f.sf }, .{ "p", f.pf }, .{ "pe", f.pf }, + .{ "np", f.pf }, .{ "po", f.pf }, }; for (table) |e| if (std.mem.eql(u8, cond, e[0])) return e[1]; return 0; @@ -1396,7 +1396,9 @@ fn operandsWidth(u: ui.Ui, row: Insn, ops: Operands, stub: []const u8) f32 { /// would fall there falls before the `[`. fn operands(u: ui.Ui, row: Insn, ops: Operands, stub: []const u8, base_y: f32, width: f32, ink: u24) void { if (target(row)) |to| { - _ = u.address(c.operands, base_y, to, .{ .ink = ui.rgb(theme.color.region.code_), .name = stub }); + const end = u.address(c.operands, base_y, to, .{ .ink = ui.rgb(theme.color.region.code_) }); + const remaining = c.operands + width - end - 10; + if (stub.len > 0 and remaining >= adv) u.text(.mono, size, end + 10, base_y, rows.fitted(u, ui.symbol(u, stub), remaining), t.primary); return; } const text = ops.text; |
