Skip to content
Permalink
Browse files

updated disasm to binuils 2.31 and enabled ARM

Change-Id: I40a34c55443902c6596f03fcb463a56e91546af5
  • Loading branch information
Frank Mehnert authored and kk-infra committed Oct 22, 2018
1 parent e303bdc commit 3b73c2ec30319ed8e9a141ce5cbc19f72850810b
Showing with 82,482 additions and 13,535 deletions.
  1. +1 −1 src/Kconfig
  2. +1 −1 src/Modules.amd64
  3. +9 −2 src/Modules.arm
  4. +1 −1 src/Modules.ia32
  5. +74 −29 src/jdb/jdb_disasm.cpp
  6. +1 −0 src/kern/arm/Kconfig
  7. +3,256 −786 src/lib/disasm/bfd/bfd.h
  8. +12 −0 src/lib/disasm/bfd/bfd_stdint.h
  9. +1,120 −391 src/lib/disasm/bfd/elf-bfd.h
  10. +19 −21 src/lib/disasm/bfd/libbfd.c
  11. +3,276 −4 src/lib/disasm/bfd/libbfd.h
  12. +36 −2 src/lib/disasm/disasm.cc
  13. +144 −29 src/lib/disasm/elf/arm.h
  14. +465 −69 src/lib/disasm/elf/common.h
  15. +59 −16 src/lib/disasm/elf/external.h
  16. +6 −4 src/lib/disasm/elf/i386.h
  17. +129 −54 src/lib/disasm/elf/internal.h
  18. +30 −2 src/lib/disasm/elf/reloc-macros.h
  19. +18 −7 src/lib/disasm/elf/x86-64.h
  20. +115 −150 src/lib/disasm/include/ansidecl.h
  21. +323 −151 src/lib/disasm/include/bfdlink.h
  22. +89 −0 src/lib/disasm/include/diagnostics.h
  23. +103 −101 src/lib/disasm/include/dis-asm.h
  24. +21 −2 src/lib/disasm/include/floatformat.h
  25. +3 −0 src/lib/disasm/include/libiberty.h
  26. +1,206 −0 src/lib/disasm/include/opcode/aarch64.h
  27. +302 −91 src/lib/disasm/include/opcode/arm.h
  28. +141 −0 src/lib/disasm/include/opcode/i386.h
  29. +294 −125 src/lib/disasm/include/opcode/ppc.h
  30. +111 −25 src/lib/disasm/include/opcode/sparc.h
  31. +36 −5 src/lib/disasm/include/safe-ctype.h
  32. +7 −1 src/lib/disasm/include/symcat.h
  33. +0 −257 src/lib/disasm/libiberty/safe-ctype.c
  34. +19,975 −0 src/lib/disasm/opcodes/aarch64-dis-2.c
  35. +3,411 −0 src/lib/disasm/opcodes/aarch64-dis.c
  36. +128 −0 src/lib/disasm/opcodes/aarch64-dis.h
  37. +318 −0 src/lib/disasm/opcodes/aarch64-opc-2.c
  38. +4,625 −0 src/lib/disasm/opcodes/aarch64-opc.c
  39. +489 −0 src/lib/disasm/opcodes/aarch64-opc.h
  40. +4,805 −0 src/lib/disasm/opcodes/aarch64-tbl.h
  41. +4,599 −1,946 src/lib/disasm/opcodes/arm-dis.c
  42. +8 −6 src/lib/disasm/opcodes/dis-buf.c
  43. +2 −1 src/lib/disasm/opcodes/dis-init.c
  44. +104 −0 src/lib/disasm/opcodes/disassemble.h
  45. +4,102 −0 src/lib/disasm/opcodes/i386-dis-evex.h
  46. +17,032 −3,662 src/lib/disasm/opcodes/i386-dis.c
  47. +61 −0 src/lib/disasm/opcodes/opintl.h
  48. +650 −174 src/lib/disasm/opcodes/ppc-dis.c
  49. +8,480 −3,833 src/lib/disasm/opcodes/ppc-opc.c
  50. +101 −34 src/lib/disasm/opcodes/sparc-dis.c
  51. +2,103 −1,550 src/lib/disasm/opcodes/sparc-opc.c
  52. +81 −2 src/lib/disasm/opcodes/sysdep.h
@@ -474,7 +474,7 @@ config JDB_LOGGING

config JDB_DISASM
bool "JDB disassembler" if HAS_JDB_DISASM_OPTION
default y if HAS_JDB_DISASM_OPTION
default y if HAS_JDB_DISASM_OPTION && !ARM
help
Add support for disassembly. Increases memory foot-print, only
enable when needed.
@@ -372,7 +372,7 @@ VPATH += lib/minilibc/$(CONFIG_XARCH) lib/minilibc
PRIVATE_INCDIR += lib/minilibc/$(CONFIG_XARCH)/include lib/minilibc/include
CSRC_MINILIBC := atexit.c memccpy.c memcmp.c memmove.c memset.c memcpy.c \
memchr.c strchr.c strcmp.c strcpy.c strlen.c strncmp.c \
strncpy.c strstr.c printf.c __v_printf.c \
stpcpy.c strncpy.c strstr.c printf.c __v_printf.c \
vprintf.c strtol.c strtoul.c lltostr.c __ltostr.c \
putchar.c puts.c getchar.c gets.c sprintf.c \
snprintf.c vsnprintf.c vsprintf.c longjmp.c isalnum.c \
@@ -273,6 +273,7 @@ ifeq ("$(CONFIG_JDB_DISASM)","y")
endif
SUBSYSTEMS += LIBDISASM
KERNEL_EXTRA_LIBS += $(LIBDISASM)
PREPROCESS_PARTS += jdb_disasm

LIBDISASM := libdisasm.a
VPATH += lib/disasm lib/disasm/elf lib/disasm/include \
@@ -283,8 +284,14 @@ ifeq ("$(CONFIG_JDB_DISASM)","y")
lib/disasm/libiberty lib/disasm/bfd
PRIVATE_INCDIR += lib/disasm
CXXSRC_LIBDISASM := disasm.cc
CSRC_LIBDISASM := arm-dis.c dis-init.c dis-buf.c safe-ctype.c
NOOPT += $(patsubst %.o, %, $(OBJ_LIBDISASM))
ifeq ($(CONFIG_BIT64),y)
CSRC_LIBDISASM := aarch64-dis.c aarch64-dis-2.c \
aarch64-opc.c aarch64-opc-2.c \
dis-init.c dis-buf.c libbfd.c
else
CSRC_LIBDISASM := arm-dis.c dis-init.c dis-buf.c
endif
NOOPT += $(patsubst %.o, %, $(OBJ_LIBDISASM))
endif

#
@@ -369,7 +369,7 @@ VPATH += lib/minilibc/$(CONFIG_XARCH) lib/minilibc
PRIVATE_INCDIR += lib/minilibc/$(CONFIG_XARCH)/include lib/minilibc/include
CSRC_MINILIBC := atexit.c memccpy.c memcmp.c memmove.c memset.c memcpy.c \
memchr.c strchr.c strcmp.c strcpy.c strlen.c strncmp.c \
strncpy.c strstr.c printf.c __v_printf.c \
stpcpy.c strncpy.c strstr.c printf.c __v_printf.c \
vprintf.c strtol.c strtoul.c lltostr.c __ltostr.c \
putchar.c puts.c getchar.c gets.c sprintf.c \
snprintf.c vsnprintf.c vsprintf.c longjmp.c isalnum.c \
@@ -108,45 +108,38 @@ static
Address
Jdb_disasm::disasm_offset(Address &start, int offset, Space *task)
{
if (offset>0)
Address addr = start;
if (offset > 0)
{
Address addr = start;
while (offset--)
{
if (!disasm_line(0, 0, addr, 0, task))
{
start = addr + offset;
return false;
}
if (!disasm_offset_incr(addr, task))
{
start = addr + offset;
return false;
}
if (at_symbol(addr, task) && !offset--)
break;
if (at_line(addr, task) && !offset--)
break;
}
start = addr;
return true;
}

while (offset++)
else
{
Address addr = start-64, va_start;
for (;;)
{
va_start = addr;
if (!disasm_line(0, 0, addr, 0, task))
{
start += offset-1;
return false;
}
if (addr >= start)
break;
}
start = va_start;
if (at_symbol(addr, task) && !offset++)
break;
if (at_line(addr, task) && !offset++)
break;
while (offset++)
{
if (!disasm_offset_decr(addr, task))
{
start = addr + offset - 1;
return false;
}
if (at_symbol(addr, task) && !offset++)
break;
if (at_line(addr, task) && !offset++)
break;
}
}
start = addr;
return true;
}

@@ -231,13 +224,15 @@ Jdb_disasm::show(Address virt, Space *task, int level, bool do_clear_screen = fa
}

// show instruction breakpoint
#if defined(CONFIG_IA32) || defined(CONFIG_AMD64)
if (Mword i = Jdb_bp::instruction_bp_at_addr(addr))
{
stat_str[0] = '#';
stat_str[1] = '0' + i - 1;
}
#endif

printf("%s" L4_PTR_FMT "%s%s ",
printf("%s" L4_PTR_FMT "%s%s ",
addr == enter_addr ? Jdb::esc_emph : "", addr, stat_str,
addr == enter_addr ? "\033[m" : "");
show_disasm_line(
@@ -357,3 +352,53 @@ Jdb_disasm::Jdb_disasm()
{}

static Jdb_disasm jdb_disasm INIT_PRIORITY(JDB_MODULE_INIT_PRIO);


IMPLEMENTATION[jdb_disasm && !arm]:

static
bool
Jdb_disasm::disasm_offset_decr(Address &addr, Space *task)
{
Address test_addr = addr - 64;
Address work_addr;
for (;;)
{
work_addr = test_addr;
if (!disasm_line(0, 0, test_addr, 0, task))
return false;
if (test_addr >= addr)
break;
}
addr = work_addr;
return true;
}

static
bool
Jdb_disasm::disasm_offset_incr(Address &addr, Space *task)
{
if (!disasm_line(0, 0, addr, 0, task))
return false;

return true;
}


IMPLEMENTATION[jdb_disasm && arm]:

static
bool
Jdb_disasm::disasm_offset_decr(Address &addr, Space *)
{
addr -= 4;
return true;
}

static
bool
Jdb_disasm::disasm_offset_incr(Address &addr, Space *)
{
addr += 4;
return true;
}
@@ -6,6 +6,7 @@
# ARCHSELECT: FPU if CPU_VIRT
# ARCHSELECT: ARM_LPAE if CPU_VIRT || BIT64
# ARCHSELECT: HAS_SERIAL_OPTION
# ARCHSELECT: HAS_JDB_DISASM_OPTION
# ARCHSELECT: HAS_JDB_GZIP_OPTION
# ARCHSELECT: HAS_VIRT_OBJ_SPACE_OPTION if ARM_V6PLUS && !CPU_VIRT && !ARM_1176_CACHE_ALIAS_FIX
#

0 comments on commit 3b73c2e

Please sign in to comment.
You can’t perform that action at this time.