def fetch(span):
bits = len(span)
- one = "UINT64_C(1)"
+ one = "UINT32_C(1)"
for (dst, origin) in enumerate(span):
src = (32 - (origin + 1))
dst = (bits - (dst + 1))
- dst = f"UINT64_C({dst})"
- src = f"UINT64_C({src})"
+ dst = f"UINT32_C({dst})"
+ src = f"UINT32_C({src})"
yield f"/* {origin:<2} */ (((insn >> {src}) & {one}) << {dst}) |"
- yield f"UINT64_C(0)"
+ yield f"UINT32_C(0)"
class Mode(enum.Enum):
self.emit("static inline enum svp64_state")
self.emit("svp64_disassemble_operand(struct svp64_ctx *ctx, uint32_t insn, size_t id) {")
with self:
- self.emit("int64_t value;")
+ self.emit("uint32_t value;")
self.emit("")
self.emit(f"switch (ctx->record->operands[id]) {{")
yield node
self.emit("}")
self.emit("")
with self:
- self.emit("ctx->operands[id] = value;")
+ self.emit("ctx->operands[id].value = value;")
self.emit("")
self.emit("return SVP64_SUCCESS;")
self.emit("}")
@contextlib.contextmanager
def dispatch_operand(self, node, *, path, pathcls):
def generic_handler(span):
- yield f"value = (int64_t)("
+ yield f"value = ("
with self:
yield from fetch(span)
yield f");"
self.emit("break;")
def signed_handler(span):
- mask = f"(UINT64_C(1) << (UINT64_C({len(span)}) - 1))"
- yield "value = (int64_t)("
+ mask = f"(UINT32_C(1) << (UINT32_C({len(span)}) - 1))"
+ yield "value = ("
with self:
yield "("
with self:
@mdis.dispatcher.Hook(insndb.Record.Opcode.Value, insndb.Record.Opcode.Mask)
@contextlib.contextmanager
def dispatch_opcode_parts(self, node, *, path, pathcls):
- self.emit(f"{pathcls(path)} = UINT64_C(0x{node:016x}),")
+ self.emit(f"{pathcls(path)} = UINT32_C(0x{node:016x}),")
with self: yield node
@mdis.dispatcher.Hook(insndb.Record.Opcode)