* assert.h, stdarg.h, vm/jit/x86_64/dis-asm.h: Removed.
authortwisti <none@none>
Mon, 9 Jan 2006 19:21:25 +0000 (19:21 +0000)
committertwisti <none@none>
Mon, 9 Jan 2006 19:21:25 +0000 (19:21 +0000)
* stdio.h, vm/jit/disass.h: Added.
* myprintf, buffer_read_memory, generic_symbol_at_address,
  generic_print_address, perror_memory: Likewise.
* Use disass-common.c stuff.

src/vm/jit/x86_64/disass.c

index dca173155d8fc8cc9b22f6286b4a128a2682be90..0acbf368791cba1815075ad9941a3eaf3a44a73d 100644 (file)
 
    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[] = {
@@ -73,71 +68,6 @@ 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
@@ -155,13 +85,15 @@ u1 *disassinstr(u1 *code)
        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++) {
@@ -172,7 +104,7 @@ u1 *disassinstr(u1 *code)
                printf("   ");
        }
 
-       printf("   %s\n", mylinebuf);
+       printf("   %s\n", disass_buf);
 
        return code;
 }
@@ -191,7 +123,7 @@ void disassemble(u1 *start, u1 *end)
 {
        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");