* Removed all Id tags.
[cacao.git] / src / vm / jit / sparc64 / disass.c
1 /* src/vm/jit/i386/disass.c - wrapper functions for GNU binutils disassembler
2
3    Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4    C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5    E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6    J. Wenninger, Institut f. Computersprachen - TU Wien
7
8    This file is part of CACAO.
9
10    This program is free software; you can redistribute it and/or
11    modify it under the terms of the GNU General Public License as
12    published by the Free Software Foundation; either version 2, or (at
13    your option) any later version.
14
15    This program is distributed in the hope that it will be useful, but
16    WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    General Public License for more details.
19
20    You should have received a copy of the GNU General Public License
21    along with this program; if not, write to the Free Software
22    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23    02110-1301, USA.
24
25    Contact: cacao@cacaojvm.org
26
27    Authors: Andreas  Krall
28             Reinhard Grafl
29             Christian Thalinger
30             Alexander Jordan
31
32    Changes:      
33
34 */
35
36
37 #include "config.h"
38
39 #include <assert.h>
40 #include <dis-asm.h>
41 #include <stdarg.h>
42
43 #include "vm/types.h"
44
45 #include "vm/global.h"
46 #include "vm/jit/disass.h"
47
48 char *regs[] = {
49         "g0",
50         "g1",
51         "g2",
52         "g3",
53         "g4",
54         "g5",
55         "g6",
56         "g7",
57         "o0",
58         "o1",
59         "o2",
60         "o3",
61         "o4",
62         "o5",
63         "o6",
64         "o7",
65         "l0",
66         "l1",
67         "l2",
68         "l3",
69         "l4",
70         "l5",
71         "l6",
72         "l7",
73         "l0",
74         "i1",
75         "i2",
76         "i3",
77         "i4",
78         "i5",
79         "i6",
80         "i7"
81 };
82
83 /* disassinstr *****************************************************************
84
85    Outputs a disassembler listing of one machine code instruction on
86    'stdout'.
87
88    code: instructions machine code
89
90 *******************************************************************************/
91
92 u1 *disassinstr(u1 *code)
93 {
94         if (!disass_initialized) {
95                 INIT_DISASSEMBLE_INFO(info, NULL, disass_printf);
96
97                 /* setting the struct members must be done after
98                    INIT_DISASSEMBLE_INFO */
99
100                 info.mach             = bfd_mach_sparc_v9;
101                 info.endian           = BFD_ENDIAN_BIG;
102                 info.read_memory_func = &disass_buffer_read_memory;
103
104                 disass_initialized = 1;
105         }
106
107         printf("0x%016lx:   %08x    ", (s8) code, *((u4 *) code));
108
109         print_insn_sparc((bfd_vma) code, &info);
110
111         printf("\n");
112
113         return code + 4;
114 }
115
116
117 /*
118  * These are local overrides for various environment variables in Emacs.
119  * Please do not remove this and leave it at the end of the file, where
120  * Emacs will automagically detect them.
121  * ---------------------------------------------------------------------
122  * Local variables:
123  * mode: c
124  * indent-tabs-mode: t
125  * c-basic-offset: 4
126  * tab-width: 4
127  * End:
128  */