Skip to content

Commit

Permalink
disas: Push const down through host disassembly
Browse files Browse the repository at this point in the history
Reviewed-by: Joelle van Dyne <j@getutm.app>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
  • Loading branch information
rth7680 committed Jan 7, 2021
1 parent ffba3eb commit f06176b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions disas.c
Expand Up @@ -299,10 +299,8 @@ char *plugin_disas(CPUState *cpu, uint64_t addr, size_t size)
}

/* Disassemble this for me please... (debugging). */
void disas(FILE *out, const void *ccode, unsigned long size)
void disas(FILE *out, const void *code, unsigned long size)
{
/* TODO: Push constness through the disas backends. */
void *code = (void *)ccode;
uintptr_t pc;
int count;
CPUDebug s;
Expand Down
2 changes: 1 addition & 1 deletion disas/capstone.c
Expand Up @@ -229,7 +229,7 @@ bool cap_disas_target(disassemble_info *info, uint64_t pc, size_t size)
}

/* Disassemble SIZE bytes at CODE for the host. */
bool cap_disas_host(disassemble_info *info, void *code, size_t size)
bool cap_disas_host(disassemble_info *info, const void *code, size_t size)
{
csh handle;
const uint8_t *cbuf;
Expand Down
4 changes: 2 additions & 2 deletions include/disas/dis-asm.h
Expand Up @@ -358,7 +358,7 @@ typedef struct disassemble_info {
(bfd_vma addr, struct disassemble_info * info);

/* These are for buffer_read_memory. */
bfd_byte *buffer;
const bfd_byte *buffer;
bfd_vma buffer_vma;
int buffer_length;

Expand Down Expand Up @@ -462,7 +462,7 @@ int print_insn_rx(bfd_vma, disassemble_info *);

#ifdef CONFIG_CAPSTONE
bool cap_disas_target(disassemble_info *info, uint64_t pc, size_t size);
bool cap_disas_host(disassemble_info *info, void *code, size_t size);
bool cap_disas_host(disassemble_info *info, const void *code, size_t size);
bool cap_disas_monitor(disassemble_info *info, uint64_t pc, int count);
bool cap_disas_plugin(disassemble_info *info, uint64_t pc, size_t size);
#else
Expand Down

0 comments on commit f06176b

Please sign in to comment.