1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
|
/////////////////////////////////////////////////////////////////////////
// $Id: sim2.cc,v 1.3 2001/10/03 13:10:37 bdenney Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
//
// MandrakeSoft S.A.
// 43, rue d'Aboukir
// 75002 Paris - France
// http://www.linux-mandrake.com/
// http://www.mandrakesoft.com/
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "bochs.h"
// NOTE: This file contains only stubs for a second CPU simulator
// to demonstrate use with the bochs debugger. The goal is to
// be able to run multiple simulators in a co-simulation environment.
// Each simulator has it's own CPU and memory space. There is only
// one set of device models, managed by the debugger.
Boolean sim2_set_mem(Bit32u addr, unsigned len, Bit8u *buf);
Boolean sim2_fetch_mem(Bit32u addr, unsigned len, Bit8u *buf);
void sim2_xlate_linear2phy(Bit32u linear, Bit32u *phy, Boolean *valid);
Boolean sim2_set_reg(unsigned reg, Bit32u val);
Bit32u sim2_get_reg(unsigned reg);
Boolean sim2_set_cpu(bx_dbg_cpu_t *cpu);
Boolean sim2_get_cpu(bx_dbg_cpu_t *cpu);
unsigned dirty_page_tbl_size;
unsigned char sim2_dirty_pages[(BX_MAX_DIRTY_PAGE_TABLE_MEGS * 1024 * 1024) / 4096];
void sim2_atexit(void);
unsigned sim2_query_pending(void);
void sim2_cpu_loop(void);
void sim2_take_irq(void);
void sim2_take_dma(void);
void sim2_reset_cpu(void);
void sim2_init_mem(int size_in_bytes);
void sim2_load_ROM(const char *path, Bit32u romaddress);
void sim2_set_A20(unsigned val);
void sim2_set_NMI(unsigned val);
void sim2_set_RESET(unsigned val);
void sim2_set_INTR(unsigned val);
void sim2_force_interrupt(unsigned vector);
#if BX_INSTRUMENTATION
void sim2_instr_start(void);
void sim2_instr_stop(void);
void sim2_instr_reset(void);
void sim2_instr_print(void);
#endif
#if BX_USE_LOADER
void sim2_loader(char *path);
#endif
#if BX_DBG_EXTENSIONS
// return 0 if command not handled by extensions, bochs will handle
// return 1 if command handled by extensions, bochs will ignore
int
bx_dbg_extensions(char *command)
{
UNUSED(command);
return(0); // no extensions for now
}
#endif
void
sim2_init(bx_dbg_callback_t *callback, int argc, char *argv[])
{
callback->setphymem = sim2_set_mem;
callback->getphymem = sim2_fetch_mem;
callback->xlate_linear2phy = sim2_xlate_linear2phy;
callback->set_reg = sim2_set_reg;
callback->get_reg = sim2_get_reg;
callback->get_cpu = sim2_get_cpu;
callback->set_cpu = sim2_set_cpu;
callback->dirty_page_tbl_size = sizeof(sim2_dirty_pages);
callback->dirty_page_tbl = sim2_dirty_pages;
callback->atexit = sim2_atexit;
callback->query_pending = sim2_query_pending;
callback->execute = sim2_cpu_loop;
callback->take_irq = sim2_take_irq;
callback->take_dma = sim2_take_dma;
callback->reset_cpu = sim2_reset_cpu;
callback->init_mem = sim2_init_mem;
callback->load_ROM = sim2_load_ROM;
// You may set this to NULL and use values in bx_pc_system as per
// docs-html/cosimulation.html
callback->set_A20 = sim2_set_A20;
callback->set_NMI = sim2_set_NMI;
callback->set_RESET = sim2_set_RESET;
callback->set_INTR = sim2_set_INTR;
callback->force_interrupt = sim2_force_interrupt;
#if BX_INSTRUMENTATION
callback->instr_start = sim2_instr_start;
callback->instr_stop = sim2_instr_stop;
callback->instr_reset = sim2_instr_reset;
callback->instr_print = sim2_instr_print;
#endif
#if BX_USE_LOADER
callback->loader = sim2_loader;
#endif
}
Boolean
sim2_set_mem(Bit32u addr, unsigned len, Bit8u *buf)
{
return(0);
}
Boolean
sim2_fetch_mem(Bit32u addr, unsigned len, Bit8u *buf)
{
return(0);
}
void
sim2_xlate_linear2phy(Bit32u linear, Bit32u *phy, Boolean *valid)
{
}
Boolean
sim2_set_reg(unsigned reg, Bit32u val)
{
return(0);
}
Bit32u
sim2_get_reg(unsigned reg)
{
return(0);
}
Boolean
sim2_set_cpu(bx_dbg_cpu_t *cpu)
{
return(0);
}
Boolean
sim2_get_cpu(bx_dbg_cpu_t *cpu)
{
return(0);
}
void
sim2_atexit(void)
{
}
unsigned
sim2_query_pending(void)
{
return(0);
}
void
sim2_cpu_loop(void)
{
}
void
sim2_take_irq(void)
{
}
void
sim2_take_dma(void)
{
}
void
sim2_reset_cpu(void)
{
}
void
sim2_init_mem(int size_in_bytes)
{
}
void
sim2_load_ROM(const char *path, Bit32u romaddress)
{
}
void
sim2_set_A20(unsigned val)
{
}
void
sim2_set_NMI(unsigned val)
{
}
void
sim2_set_RESET(unsigned val)
{
}
void
sim2_set_INTR(unsigned val)
{
}
void
sim2_force_interrupt(unsigned vector)
{
}
#if BX_INSTRUMENTATION
void
sim2_instr_start(void)
{
}
void
sim2_instr_stop(void)
{
}
void
sim2_instr_reset(void)
{
}
void
sim2_instr_print(void)
{
}
#endif
#if BX_USE_LOADER
void
sim2_loader(char *path)
{
}
#endif
|