| author | |
| committer | |
| log | f448b518f874929dd219ed957c314889d5dbf0cf |
| tree | 6d3ca68ef607ef0e8059b00b4d01ac4011a60ba9 |
| parent | 222e23c6786e0ac307524c6c91b41782111af82a |
2 files changed, 13 insertions(+), 2 deletions(-)
lib/std/spu/interpreter.zig+8-1| ... | ... | @@ -11,6 +11,9 @@ pub fn Interpreter(comptime Bus: type) type { |
| 11 | 11 | /// This is set to true when we hit an undefined0 instruction, allowing it to |
| 12 | 12 | /// be used as a trap for testing purposes |
| 13 | 13 | undefined0: bool = false, |
| 14 | /// This is set to true when we hit an undefined1 instruction, allowing it to | |
| 15 | /// be used as a trap for testing purposes. undefined1 is used as a breakpoint. | |
| 16 | undefined1: bool = false, | |
| 14 | 17 | bus: Bus, |
| 15 | 18 | |
| 16 | 19 | pub fn ExecuteBlock(self: *@This(), comptime size: ?u32) !void { |
| ... | ... | @@ -122,7 +125,11 @@ pub fn Interpreter(comptime Bus: type) type { |
| 122 | 125 | // Break out of the loop, and let the caller decide what to do |
| 123 | 126 | return; |
| 124 | 127 | }, |
| 125 | .undefined1 => return error.BadInstruction, | |
| 128 | .undefined1 => { | |
| 129 | self.undefined1 = true; | |
| 130 | // Break out of the loop, and let the caller decide what to do | |
| 131 | return; | |
| 132 | }, | |
| 126 | 133 | .signext => if ((val0 & 0x80) != 0) |
| 127 | 134 | (val0 & 0xFF) | 0xFF00 |
| 128 | 135 | else |
src-self-hosted/codegen.zig+5-1| ... | ... | @@ -1265,7 +1265,11 @@ fn Function(comptime arch: std.Target.Cpu.Arch) type { |
| 1265 | 1265 | .riscv64 => { |
| 1266 | 1266 | mem.writeIntLittle(u32, try self.code.addManyAsArray(4), Instruction.ebreak.toU32()); |
| 1267 | 1267 | }, |
| 1268 | .spu_2 => {}, | |
| 1268 | .spu_2 => { | |
| 1269 | try self.code.resize(self.code.items.len + 2); | |
| 1270 | var instr = Instruction{ .condition = .always, .input0 = .zero, .input1 = .zero, .modify_flags = false, .output = .discard, .command = .undefined1 }; | |
| 1271 | mem.writeIntLittle(u16, self.code.items[self.code.items.len - 2 ..][0..2], @bitCast(u16, instr)); | |
| 1272 | }, | |
| 1269 | 1273 | else => return self.fail(src, "TODO implement @breakpoint() for {}", .{self.target.cpu.arch}), |
| 1270 | 1274 | } |
| 1271 | 1275 | return .none; |