intel: Make the disassembler take a const pointer to the assembly.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 11 Jul 2018 17:30:12 +0000 (10:30 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 24 Jul 2018 18:04:56 +0000 (11:04 -0700)
Disassembling doesn't modify the assembly.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/common/gen_disasm.c
src/intel/common/gen_disasm.h

index 1de20f576d4d36d3a6cd8354b9c5a489d20b7b47..4f835c19883e7eec5341c10248ddd22f21453993 100644 (file)
@@ -44,14 +44,15 @@ is_send(uint32_t opcode)
 }
 
 static int
-gen_disasm_find_end(struct gen_disasm *disasm, void *assembly, int start)
+gen_disasm_find_end(struct gen_disasm *disasm,
+                    const void *assembly, int start)
 {
    struct gen_device_info *devinfo = &disasm->devinfo;
    int offset = start;
 
    /* This loop exits when send-with-EOT or when opcode is 0 */
    while (true) {
-      brw_inst *insn = assembly + offset;
+      const brw_inst *insn = assembly + offset;
 
       if (brw_inst_cmpt_control(devinfo, insn)) {
          offset += 8;
@@ -70,7 +71,7 @@ gen_disasm_find_end(struct gen_disasm *disasm, void *assembly, int start)
 }
 
 void
-gen_disasm_disassemble(struct gen_disasm *disasm, void *assembly,
+gen_disasm_disassemble(struct gen_disasm *disasm, const void *assembly,
                        int start, FILE *out)
 {
    struct gen_device_info *devinfo = &disasm->devinfo;
index c8c18b2cf0372f7b866245552a06bff335eacb88..d979114588d5d6532c56f09c70b57f6a184ff8ca 100644 (file)
@@ -34,7 +34,7 @@ struct gen_disasm;
 
 struct gen_disasm *gen_disasm_create(const struct gen_device_info *devinfo);
 void gen_disasm_disassemble(struct gen_disasm *disasm,
-                            void *assembly, int start, FILE *out);
+                            const void *assembly, int start, FILE *out);
 
 void gen_disasm_destroy(struct gen_disasm *disasm);