mirror of https://github.com/bochs-emu/Bochs
- updated in a few ways: use BX_PANIC and BX_INFO instead of stdio calls
- fixed references to CS - add prototypes for init and shutdown
This commit is contained in:
parent
ab33978151
commit
5188fd30f9
|
@ -66,6 +66,21 @@ static struct {
|
|||
} io_access[MAX_IO_ACCESSES];
|
||||
} instruction;
|
||||
|
||||
static logfunctions *instrument_log;
|
||||
#define LOG_THIS instrument_log->
|
||||
|
||||
void
|
||||
bx_instr_init ()
|
||||
{
|
||||
instrument_log = new logfunctions ();
|
||||
//BX_INFO (("init"));
|
||||
}
|
||||
|
||||
void
|
||||
bx_instr_shutdown ()
|
||||
{
|
||||
//BX_INFO (("shutdown"));
|
||||
}
|
||||
|
||||
void
|
||||
bx_instr_opcode_begin(Bit32u linear)
|
||||
|
@ -74,6 +89,8 @@ bx_instr_opcode_begin(Bit32u linear)
|
|||
|
||||
if (!collect_data) return;
|
||||
|
||||
//BX_INFO(("opcode_begin: linear address is %08x\n", linear));
|
||||
|
||||
is_valid = 1;
|
||||
instruction.opcode_size = 0;
|
||||
instruction.linear_iaddr = linear;
|
||||
|
@ -131,7 +148,7 @@ bx_instr_fetch_byte(Bit8u val8)
|
|||
if (!collect_data || !is_valid) return;
|
||||
|
||||
if ((instruction.opcode_size+1) > MAX_OPCODE_SIZE) {
|
||||
bx_panic("instr_fetch_byte: opcode too big.\n");
|
||||
BX_PANIC (("instr_fetch_byte: opcode too big.\n"));
|
||||
}
|
||||
else {
|
||||
instruction.opcode[instruction.opcode_size] = val8;
|
||||
|
@ -145,7 +162,7 @@ bx_instr_fetch_word(Bit16u val16)
|
|||
if (!collect_data || !is_valid) return;
|
||||
|
||||
if ((instruction.opcode_size+2) > MAX_OPCODE_SIZE) {
|
||||
bx_panic("instr_fetch_word: opcode too big.\n");
|
||||
BX_PANIC (("instr_fetch_word: opcode too big.\n"));
|
||||
}
|
||||
else {
|
||||
instruction.opcode[instruction.opcode_size] = val16 & 0xff;
|
||||
|
@ -160,7 +177,7 @@ bx_instr_fetch_dword(Bit32u val32)
|
|||
if (!collect_data || !is_valid) return;
|
||||
|
||||
if ((instruction.opcode_size+4) > MAX_OPCODE_SIZE) {
|
||||
bx_panic("instr_fetch_dword: opcode too big.\n");
|
||||
BX_PANIC (("instr_fetch_dword: opcode too big.\n"));
|
||||
}
|
||||
else {
|
||||
instruction.opcode[instruction.opcode_size] = val32; val32 >>= 8;
|
||||
|
@ -195,7 +212,7 @@ bx_instr_inp(Bit16u addr, unsigned len)
|
|||
if (!collect_data || !is_valid) return;
|
||||
|
||||
if (instruction.num_io_accesses >= MAX_IO_ACCESSES) {
|
||||
bx_panic("instr_inp: instructions has too many accesses\n");
|
||||
BX_PANIC (("instr_inp: instructions has too many accesses\n"));
|
||||
}
|
||||
index = instruction.num_io_accesses;
|
||||
instruction.io_access[index].addr = addr;
|
||||
|
@ -212,7 +229,7 @@ bx_instr_outp(Bit16u addr, unsigned len)
|
|||
if (!collect_data || !is_valid) return;
|
||||
|
||||
if (instruction.num_io_accesses >= MAX_IO_ACCESSES) {
|
||||
bx_panic("instr_outp: instructions has too many accesses\n");
|
||||
BX_PANIC (("instr_outp: instructions has too many accesses\n"));
|
||||
}
|
||||
index = instruction.num_io_accesses;
|
||||
instruction.io_access[index].addr = addr;
|
||||
|
@ -259,7 +276,7 @@ bx_instr_cnear_branch_taken(Bit32u new_eip)
|
|||
if (!collect_data || !is_valid) return;
|
||||
|
||||
// find linear address
|
||||
laddr = bx_cpu.cs.cache.u.segment.base + new_eip;
|
||||
laddr = BX_CPU(0)->sregs[BX_SREG_CS].cache.u.segment.base + new_eip;
|
||||
|
||||
// find physical address
|
||||
bx_cpu.dbg_xlate_linear2phy(laddr, &paddr, &valid);
|
||||
|
@ -291,7 +308,7 @@ bx_instr_ucnear_branch(unsigned what, Bit32u new_eip)
|
|||
if (!collect_data || !is_valid) return;
|
||||
|
||||
// find linear address
|
||||
laddr = bx_cpu.cs.cache.u.segment.base + new_eip;
|
||||
laddr = BX_CPU(0)->sregs[BX_SREG_CS].cache.u.segment.base + new_eip;
|
||||
|
||||
// find physical address
|
||||
bx_cpu.dbg_xlate_linear2phy(laddr, &paddr, &valid);
|
||||
|
@ -308,7 +325,7 @@ bx_instr_ucnear_branch(unsigned what, Bit32u new_eip)
|
|||
case BX_INSTR_IS_JMP: break;
|
||||
case BX_INSTR_IS_RET: break;
|
||||
default:
|
||||
bx_panic("instr_ucnear_branch: default case reached.\n");
|
||||
BX_PANIC (("instr_ucnear_branch: default case reached.\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,7 +341,7 @@ bx_instr_far_branch(unsigned what, Bit32u new_cs, Bit32u new_eip)
|
|||
if (!collect_data || !is_valid) return;
|
||||
|
||||
// find linear address
|
||||
laddr = bx_cpu.cs.cache.u.segment.base + new_eip;
|
||||
laddr = BX_CPU(0)->sregs[BX_SREG_CS].cache.u.segment.base + new_eip;
|
||||
|
||||
// find physical address
|
||||
bx_cpu.dbg_xlate_linear2phy(laddr, &paddr, &valid);
|
||||
|
@ -343,7 +360,7 @@ bx_instr_far_branch(unsigned what, Bit32u new_cs, Bit32u new_eip)
|
|||
case BX_INSTR_IS_JMP: break;
|
||||
case BX_INSTR_IS_RET: break;
|
||||
default:
|
||||
bx_panic("instr_far_branch: default case reached.\n");
|
||||
BX_PANIC (("instr_far_branch: default case reached.\n"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,7 +373,7 @@ bx_instr_lin_write(Bit32u lin, Bit32u phy, unsigned len)
|
|||
if (!collect_data || !is_valid) return;
|
||||
|
||||
if (instruction.num_data_accesses >= MAX_DATA_ACCESSES) {
|
||||
bx_panic("instr_lin_write: instruction has too many accesses\n");
|
||||
BX_PANIC (("instr_lin_write: instruction has too many accesses\n"));
|
||||
}
|
||||
index = instruction.num_data_accesses;
|
||||
instruction.data_access[index].paddr = A20ADDR(phy);
|
||||
|
@ -374,7 +391,7 @@ bx_instr_lin_read(Bit32u lin, Bit32u phy, unsigned len)
|
|||
if (!collect_data || !is_valid) return;
|
||||
|
||||
if (instruction.num_data_accesses >= MAX_DATA_ACCESSES) {
|
||||
bx_panic("instr_lin_read: instruction has too many accesses\n");
|
||||
BX_PANIC (("instr_lin_read: instruction has too many accesses\n"));
|
||||
}
|
||||
index = instruction.num_data_accesses;
|
||||
instruction.data_access[index].paddr = A20ADDR(phy);
|
||||
|
|
|
@ -40,6 +40,8 @@
|
|||
#define BX_INSTR_IS_JMP 13
|
||||
#define BX_INSTR_IS_INT 14
|
||||
|
||||
void bx_instr_init ();
|
||||
void bx_instr_shutdown ();
|
||||
void bx_instr_opcode_begin(Bit32u linear);
|
||||
void bx_instr_opcode_end(Bit32u linear);
|
||||
void bx_instr_fetch_byte(Bit8u val8);
|
||||
|
@ -56,6 +58,8 @@ void bx_instr_far_branch(unsigned what, Bit32u new_cs, Bit32u new_eip);
|
|||
void bx_instr_lin_read(Bit32u lin, Bit32u phy, unsigned len);
|
||||
void bx_instr_lin_write(Bit32u lin, Bit32u phy, unsigned len);
|
||||
|
||||
#define BX_INSTR_INIT() bx_instr_init ();
|
||||
#define BX_INSTR_SHUTDOWN() bx_instr_shutdown ();
|
||||
#define BX_INSTR_OPCODE_BEGIN(linear) bx_instr_opcode_begin(linear)
|
||||
#define BX_INSTR_OPCODE_END(linear) bx_instr_opcode_end(linear)
|
||||
#define BX_INSTR_FETCH_BYTE(val8) bx_instr_fetch_byte(val8)
|
||||
|
@ -100,8 +104,6 @@ void bx_instr_print(void);
|
|||
#endif
|
||||
|
||||
// rest are no-ops
|
||||
#define BX_INSTR_INIT()
|
||||
#define BX_INSTR_SHUTDOWN()
|
||||
#define BX_INSTR_OPCODE_BYTE1(b)
|
||||
#define BX_INSTR_OPCODE_BYTE2(b)
|
||||
#define BX_INSTR_OPCODE_G1EbIb(nnn)
|
||||
|
|
Loading…
Reference in New Issue