libsvp64: introduce API sketch
authorDmitry Selyutin <ghostmansd@gmail.com>
Wed, 6 Sep 2023 18:54:40 +0000 (21:54 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Wed, 6 Sep 2023 18:56:09 +0000 (21:56 +0300)
src/libsvp64/svp64.h [new file with mode: 0644]

diff --git a/src/libsvp64/svp64.h b/src/libsvp64/svp64.h
new file mode 100644 (file)
index 0000000..1b7033c
--- /dev/null
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <stddef.h>
+#include <stdint.h>
+
+enum svp64_state {
+    SVP64_SUCCESS,
+    SVP64_ERROR_LOOKUP,
+    SVP64_ERROR_OPERAND_0,
+    SVP64_ERROR_OPERAND_1,
+    SVP64_ERROR_OPERAND_2,
+    SVP64_ERROR_OPERAND_3,
+    SVP64_ERROR_OPERAND_4,
+    SVP64_ERROR_OPERAND_5,
+    SVP64_ERROR_OPERAND_6,
+    SVP64_ERROR_OPERAND_7,
+};
+
+struct svp64_opcode {
+    uint32_t value;
+    uint32_t mask;
+};
+
+struct svp64_record {
+    struct svp64_opcode opcode;
+    uint8_t operands[8];
+    char name[16];
+};
+
+struct svp64_ctx {
+    struct svp64_record const *record;
+    int64_t operands[8];
+};
+
+enum svp64_state
+svp64_disassemble(struct svp64_ctx *ctx, uint32_t insn);
+
+struct svp64_record const *
+svp64_lookup_insn(uint32_t insn);