Changes: Christian Thalinger
- $Id: disass.c 4058 2006-01-02 14:06:13Z twisti $
+ $Id: disass.c 4112 2006-01-09 19:21:25Z twisti $
*/
#include "config.h"
-#include <assert.h>
-#include <stdarg.h>
+#include <stdio.h>
#include "vm/types.h"
#include "mm/memory.h"
-#include "vm/jit/x86_64/dis-asm.h"
+#include "vm/jit/disass.h"
/* global variables ***********************************************************/
-char mylinebuf[512];
-int mylen;
-
-
/* name table for 16 integer registers */
char *regs[] = {
};
-/* myprintf ********************************************************************
-
- Required by i386-dis.c, prints the stuff into a buffer.
-
-*******************************************************************************/
-
-void myprintf(PTR p, const char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- mylen += vsprintf(mylinebuf + mylen, fmt, ap);
- va_end(ap);
-}
-
-
-/* buffer_read_memory **********************************************************
-
- Required by i386-dis.c, copy some stuff to another memory.
-
-*******************************************************************************/
-
-int buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info)
-{
- MCOPY(myaddr, (void *) memaddr, u1, length);
-
- return 0;
-}
-
-
-/* generic_symbol_at_address ***************************************************
-
- Required by i386-dis.c, just return 1.
-
-*******************************************************************************/
-
-int generic_symbol_at_address(bfd_vma addr, struct disassemble_info *info)
-{
- return 1;
-}
-
-
-/* generic_print_address *******************************************************
-
- Required by i386-dis.c, just print the address.
-
-*******************************************************************************/
-
-void generic_print_address(bfd_vma addr, struct disassemble_info *info)
-{
- myprintf(info->stream, "0x%016lx", addr);
-}
-
-
-/* perror_memory ***************************************************************
-
- Required by i386-dis.c, jsut assert in case.
-
-*******************************************************************************/
-
-void perror_memory(int status, bfd_vma memaddr, struct disassemble_info *info)
-{
- assert(0);
-}
-
-
/* disassinstr *****************************************************************
Outputs a disassembler listing of one machine code instruction on
s4 i;
if (!dis_initialized) {
- INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
+ INIT_DISASSEMBLE_INFO(info, NULL, disass_printf);
info.mach = bfd_mach_x86_64;
dis_initialized = 1;
}
printf("0x%016lx: ", (s8) code);
- mylen = 0;
+
+ disass_len = 0;
+
seqlen = print_insn_i386((bfd_vma) code, &info);
for (i = 0; i < seqlen; i++, code++) {
printf(" ");
}
- printf(" %s\n", mylinebuf);
+ printf(" %s\n", disass_buf);
return code;
}
{
disassemble_info info;
- INIT_DISASSEMBLE_INFO(info, NULL, myprintf);
+ INIT_DISASSEMBLE_INFO(info, NULL, disass_printf);
info.mach = bfd_mach_x86_64;
printf(" --- disassembler listing ---\n");