setprefix -> put

This commit is contained in:
Todd T.Fries 2001-06-27 19:16:01 +00:00
parent 6af3f5bd9f
commit a06b031dcf
38 changed files with 57 additions and 52 deletions

View File

@ -248,7 +248,7 @@ public:
void ldebug(char *fmt, ...); void ldebug(char *fmt, ...);
void fatal (char *prefix, char *fmt, va_list ap); void fatal (char *prefix, char *fmt, va_list ap);
void ask (int level, char *prefix, char *fmt, va_list ap); void ask (int level, char *prefix, char *fmt, va_list ap);
void setprefix(char *); void put(char *);
void settype(int); void settype(int);
void setio(class iofunctions *); void setio(class iofunctions *);
void setonoff(int loglev, int value) { void setonoff(int loglev, int value) {

View File

@ -9,7 +9,7 @@ bx_generic_apic_c *apic_index[APIC_MAX_ID];
bx_generic_apic_c::bx_generic_apic_c () bx_generic_apic_c::bx_generic_apic_c ()
{ {
id = APIC_UNKNOWN_ID; id = APIC_UNKNOWN_ID;
setprefix("APIC?"); put("APIC?");
settype(APICLOG); settype(APICLOG);
hwreset (); hwreset ();
} }
@ -272,10 +272,10 @@ void bx_local_apic_c::set_id (Bit8u newid) {
if (id >= 0 && id <= 15) { if (id >= 0 && id <= 15) {
char buffer[16]; char buffer[16];
sprintf (buffer, "APIC%x", id); sprintf (buffer, "APIC%x", id);
setprefix(buffer); put(buffer);
settype(CPU0LOG + id); settype(CPU0LOG + id);
sprintf (buffer, "CPU%x", id); sprintf (buffer, "CPU%x", id);
cpu->setprefix (buffer); cpu->put (buffer);
} else { } else {
BX_INFO (("naming convention for apics requires id=0-15 only")); BX_INFO (("naming convention for apics requires id=0-15 only"));
} }

View File

@ -40,7 +40,7 @@ BX_CPU_C::BX_CPU_C()
// in case of SMF, you cannot reference any member data // in case of SMF, you cannot reference any member data
// in the constructor because the only access to it is via // in the constructor because the only access to it is via
// global variables which aren't initialized quite yet. // global variables which aren't initialized quite yet.
setprefix("CPU"); put("CPU");
settype (CPU0LOG); settype (CPU0LOG);
} }

View File

@ -626,7 +626,7 @@ BX_CPU_C::VERR_Ew(BxInstruction_t *i)
return; return;
} }
set_ZF(1); /* accessible */ set_ZF(1); /* accessible */
BX_INFO(("VERR: data segment OK")); BX_ERROR(("VERR: data segment OK"));
return; return;
} }
} }

View File

@ -35,7 +35,7 @@ bx_disassemble_c bx_disassemble;
bx_disassemble_c::bx_disassemble_c(void) bx_disassemble_c::bx_disassemble_c(void)
{ {
setprefix("DIS"); put("DIS");
settype(DISLOG); settype(DISLOG);
sreg_mod01_rm32[0] = "DS"; sreg_mod01_rm32[0] = "DS";

View File

@ -198,7 +198,7 @@ bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv,
UNUSED(argc); UNUSED(argc);
UNUSED(argv); UNUSED(argv);
UNUSED(window_name); UNUSED(window_name);
th->setprefix("BGUI"); th->put("BGUI");
if (bx_options.Oprivate_colormap->get ()) { if (bx_options.Oprivate_colormap->get ()) {
BX_INFO(( "BeOS: private_colormap option not handled yet.")); BX_INFO(( "BeOS: private_colormap option not handled yet."));

View File

@ -43,7 +43,7 @@ bx_gui_c bx_gui;
bx_gui_c::bx_gui_c(void) bx_gui_c::bx_gui_c(void)
{ {
setprefix("GUI"); // Init in specific_init put("GUI"); // Init in specific_init
settype(GUILOG); settype(GUILOG);
} }

View File

@ -324,7 +324,7 @@ void CreateWindows(void)
void bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth, unsigned tileheight, void bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth, unsigned tileheight,
unsigned headerbar_y) unsigned headerbar_y)
{ {
th->setprefix("MGUI"); th->put("MGUI");
InitToolbox(); InitToolbox();
//SouixWin = FrontWindow(); //SouixWin = FrontWindow();

View File

@ -59,7 +59,7 @@
bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth, unsigned tileheight, bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth, unsigned tileheight,
unsigned headerbar_y) unsigned headerbar_y)
{ {
th->setprefix("NGUI"); th->put("NGUI");
UNUSED(th); UNUSED(th);
UNUSED(argc); UNUSED(argc);
UNUSED(argv); UNUSED(argv);

View File

@ -1,6 +1,6 @@
/* /*
* gui/siminterface.cc * gui/siminterface.cc
* $Id: siminterface.cc,v 1.31 2001-06-22 13:37:08 bdenney Exp $ * $Id: siminterface.cc,v 1.32 2001-06-27 19:16:01 fries Exp $
* *
* Defines the actual link between bx_simulator_interface_c methods * Defines the actual link between bx_simulator_interface_c methods
* and the simulator. This file includes bochs.h because it needs * and the simulator. This file includes bochs.h because it needs
@ -100,7 +100,7 @@ bx_real_sim_c::get_param_string (bx_id id) {
void init_siminterface () void init_siminterface ()
{ {
siminterface_log = new logfunctions (); siminterface_log = new logfunctions ();
siminterface_log->setprefix ("CTRL"); siminterface_log->put ("CTRL");
siminterface_log->settype(CTRLLOG); siminterface_log->settype(CTRLLOG);
if (SIM == NULL) if (SIM == NULL)
SIM = new bx_real_sim_c(); SIM = new bx_real_sim_c();

View File

@ -116,7 +116,7 @@ bx_gui_c::sighandler(int signo)
bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth, unsigned tileheight, bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth, unsigned tileheight,
unsigned headerbar_y) unsigned headerbar_y)
{ {
th->setprefix("TGUI"); th->put("TGUI");
UNUSED(th); UNUSED(th);
UNUSED(argc); UNUSED(argc);
UNUSED(argv); UNUSED(argv);

View File

@ -262,7 +262,7 @@ void terminateEmul(int reason) {
void bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned void bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned
tilewidth, unsigned tileheight, tilewidth, unsigned tileheight,
unsigned headerbar_y) { unsigned headerbar_y) {
th->setprefix("WGUI"); th->put("WGUI");
static RGBQUAD black_quad={ 0, 0, 0, 0}; static RGBQUAD black_quad={ 0, 0, 0, 0};
stInfo.kill = 0; stInfo.kill = 0;
stInfo.UIinited = FALSE; stInfo.UIinited = FALSE;

View File

@ -279,7 +279,7 @@ bx_gui_c::specific_init(bx_gui_c *th, int argc, char **argv, unsigned tilewidth,
unsigned long plane_masks_return[1]; unsigned long plane_masks_return[1];
XColor color; XColor color;
th->setprefix("XGUI"); th->put("XGUI");
UNUSED(th); UNUSED(th);
if (bx_options.Oprivate_colormap->get ()) { if (bx_options.Oprivate_colormap->get ()) {

View File

@ -179,7 +179,7 @@ int GetCDCapacity(unsigned int hid, unsigned int tid, unsigned int lun)
cdrom_interface::cdrom_interface(char *dev) cdrom_interface::cdrom_interface(char *dev)
{ {
setprefix("CD"); put("CD");
settype(CDLOG); settype(CDLOG);
fd = -1; // File descriptor not yet allocated fd = -1; // File descriptor not yet allocated

View File

@ -44,7 +44,7 @@ bx_cmos_c bx_cmos;
bx_cmos_c::bx_cmos_c(void) bx_cmos_c::bx_cmos_c(void)
{ {
setprefix("CMOS"); put("CMOS");
settype(CMOSLOG); settype(CMOSLOG);
BX_DEBUG(("Init.")); BX_DEBUG(("Init."));
} }

View File

@ -44,7 +44,7 @@ bx_devices_c bx_devices;
// constructor for bx_devices_c // constructor for bx_devices_c
bx_devices_c::bx_devices_c(void) bx_devices_c::bx_devices_c(void)
{ {
setprefix("DEV"); put("DEV");
settype(DEVLOG); settype(DEVLOG);
unsigned i; unsigned i;
@ -230,11 +230,11 @@ bx_devices_c::port92_read(Bit32u address, unsigned io_len)
UNUSED(this_ptr); UNUSED(this_ptr);
#endif // !BX_USE_DEV_SMF #endif // !BX_USE_DEV_SMF
if (io_len > 1) if (io_len > 1)
BX_PANIC(("devices.c: port 92h: io read from address %08x, len=%u", BX_PANIC(("port 92h: io read from address %08x, len=%u",
(unsigned) address, (unsigned) io_len)); (unsigned) address, (unsigned) io_len));
BX_INFO(("devices: port92h read partially supported!!!")); BX_DEBUG(("port92h read partially supported!!!"));
BX_INFO(("devices: returning %02x", (unsigned) (BX_GET_ENABLE_A20() << 1))); BX_DEBUG((" returning %02x", (unsigned) (BX_GET_ENABLE_A20() << 1)));
return(BX_GET_ENABLE_A20() << 1); return(BX_GET_ENABLE_A20() << 1);
} }
@ -257,12 +257,12 @@ bx_devices_c::port92_write(Bit32u address, Bit32u value, unsigned io_len)
Boolean bx_cpu_reset; Boolean bx_cpu_reset;
if (io_len > 1) if (io_len > 1)
BX_PANIC(("devices.c: port 92h: io read from address %08x, len=%u", BX_PANIC(("port 92h: io read from address %08x, len=%u",
(unsigned) address, (unsigned) io_len)); (unsigned) address, (unsigned) io_len));
BX_INFO(("devices: port92h write of %02x partially supported!!!", BX_DEBUG(("port92h write of %02x partially supported!!!",
(unsigned) value)); (unsigned) value));
BX_INFO(("devices: A20: set_enable_a20() called")); BX_DEBUG(("A20: set_enable_a20() called"));
BX_SET_ENABLE_A20( (value & 0x02) >> 1 ); BX_SET_ENABLE_A20( (value & 0x02) >> 1 );
BX_INFO(("A20: now %u", (unsigned) BX_GET_ENABLE_A20())); BX_INFO(("A20: now %u", (unsigned) BX_GET_ENABLE_A20()));
bx_cpu_reset = (value & 0x01); /* high speed reset */ bx_cpu_reset = (value & 0x01); /* high speed reset */

View File

@ -41,7 +41,7 @@ bx_dma_c bx_dma;
bx_dma_c::bx_dma_c(void) bx_dma_c::bx_dma_c(void)
{ {
setprefix("DMA"); put("DMA");
settype(DMALOG); settype(DMALOG);
BX_DEBUG(("Init.")); BX_DEBUG(("Init."));
} }

View File

@ -54,6 +54,7 @@ extern "C" {
#include <sys/socket.h> #include <sys/socket.h>
#include <net/if.h> #include <net/if.h>
#include <net/bpf.h> #include <net/bpf.h>
#include <errno.h>
}; };
#define BX_BPF_POLL 1000 // Poll for a frame every 1000 usecs #define BX_BPF_POLL 1000 // Poll for a frame every 1000 usecs
@ -146,9 +147,12 @@ bx_fbsd_pktmover_c::bx_fbsd_pktmover_c(const char *netif,
do { do {
(void)sprintf(device, "/dev/bpf%d", n++); (void)sprintf(device, "/dev/bpf%d", n++);
this->bpf_fd = open(device, O_RDWR); this->bpf_fd = open(device, O_RDWR);
} while (this->bpf_fd < 0); BX_INFO(("tried %s, returned %d",device,this->bpf_fd));
if(errno == EACCES)
break;
} while (this->bpf_fd == -1);
if (this->bpf_fd < 0) { if (this->bpf_fd == -1) {
BX_INFO(("eth_freebsd: could not open packet filter")); BX_INFO(("eth_freebsd: could not open packet filter"));
return; return;
} }

View File

@ -67,7 +67,7 @@ bx_floppy_ctrl_c bx_floppy;
bx_floppy_ctrl_c::bx_floppy_ctrl_c(void) bx_floppy_ctrl_c::bx_floppy_ctrl_c(void)
{ {
setprefix("FDD"); put("FDD");
settype(FDLOG); settype(FDLOG);
BX_DEBUG(("Init.")); BX_DEBUG(("Init."));
} }

View File

@ -29,7 +29,7 @@ bx_g2h_c bx_g2h;
bx_g2h_c::bx_g2h_c(void) bx_g2h_c::bx_g2h_c(void)
{ {
setprefix("G2H"); put("G2H");
settype(G2HLOG); settype(G2HLOG);
unsigned i; unsigned i;

View File

@ -64,7 +64,7 @@ static unsigned curr_multiple_sectors = 0; // was 0x3f
bx_hard_drive_c::bx_hard_drive_c(void) bx_hard_drive_c::bx_hard_drive_c(void)
{ {
setprefix("HD"); put("HD");
settype(HDLOG); settype(HDLOG);
#if EXTERNAL_DISK_SIMULATOR #if EXTERNAL_DISK_SIMULATOR
s[0].hard_drive = new EXTERNAL_DISK_SIMULATOR_CLASS(); s[0].hard_drive = new EXTERNAL_DISK_SIMULATOR_CLASS();

View File

@ -28,7 +28,7 @@ bx_io_redirect_entry_t::sprintf_self (char *buf)
bx_ioapic_c::bx_ioapic_c () bx_ioapic_c::bx_ioapic_c ()
: bx_generic_apic_c () : bx_generic_apic_c ()
{ {
setprefix("IOAP"); put("IOAP");
settype(IOAPICLOG); settype(IOAPICLOG);
} }

View File

@ -55,7 +55,7 @@ bx_keyb_c::bx_keyb_c(void)
// constructor // constructor
// should zero out state info here??? // should zero out state info here???
memset( &s, 0, sizeof(s) ); memset( &s, 0, sizeof(s) );
BX_KEY_THIS setprefix("KBD"); BX_KEY_THIS put("KBD");
BX_KEY_THIS settype(KBDLOG); BX_KEY_THIS settype(KBDLOG);
} }

View File

@ -35,7 +35,7 @@ bx_ne2k_c bx_ne2k;
bx_ne2k_c::bx_ne2k_c(void) bx_ne2k_c::bx_ne2k_c(void)
{ {
setprefix("NE2K"); put("NE2K");
settype(NE2KLOG); settype(NE2KLOG);
// nothing for now // nothing for now
} }

View File

@ -37,7 +37,7 @@ bx_parallel_c bx_parallel;
bx_parallel_c::bx_parallel_c(void) bx_parallel_c::bx_parallel_c(void)
{ {
setprefix("PAR"); put("PAR");
settype(PARLOG); settype(PARLOG);
// nothing for now // nothing for now
} }

View File

@ -41,7 +41,7 @@ bx_pci_c bx_pci;
bx_pci_c::bx_pci_c(void) bx_pci_c::bx_pci_c(void)
{ {
setprefix("PCI"); put("PCI");
settype(PCILOG); settype(PCILOG);
} }

View File

@ -36,7 +36,7 @@ bx_pic_c bx_pic;
bx_pic_c::bx_pic_c(void) bx_pic_c::bx_pic_c(void)
{ {
setprefix("PIC"); put("PIC");
settype(PICLOG); settype(PICLOG);
} }

View File

@ -135,7 +135,7 @@ bx_pit_c bx_pit;
bx_pit_c::bx_pit_c( void ) bx_pit_c::bx_pit_c( void )
{ {
setprefix("PIT"); put("PIT");
settype(PITLOG); settype(PITLOG);
memset(&s, 0, sizeof(s)); memset(&s, 0, sizeof(s));

View File

@ -38,7 +38,7 @@ bx_pit2_c bx_pit2;
bx_pit2_c::bx_pit2_c( void ) bx_pit2_c::bx_pit2_c( void )
{ {
setprefix("PIT"); put("PIT");
settype(PITLOG); settype(PITLOG);
s.speaker_data_on=0; s.speaker_data_on=0;

View File

@ -48,7 +48,7 @@ bx_sb16_c bx_sb16;
bx_sb16_c::bx_sb16_c(void) bx_sb16_c::bx_sb16_c(void)
{ {
setprefix("SB16"); put("SB16");
settype(SB16LOG); settype(SB16LOG);
} }

View File

@ -70,10 +70,11 @@ static int tty_id;
bx_serial_c::bx_serial_c(void) bx_serial_c::bx_serial_c(void)
{ {
setprefix("SER"); put("SER");
settype(SERLOG); settype(SERLOG);
#ifdef SERIAL_ENABLE #ifdef SERIAL_ENABLE
tty_id = open("/tmp/fifo",O_RDWR|O_NONBLOCK,600); tty_id = open("/dev/ttyqf",O_RDWR|O_NONBLOCK,600);
BX_DEBUG(("tty_id: %d",tty_id));
tcgetattr(tty_id, &term_orig); tcgetattr(tty_id, &term_orig);
bcopy((caddr_t) &term_orig, (caddr_t) &term_new, sizeof(struct termios)); bcopy((caddr_t) &term_orig, (caddr_t) &term_new, sizeof(struct termios));
cfmakeraw(&term_new); cfmakeraw(&term_new);

View File

@ -26,7 +26,7 @@
serial_raw::serial_raw (char *ttypath, int signal) serial_raw::serial_raw (char *ttypath, int signal)
{ {
setprefix ("SERR"); put ("SERR");
settype (SERRLOG); settype (SERRLOG);
} }

View File

@ -34,7 +34,7 @@ bx_unmapped_c bx_unmapped;
bx_unmapped_c::bx_unmapped_c(void) bx_unmapped_c::bx_unmapped_c(void)
{ {
setprefix("UNMP"); put("UNMP");
settype(UNMAPLOG); settype(UNMAPLOG);
s.port80 = 0x00; s.port80 = 0x00;
s.port8e = 0x00; s.port8e = 0x00;

View File

@ -42,7 +42,7 @@ bx_vga_c::bx_vga_c(void)
BX_VGA_THIS s.vga_mem_updated = 0; BX_VGA_THIS s.vga_mem_updated = 0;
BX_VGA_THIS s.x_tilesize = X_TILESIZE; BX_VGA_THIS s.x_tilesize = X_TILESIZE;
BX_VGA_THIS s.y_tilesize = Y_TILESIZE; BX_VGA_THIS s.y_tilesize = Y_TILESIZE;
BX_VGA_THIS setprefix("VGA"); BX_VGA_THIS put("VGA");
} }

View File

@ -50,7 +50,7 @@ iofunctions::init(void) {
n_logfn = 0; n_logfn = 0;
init_log(stderr); init_log(stderr);
log = new logfunc_t(this); log = new logfunc_t(this);
LOG_THIS setprefix("IO"); LOG_THIS put("IO");
LOG_THIS settype(IOLOG); LOG_THIS settype(IOLOG);
BX_DEBUG(("Init(log file: '%s').",logfn)); BX_DEBUG(("Init(log file: '%s').",logfn));
} }
@ -183,7 +183,7 @@ iofunctions::~iofunctions(void)
logfunctions::logfunctions(void) logfunctions::logfunctions(void)
{ {
setprefix(" "); put(" ");
settype(GENLOG); settype(GENLOG);
if(io == NULL && Allocio == 0) { if(io == NULL && Allocio == 0) {
Allocio = 1; Allocio = 1;
@ -198,7 +198,7 @@ logfunctions::logfunctions(void)
logfunctions::logfunctions(iofunc_t *iofunc) logfunctions::logfunctions(iofunc_t *iofunc)
{ {
setprefix(" "); put(" ");
settype(GENLOG); settype(GENLOG);
setio(iofunc); setio(iofunc);
// BUG: unfortunately this can be called before the bochsrc is read, // BUG: unfortunately this can be called before the bochsrc is read,
@ -221,7 +221,7 @@ logfunctions::setio(iofunc_t *i)
} }
void void
logfunctions::setprefix(char *p) logfunctions::put(char *p)
{ {
char *tmpbuf; char *tmpbuf;
tmpbuf=strdup("[ ]");// if we ever have more than 32 chars, tmpbuf=strdup("[ ]");// if we ever have more than 32 chars,

View File

@ -46,7 +46,7 @@ BX_MEM_C::BX_MEM_C(void)
{ {
char mem[6]; char mem[6];
snprintf(mem, 6, "MEM%d", BX_SIM_ID); snprintf(mem, 6, "MEM%d", BX_SIM_ID);
setprefix(mem); put(mem);
settype(MEMLOG); settype(MEMLOG);
vector = NULL; vector = NULL;

View File

@ -45,7 +45,7 @@ const Bit64u bx_pc_system_c::COUNTER_INTERVAL = 100000;
// constructor // constructor
bx_pc_system_c::bx_pc_system_c(void) bx_pc_system_c::bx_pc_system_c(void)
{ {
this->setprefix("SYS"); this->put("SYS");
num_timers = 0; num_timers = 0;
// set ticks period and remaining to max Bit32u value // set ticks period and remaining to max Bit32u value

View File

@ -101,7 +101,7 @@ void
state_file::init(void) state_file::init(void)
{ {
log = new class logfunctions(); log = new class logfunctions();
log->setprefix("STAT"); log->put("STAT");
log->settype(GENLOG); log->settype(GENLOG);
} }