[Mesa-dev] [PATCH 07/16] intel/tools/disasm: add gen_disasm_assembly_length function
kevin.rogovin at intel.com
kevin.rogovin at intel.com
Tue Dec 12 07:44:08 UTC 2017
From: Kevin Rogovin <kevin.rogovin at intel.com>
The length function is needed if one wishes to save GEN binary
shaders to file.
Signed-off-by: Kevin Rogovin <kevin.rogovin at intel.com>
---
src/intel/tools/disasm.c | 7 +++++++
src/intel/tools/gen_disasm.h | 2 ++
2 files changed, 9 insertions(+)
diff --git a/src/intel/tools/disasm.c b/src/intel/tools/disasm.c
index ffcd48084f..9a136db4db 100644
--- a/src/intel/tools/disasm.c
+++ b/src/intel/tools/disasm.c
@@ -107,6 +107,13 @@ gen_disasm_disassemble(struct gen_disasm *disasm, const void *assembly,
ralloc_free(disasm_info);
}
+int
+gen_disasm_assembly_length(struct gen_disasm *disasm,
+ const void *assembly, int start)
+{
+ return gen_disasm_find_end(disasm, assembly, start) - start;
+}
+
struct gen_disasm *
gen_disasm_create(int pciid)
{
diff --git a/src/intel/tools/gen_disasm.h b/src/intel/tools/gen_disasm.h
index 8d82a58617..8b95a710e2 100644
--- a/src/intel/tools/gen_disasm.h
+++ b/src/intel/tools/gen_disasm.h
@@ -33,6 +33,8 @@ struct gen_disasm;
struct gen_disasm *gen_disasm_create(int pciid);
void gen_disasm_disassemble(struct gen_disasm *disasm,
const void *assembly, int start, FILE *out);
+int gen_disasm_assembly_length(struct gen_disasm *disasm,
+ const void *assembly, int start);
void gen_disasm_destroy(struct gen_disasm *disasm);
--
2.15.0
More information about the mesa-dev
mailing list