mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 06:43:53 -06:00
Capstone disassembler
-----BEGIN PGP SIGNATURE----- iQEcBAABAgAGBQJZ8bGHAAoJEGTfOOivfiFfOXQH/jc3BbQ+ulxvQSgA3rI2JE1e Ww5FK5HEs4qZU3hz4EtE2Cd5p7qV5I4tWRtbxzc6BGBwLsfz3a60Abx7726sZiH0 ZuULTsWXQ/71XfZHQysgOSoy36G8xj/1yvrMWHjDCfWp/pzz479YXWSSn2TWEHpI jI6nKP5ALdv5XTAaglGaNzqVeWgjKXJn4O8qZFS7axj7hndzLFguymfm8rV8DAdd LRuYWOizzzJ0dcaO/HHyLTzSl7rR0g+DmcOAuFCREy4f+r6tXijwiirB5f7ZJiqc hgEBq/6NfztW2+pAUSxqI2Kuq1zVETTpZORH1+UxvVk9GPu1ouYldMx0NrYhDtc= =fC5W -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/rth/tags/pull-dis-20171026' into staging Capstone disassembler # gpg: Signature made Thu 26 Oct 2017 10:57:27 BST # gpg: using RSA key 0x64DF38E8AF7E215F # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" # Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A 05C0 64DF 38E8 AF7E 215F * remotes/rth/tags/pull-dis-20171026: disas: Add capstone as submodule disas: Remove monitor_disas_is_physical ppc: Support Capstone in disas_set_info arm: Support Capstone in disas_set_info i386: Support Capstone in disas_set_info disas: Support the Capstone disassembler library disas: Remove unused flags arguments target/arm: Don't set INSN_ARM_BE32 for CONFIG_USER_ONLY target/arm: Move BE32 disassembler fixup target/ppc: Convert to disas_set_info hook target/i386: Convert to disas_set_info hook Signed-off-by: Peter Maydell <peter.maydell@linaro.org> # Conflicts: # target/i386/cpu.c # target/ppc/translate_init.c
This commit is contained in:
commit
6e6430a821
33 changed files with 468 additions and 185 deletions
|
@ -307,12 +307,6 @@ typedef struct disassemble_info {
|
|||
(bfd_vma memaddr, bfd_byte *myaddr, int length,
|
||||
struct disassemble_info *info);
|
||||
|
||||
/* A place to stash the real read_memory_func if read_memory_func wants to
|
||||
do some funky address arithmetic or similar (e.g. for ARM BE32 mode). */
|
||||
int (*read_memory_inner_func)
|
||||
(bfd_vma memaddr, bfd_byte *myaddr, int length,
|
||||
struct disassemble_info *info);
|
||||
|
||||
/* Function which should be called if we get an error that we can't
|
||||
recover from. STATUS is the errno value from read_memory_func and
|
||||
MEMADDR is the address that we were trying to read. INFO is a
|
||||
|
@ -377,6 +371,10 @@ typedef struct disassemble_info {
|
|||
/* Command line options specific to the target disassembler. */
|
||||
char * disassembler_options;
|
||||
|
||||
/* Options for Capstone disassembly. */
|
||||
int cap_arch;
|
||||
int cap_mode;
|
||||
|
||||
} disassemble_info;
|
||||
|
||||
|
||||
|
@ -479,7 +477,6 @@ int generic_symbol_at_address(bfd_vma, struct disassemble_info *);
|
|||
(INFO).buffer_vma = 0, \
|
||||
(INFO).buffer_length = 0, \
|
||||
(INFO).read_memory_func = buffer_read_memory, \
|
||||
(INFO).read_memory_inner_func = NULL, \
|
||||
(INFO).memory_error_func = perror_memory, \
|
||||
(INFO).print_address_func = generic_print_address, \
|
||||
(INFO).print_insn = NULL, \
|
||||
|
|
38
include/disas/capstone.h
Normal file
38
include/disas/capstone.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
#ifndef QEMU_CAPSTONE_H
|
||||
#define QEMU_CAPSTONE_H 1
|
||||
|
||||
#ifdef CONFIG_CAPSTONE
|
||||
|
||||
#include <capstone.h>
|
||||
|
||||
#else
|
||||
|
||||
/* Just enough to allow backends to init without ifdefs. */
|
||||
|
||||
#define CS_ARCH_ARM -1
|
||||
#define CS_ARCH_ARM64 -1
|
||||
#define CS_ARCH_MIPS -1
|
||||
#define CS_ARCH_X86 -1
|
||||
#define CS_ARCH_PPC -1
|
||||
#define CS_ARCH_SPARC -1
|
||||
#define CS_ARCH_SYSZ -1
|
||||
|
||||
#define CS_MODE_LITTLE_ENDIAN 0
|
||||
#define CS_MODE_BIG_ENDIAN 0
|
||||
#define CS_MODE_ARM 0
|
||||
#define CS_MODE_16 0
|
||||
#define CS_MODE_32 0
|
||||
#define CS_MODE_64 0
|
||||
#define CS_MODE_THUMB 0
|
||||
#define CS_MODE_MCLASS 0
|
||||
#define CS_MODE_V8 0
|
||||
#define CS_MODE_MICRO 0
|
||||
#define CS_MODE_MIPS3 0
|
||||
#define CS_MODE_MIPS32R6 0
|
||||
#define CS_MODE_MIPSGP64 0
|
||||
#define CS_MODE_V9 0
|
||||
#define CS_MODE_MIPS32 0
|
||||
#define CS_MODE_MIPS64 0
|
||||
|
||||
#endif /* CONFIG_CAPSTONE */
|
||||
#endif /* QEMU_CAPSTONE_H */
|
|
@ -9,10 +9,10 @@
|
|||
/* Disassemble this for me please... (debugging). */
|
||||
void disas(FILE *out, void *code, unsigned long size);
|
||||
void target_disas(FILE *out, CPUState *cpu, target_ulong code,
|
||||
target_ulong size, int flags);
|
||||
target_ulong size);
|
||||
|
||||
void monitor_disas(Monitor *mon, CPUState *cpu,
|
||||
target_ulong pc, int nb_insn, int is_physical, int flags);
|
||||
target_ulong pc, int nb_insn, int is_physical);
|
||||
|
||||
/* Look up symbol for debugging purpose. Returns "" if unknown. */
|
||||
const char *lookup_symbol(target_ulong orig_addr);
|
||||
|
|
|
@ -38,9 +38,9 @@ static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
|
|||
#ifdef NEED_CPU_H
|
||||
/* disas() and target_disas() to qemu_logfile: */
|
||||
static inline void log_target_disas(CPUState *cpu, target_ulong start,
|
||||
target_ulong len, int flags)
|
||||
target_ulong len)
|
||||
{
|
||||
target_disas(qemu_logfile, cpu, start, len, flags);
|
||||
target_disas(qemu_logfile, cpu, start, len);
|
||||
}
|
||||
|
||||
static inline void log_disas(void *code, unsigned long size)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue