OpenCores
URL https://opencores.org/ocsvn/ao486/ao486/trunk

Subversion Repositories ao486

[/] [ao486/] [trunk/] [bochs486/] [instrument/] [stubs/] [instrument.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 alfik
/////////////////////////////////////////////////////////////////////////
2
// $Id: instrument.h 11295 2012-07-24 15:32:55Z sshwarts $
3
/////////////////////////////////////////////////////////////////////////
4
//
5
//   Copyright (c) 2006-2012 Stanislav Shwartsman
6
//          Written by Stanislav Shwartsman [sshwarts at sourceforge net]
7
//
8
//  This library is free software; you can redistribute it and/or
9
//  modify it under the terms of the GNU Lesser General Public
10
//  License as published by the Free Software Foundation; either
11
//  version 2 of the License, or (at your option) any later version.
12
//
13
//  This library is distributed in the hope that it will be useful,
14
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
15
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
//  Lesser General Public License for more details.
17
//
18
//  You should have received a copy of the GNU Lesser General Public
19
//  License along with this library; if not, write to the Free Software
20
//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
21
 
22
#if BX_INSTRUMENTATION
23
 
24
class bxInstruction_c;
25
 
26
// define if you want to store instruction opcode bytes in bxInstruction_c
27
//#define BX_INSTR_STORE_OPCODE_BYTES
28
 
29
void bx_instr_init_env(void);
30
void bx_instr_exit_env(void);
31
 
32
// called from the CPU core
33
 
34
void bx_instr_initialize(unsigned cpu);
35
void bx_instr_exit(unsigned cpu);
36
void bx_instr_reset(unsigned cpu, unsigned type);
37
void bx_instr_hlt(unsigned cpu);
38
void bx_instr_mwait(unsigned cpu, bx_phy_address addr, unsigned len, Bit32u flags);
39
 
40
void bx_instr_debug_promt();
41
void bx_instr_debug_cmd(const char *cmd);
42
 
43
void bx_instr_cnear_branch_taken(unsigned cpu, bx_address branch_eip, bx_address new_eip);
44
void bx_instr_cnear_branch_not_taken(unsigned cpu, bx_address branch_eip);
45
void bx_instr_ucnear_branch(unsigned cpu, unsigned what, bx_address branch_eip, bx_address new_eip);
46
void bx_instr_far_branch(unsigned cpu, unsigned what, Bit16u new_cs, bx_address new_eip);
47
 
48
void bx_instr_opcode(unsigned cpu, bxInstruction_c *i, const Bit8u *opcode, unsigned len, bx_bool is32, bx_bool is64);
49
//AO extended; was cpu,vector
50
void bx_instr_interrupt(unsigned cpu, unsigned vector, unsigned type, bx_bool push_error, Bit16u error_code);
51
void bx_instr_exception(unsigned cpu, unsigned vector, unsigned error_code);
52
void bx_instr_hwinterrupt(unsigned cpu, unsigned vector, Bit16u cs, bx_address eip);
53
 
54
void bx_instr_tlb_cntrl(unsigned cpu, unsigned what, bx_phy_address new_cr3);
55
void bx_instr_cache_cntrl(unsigned cpu, unsigned what);
56
void bx_instr_prefetch_hint(unsigned cpu, unsigned what, unsigned seg, bx_address offset);
57
void bx_instr_clflush(unsigned cpu, bx_address laddr, bx_phy_address paddr);
58
 
59
void bx_instr_before_execution(unsigned cpu, bxInstruction_c *i);
60
void bx_instr_after_execution(unsigned cpu, bxInstruction_c *i);
61
void bx_instr_repeat_iteration(unsigned cpu, bxInstruction_c *i);
62
 
63
void bx_instr_inp(Bit16u addr, unsigned len);
64
void bx_instr_inp2(Bit16u addr, unsigned len, unsigned val);
65
void bx_instr_outp(Bit16u addr, unsigned len, unsigned val);
66
 
67
void bx_instr_lin_access(unsigned cpu, bx_address lin, bx_address phy, unsigned len, unsigned rw);
68
void bx_instr_phy_access(unsigned cpu, bx_address phy, unsigned len, unsigned rw);
69
 
70
void bx_instr_wrmsr(unsigned cpu, unsigned addr, Bit64u value);
71
 
72
/* initialization/deinitialization of instrumentalization*/
73
#define BX_INSTR_INIT_ENV() bx_instr_init_env()
74
#define BX_INSTR_EXIT_ENV() bx_instr_exit_env()
75
 
76
/* simulation init, shutdown, reset */
77
#define BX_INSTR_INITIALIZE(cpu_id)      bx_instr_initialize(cpu_id)
78
#define BX_INSTR_EXIT(cpu_id)            bx_instr_exit(cpu_id)
79
#define BX_INSTR_RESET(cpu_id, type)     bx_instr_reset(cpu_id, type)
80
#define BX_INSTR_HLT(cpu_id)             bx_instr_hlt(cpu_id)
81
 
82
#define BX_INSTR_MWAIT(cpu_id, addr, len, flags) \
83
                       bx_instr_mwait(cpu_id, addr, len, flags)
84
 
85
/* called from command line debugger */
86
#define BX_INSTR_DEBUG_PROMPT()          bx_instr_debug_promt()
87
#define BX_INSTR_DEBUG_CMD(cmd)          bx_instr_debug_cmd(cmd)
88
 
89
/* branch resolution */
90
#define BX_INSTR_CNEAR_BRANCH_TAKEN(cpu_id, branch_eip, new_eip) bx_instr_cnear_branch_taken(cpu_id, branch_eip, new_eip)
91
#define BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(cpu_id, branch_eip) bx_instr_cnear_branch_not_taken(cpu_id, branch_eip)
92
#define BX_INSTR_UCNEAR_BRANCH(cpu_id, what, branch_eip, new_eip) bx_instr_ucnear_branch(cpu_id, what, branch_eip, new_eip)
93
#define BX_INSTR_FAR_BRANCH(cpu_id, what, new_cs, new_eip) bx_instr_far_branch(cpu_id, what, new_cs, new_eip)
94
 
95
/* decoding completed */
96
#define BX_INSTR_OPCODE(cpu_id, i, opcode, len, is32, is64) \
97
                       bx_instr_opcode(cpu_id, i, opcode, len, is32, is64)
98
 
99
/* exceptional case and interrupt */
100
#define BX_INSTR_EXCEPTION(cpu_id, vector, error_code) \
101
                bx_instr_exception(cpu_id, vector, error_code)
102
 
103
//AO extended; was cpu_id, vector
104
#define BX_INSTR_INTERRUPT(cpu_id, vector, type, push_error, error_code) bx_instr_interrupt(cpu_id, vector, type, push_error, error_code)
105
#define BX_INSTR_HWINTERRUPT(cpu_id, vector, cs, eip) bx_instr_hwinterrupt(cpu_id, vector, cs, eip)
106
 
107
/* TLB/CACHE control instruction executed */
108
#define BX_INSTR_CLFLUSH(cpu_id, laddr, paddr)    bx_instr_clflush(cpu_id, laddr, paddr)
109
#define BX_INSTR_CACHE_CNTRL(cpu_id, what)        bx_instr_cache_cntrl(cpu_id, what)
110
#define BX_INSTR_TLB_CNTRL(cpu_id, what, new_cr3) bx_instr_tlb_cntrl(cpu_id, what, new_cr3)
111
#define BX_INSTR_PREFETCH_HINT(cpu_id, what, seg, offset) \
112
                       bx_instr_prefetch_hint(cpu_id, what, seg, offset)
113
 
114
/* execution */
115
#define BX_INSTR_BEFORE_EXECUTION(cpu_id, i)  bx_instr_before_execution(cpu_id, i)
116
#define BX_INSTR_AFTER_EXECUTION(cpu_id, i)   bx_instr_after_execution(cpu_id, i)
117
#define BX_INSTR_REPEAT_ITERATION(cpu_id, i)  bx_instr_repeat_iteration(cpu_id, i)
118
 
119
/* linear memory access */
120
#define BX_INSTR_LIN_ACCESS(cpu_id, lin, phy, len, rw)  bx_instr_lin_access(cpu_id, lin, phy, len, rw)
121
 
122
/* physical memory access */
123
#define BX_INSTR_PHY_ACCESS(cpu_id, phy, len, rw)  bx_instr_phy_access(cpu_id, phy, len, rw)
124
 
125
/* feedback from device units */
126
#define BX_INSTR_INP(addr, len)               bx_instr_inp(addr, len)
127
#define BX_INSTR_INP2(addr, len, val)         bx_instr_inp2(addr, len, val)
128
#define BX_INSTR_OUTP(addr, len, val)         bx_instr_outp(addr, len, val)
129
 
130
/* wrmsr callback */
131
#define BX_INSTR_WRMSR(cpu_id, addr, value)   bx_instr_wrmsr(cpu_id, addr, value)
132
 
133
#else
134
 
135
/* initialization/deinitialization of instrumentalization */
136
#define BX_INSTR_INIT_ENV()
137
#define BX_INSTR_EXIT_ENV()
138
 
139
/* simulation init, shutdown, reset */
140
#define BX_INSTR_INITIALIZE(cpu_id)
141
#define BX_INSTR_EXIT(cpu_id)
142
#define BX_INSTR_RESET(cpu_id, type)
143
#define BX_INSTR_HLT(cpu_id)
144
#define BX_INSTR_MWAIT(cpu_id, addr, len, flags)
145
 
146
/* called from command line debugger */
147
#define BX_INSTR_DEBUG_PROMPT()
148
#define BX_INSTR_DEBUG_CMD(cmd)
149
 
150
/* branch resolution */
151
#define BX_INSTR_CNEAR_BRANCH_TAKEN(cpu_id, branch_eip, new_eip)
152
#define BX_INSTR_CNEAR_BRANCH_NOT_TAKEN(cpu_id, branch_eip)
153
#define BX_INSTR_UCNEAR_BRANCH(cpu_id, what, branch_eip, new_eip)
154
#define BX_INSTR_FAR_BRANCH(cpu_id, what, new_cs, new_eip)
155
 
156
/* decoding completed */
157
#define BX_INSTR_OPCODE(cpu_id, i, opcode, len, is32, is64)
158
 
159
/* exceptional case and interrupt */
160
#define BX_INSTR_EXCEPTION(cpu_id, vector, error_code)
161
#define BX_INSTR_INTERRUPT(cpu_id, vector)
162
#define BX_INSTR_HWINTERRUPT(cpu_id, vector, cs, eip)
163
 
164
/* TLB/CACHE control instruction executed */
165
#define BX_INSTR_CLFLUSH(cpu_id, laddr, paddr)
166
#define BX_INSTR_CACHE_CNTRL(cpu_id, what)
167
#define BX_INSTR_TLB_CNTRL(cpu_id, what, new_cr3)
168
#define BX_INSTR_PREFETCH_HINT(cpu_id, what, seg, offset)
169
 
170
/* execution */
171
#define BX_INSTR_BEFORE_EXECUTION(cpu_id, i)
172
#define BX_INSTR_AFTER_EXECUTION(cpu_id, i)
173
#define BX_INSTR_REPEAT_ITERATION(cpu_id, i)
174
 
175
/* linear memory access */
176
#define BX_INSTR_LIN_ACCESS(cpu_id, lin, phy, len, rw)
177
 
178
/* physical memory access */
179
#define BX_INSTR_PHY_ACCESS(cpu_id, phy, len, rw)
180
 
181
/* feedback from device units */
182
#define BX_INSTR_INP(addr, len)
183
#define BX_INSTR_INP2(addr, len, val)
184
#define BX_INSTR_OUTP(addr, len, val)
185
 
186
/* wrmsr callback */
187
#define BX_INSTR_WRMSR(cpu_id, addr, value)
188
 
189
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.