feat(v5te): implement THUMB BLX(1), BLX(2), and ARM BLX

This commit is contained in:
2023-09-19 23:00:28 -05:00
parent 37b3fe3d10
commit 3c5d4acc5f
6 changed files with 60 additions and 39 deletions

View File

@@ -149,6 +149,8 @@ pub const thumb = struct {
return comptime comptime_blk: {
@setEvalBranchQuota(5025); // This is exact
var table = [_]InstrFn{und} ** 0x400;
// 9 8 7 6 5 4 3 2 1 0
// 15 14 13 12 11 10 9 8 7 6
for (&table, 0..) |*handler, i| {
handler.* = switch (@as(u3, i >> 7 & 0x7)) {
@@ -230,12 +232,9 @@ pub const thumb = struct {
const cond = i >> 2 & 0xF;
break :blk branch.fmt16(InstrFn, cond);
},
0b110 => branch.fmt18(
InstrFn,
),
0b111 => blk: {
const is_low = i >> 5 & 1 == 1;
break :blk branch.fmt19(InstrFn, is_low);
0b110, 0b111 => blk: {
const H = i >> 5 & 0x3;
break :blk branch.linkExchange(InstrFn, H);
},
},
};