Search
lxdream.org :: lxdream :: r1092:7c4ffe27e7b5
lxdream 0.9.1
released Jun 29
Download Now
changeset1092:7c4ffe27e7b5
parent1091:186558374345
child1093:34faf227070e
authornkeynes
dateSun Dec 20 21:01:03 2009 +1000 (14 years ago)
Fix 64-bit x86 disassembly
Add crash-report hook to SIGILL and SIGBUS
src/sh4/sh4x86.in
src/util.c
src/x86dasm/dis-buf.c
src/x86dasm/x86dasm.c
1.1 --- a/src/sh4/sh4x86.in Tue Dec 15 08:46:37 2009 +1000
1.2 +++ b/src/sh4/sh4x86.in Sun Dec 20 21:01:03 2009 +1000
1.3 @@ -163,13 +163,17 @@
1.4 uint32_t source_pc = source_start;
1.5 uint32_t source_end = source_pc;
1.6 xlat_recovery_record_t source_recov_table = XLAT_RECOVERY_TABLE(code);
1.7 - xlat_recovery_record_t source_recov_end = source_recov_table + XLAT_BLOCK_FOR_CODE(code)->recover_table_size;
1.8 + xlat_recovery_record_t source_recov_end = source_recov_table + XLAT_BLOCK_FOR_CODE(code)->recover_table_size - 1;
1.9
1.10 for( target_pc = target_start; target_pc < target_end; ) {
1.11 uintptr_t pc2 = x86_disasm_instruction( target_pc, buf, sizeof(buf), op );
1.12 - fprintf( out, "%c%08X: %-20s %-40s", (target_pc == (uintptr_t)native_pc ? '*' : ' '),
1.13 - (unsigned int)target_pc, op, buf );
1.14 -
1.15 +#if SIZEOF_VOID_P == 8
1.16 + fprintf( out, "%c%016lx: %-30s %-40s", (target_pc == (uintptr_t)native_pc ? '*' : ' '),
1.17 + target_pc, op, buf );
1.18 +#else
1.19 + fprintf( out, "%c%08x: %-30s %-40s", (target_pc == (uintptr_t)native_pc ? '*' : ' '),
1.20 + target_pc, op, buf );
1.21 +#endif
1.22 if( source_recov_table < source_recov_end &&
1.23 target_pc >= (target_start + source_recov_table->xlat_offset) ) {
1.24 source_recov_table++;
2.1 --- a/src/util.c Tue Dec 15 08:46:37 2009 +1000
2.2 +++ b/src/util.c Sun Dec 20 21:01:03 2009 +1000
2.3 @@ -58,6 +58,8 @@
2.4 sigemptyset(&sa.sa_mask);
2.5 sa.sa_flags = SA_RESETHAND|SA_SIGINFO;
2.6 sigaction( SIGSEGV, &sa, NULL );
2.7 + sigaction( SIGILL, &sa, NULL );
2.8 + sigaction( SIGBUS, &sa, NULL );
2.9 }
2.10
2.11
3.1 --- a/src/x86dasm/dis-buf.c Tue Dec 15 08:46:37 2009 +1000
3.2 +++ b/src/x86dasm/dis-buf.c Sun Dec 20 21:01:03 2009 +1000
3.3 @@ -31,14 +31,8 @@
3.4 struct disassemble_info *info;
3.5 {
3.6 unsigned int opb = info->octets_per_byte;
3.7 - unsigned int end_addr_offset = length / opb;
3.8 - unsigned int max_addr_offset = info->buffer_length / opb;
3.9 - unsigned int octets = (memaddr - info->buffer_vma) * opb;
3.10 + uintptr_t octets = memaddr * opb;
3.11
3.12 - if (memaddr < info->buffer_vma
3.13 - || memaddr - info->buffer_vma + end_addr_offset > max_addr_offset)
3.14 - /* Out of bounds. Use EIO because GDB uses it. */
3.15 - return EIO;
3.16 memcpy (myaddr, info->buffer + octets, length);
3.17
3.18 return 0;
4.1 --- a/src/x86dasm/x86dasm.c Tue Dec 15 08:46:37 2009 +1000
4.2 +++ b/src/x86dasm/x86dasm.c Sun Dec 20 21:01:03 2009 +1000
4.3 @@ -76,8 +76,6 @@
4.4 #endif
4.5 x86_disasm_info.endian = BFD_ENDIAN_LITTLE;
4.6 x86_disasm_info.buffer = 0;
4.7 - x86_disasm_info.buffer_vma = 0;
4.8 - x86_disasm_info.buffer_length = -1;
4.9 x86_disasm_info.print_address_func = x86_print_address;
4.10 }
4.11
.