| ... | ... | @@ -178,7 +178,7 @@ pub fn lowerMir(emit: *Emit) InnerError!void { |
| 178 | 178 | |
| 179 | 179 | .@"test" => try emit.mirTest(inst), |
| 180 | 180 | |
| 181 | | .brk => try emit.mirBrk(), |
| 181 | .interrupt => try emit.mirInterrupt(inst), |
| 182 | 182 | .nop => try emit.mirNop(), |
| 183 | 183 | |
| 184 | 184 | .call_extern => try emit.mirCallExtern(inst), |
| ... | ... | @@ -225,8 +225,14 @@ fn fixupRelocs(emit: *Emit) InnerError!void { |
| 225 | 225 | } |
| 226 | 226 | } |
| 227 | 227 | |
| 228 | | fn mirBrk(emit: *Emit) InnerError!void { |
| 229 | | return lowerToZoEnc(.brk, emit.code); |
| 228 | fn mirInterrupt(emit: *Emit, inst: Mir.Inst.Index) InnerError!void { |
| 229 | const tag = emit.mir.instructions.items(.tag)[inst]; |
| 230 | assert(tag == .interrupt); |
| 231 | const ops = Mir.Ops.decode(emit.mir.instructions.items(.ops)[inst]); |
| 232 | switch (ops.flags) { |
| 233 | 0b00 => return lowerToZoEnc(.int3, emit.code), |
| 234 | else => return emit.fail("TODO handle variant 0b{b} of interrupt instruction", .{ops.flags}), |
| 235 | } |
| 230 | 236 | } |
| 231 | 237 | |
| 232 | 238 | fn mirNop(emit: *Emit) InnerError!void { |
| ... | ... | @@ -1074,7 +1080,7 @@ const Tag = enum { |
| 1074 | 1080 | push, |
| 1075 | 1081 | pop, |
| 1076 | 1082 | @"test", |
| 1077 | | brk, |
| 1083 | int3, |
| 1078 | 1084 | nop, |
| 1079 | 1085 | imul, |
| 1080 | 1086 | mul, |
| ... | ... | @@ -1278,7 +1284,7 @@ inline fn getOpCode(tag: Tag, enc: Encoding, is_one_byte: bool) ?OpCode { |
| 1278 | 1284 | .zo => return switch (tag) { |
| 1279 | 1285 | .ret_near => OpCode.oneByte(0xc3), |
| 1280 | 1286 | .ret_far => OpCode.oneByte(0xcb), |
| 1281 | | .brk => OpCode.oneByte(0xcc), |
| 1287 | .int3 => OpCode.oneByte(0xcc), |
| 1282 | 1288 | .nop => OpCode.oneByte(0x90), |
| 1283 | 1289 | .syscall => OpCode.twoByte(0x0f, 0x05), |
| 1284 | 1290 | .cbw => OpCode.oneByte(0x98), |