[Mesa-dev] [PATCH 1/2] intel: Make the disassembler take a const pointer to the assembly.

Lionel Landwerlin lionel.g.landwerlin at intel.com
Tue Jul 17 16:32:06 UTC 2018


Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

On 11/07/18 19:25, Kenneth Graunke wrote:
> Disassembling doesn't modify the assembly.
> ---
>   src/intel/common/gen_disasm.c | 7 ++++---
>   src/intel/common/gen_disasm.h | 2 +-
>   2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/src/intel/common/gen_disasm.c b/src/intel/common/gen_disasm.c
> index 1de20f576d4..4f835c19883 100644
> --- a/src/intel/common/gen_disasm.c
> +++ b/src/intel/common/gen_disasm.c
> @@ -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;
> diff --git a/src/intel/common/gen_disasm.h b/src/intel/common/gen_disasm.h
> index c8c18b2cf03..d979114588d 100644
> --- a/src/intel/common/gen_disasm.h
> +++ b/src/intel/common/gen_disasm.h
> @@ -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);
>   




More information about the mesa-dev mailing list