* Removed all Id tags.
[cacao.git] / src / vm / jit / disass.h
1 /* src/vm/jit/disass.h - disassembler header
2
3    Copyright (C) 1996-2005, 2006, 2007 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 */
26
27
28 #ifndef _DISASS_H
29 #define _DISASS_H
30
31 #include "config.h"
32
33 #if defined(WITH_BINUTILS_DISASSEMBLER)
34 # include <dis-asm.h>
35 #endif
36
37 #include "vm/types.h"
38
39 #if defined(ENABLE_DISASSEMBLER)
40
41 /* some macros ****************************************************************/
42
43 #if defined(ENABLE_JIT)
44 # if defined(ENABLE_INTRP)
45
46 #define DISASSINSTR(code) \
47     do { \
48         if (opt_intrp) \
49             (code) = intrp_disassinstr((code)); \
50         else \
51             (code) = disassinstr((code)); \
52     } while (0)
53
54 #define DISASSEMBLE(start,end) \
55     do { \
56         if (opt_intrp) \
57             intrp_disassemble((start), (end)); \
58         else \
59             disassemble((start), (end)); \
60     } while (0)
61
62 # else /* defined(ENABLE_INTRP) */
63
64 #define DISASSINSTR(code) \
65     (code) = disassinstr((code))
66
67 #define DISASSEMBLE(start,end) \
68     disassemble((start), (end))
69
70 # endif /* defined(ENABLE_INTRP) */
71 #else /* defined(ENABLE_JIT) */
72
73 #define DISASSINSTR(code) \
74     (code) = intrp_disassinstr((code))
75
76 #define DISASSEMBLE(start,end) \
77     intrp_disassemble((start), (end))
78
79 #endif /* defined(ENABLE_JIT) */
80
81
82 /* export global variables ****************************************************/
83
84 #if defined(WITH_BINUTILS_DISASSEMBLER)
85 extern disassemble_info info;
86 extern bool disass_initialized;
87 #endif
88
89 #if defined(__I386__) || defined(__X86_64__) || defined(__S390__) || defined(__M68K__)
90 extern char disass_buf[512];
91 extern s4   disass_len;
92 #endif
93
94
95 /* function prototypes *******************************************************/
96
97 #if defined(ENABLE_JIT)
98 void disassemble(u1 *start, u1 *end);
99 #endif
100
101 #if defined(WITH_BINUTILS_DISASSEMBLER)
102 void disass_printf(PTR p, const char *fmt, ...);
103
104 int disass_buffer_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info);
105 #endif
106
107 /* machine dependent functions */
108
109 #if defined(ENABLE_JIT)
110 u1 *disassinstr(u1 *code);
111 #endif
112
113 #if defined(ENABLE_INTRP)
114 u1 *intrp_disassinstr(u1 *code);
115 void intrp_disassemble(u1 *start, u1 *end);
116 #endif
117
118 #endif /* defined(ENABLE_DISASSEMBLER) */
119
120 #endif /* _DISASS_H */
121
122
123 /*
124  * These are local overrides for various environment variables in Emacs.
125  * Please do not remove this and leave it at the end of the file, where
126  * Emacs will automagically detect them.
127  * ---------------------------------------------------------------------
128  * Local variables:
129  * mode: c
130  * indent-tabs-mode: t
131  * c-basic-offset: 4
132  * tab-width: 4
133  * End:
134  */