Added macro BX_FATAL() that works like BX_PANIC(), but with hardcoded action
"fatal". It can be used for all cases when there is no workaroud present to avoid application crash or incorrect simulation behaviour. As a first step now using BX_FATAL() for some data structure size and bit field errors.
This commit is contained in:
parent
90597c2e61
commit
400704d038
@ -276,6 +276,7 @@ public:
|
||||
void error(const char *fmt, ...) BX_CPP_AttrPrintf(2, 3);
|
||||
void panic(const char *fmt, ...) BX_CPP_AttrPrintf(2, 3);
|
||||
void ldebug(const char *fmt, ...) BX_CPP_AttrPrintf(2, 3);
|
||||
void fatal1(const char *fmt, ...) BX_CPP_AttrPrintf(2, 3);
|
||||
void fatal(int level, const char *prefix, const char *fmt, va_list ap, int exit_status);
|
||||
void warn(int level, const char *prefix, const char *fmt, va_list ap);
|
||||
void ask(int level, const char *prefix, const char *fmt, va_list ap);
|
||||
@ -357,6 +358,7 @@ typedef class iofunctions iofunc_t;
|
||||
#define BX_DEBUG(x)
|
||||
#define BX_ERROR(x)
|
||||
#define BX_PANIC(x) (LOG_THIS panic) x
|
||||
#define BX_FATAL(x) (LOG_THIS fatal1) x
|
||||
|
||||
#define BX_ASSERT(x)
|
||||
|
||||
@ -366,6 +368,7 @@ typedef class iofunctions iofunc_t;
|
||||
#define BX_DEBUG(x) (LOG_THIS ldebug) x
|
||||
#define BX_ERROR(x) (LOG_THIS error) x
|
||||
#define BX_PANIC(x) (LOG_THIS panic) x
|
||||
#define BX_FATAL(x) (LOG_THIS fatal1) x
|
||||
|
||||
#if BX_ASSERT_ENABLE
|
||||
#define BX_ASSERT(x) do {if (!(x)) BX_PANIC(("failed assertion \"%s\" at %s:%d\n", #x, __FILE__, __LINE__));} while (0)
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001-2015 The Bochs Project
|
||||
// Copyright (C) 2001-2016 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -376,22 +376,22 @@ void bx_hard_drive_c::init(void)
|
||||
BX_CONTROLLER(channel,device).sector_count = 0;
|
||||
BX_CONTROLLER(channel,device).interrupt_reason.c_d = 1;
|
||||
if (BX_CONTROLLER(channel,device).sector_count != 0x01)
|
||||
BX_PANIC(("interrupt reason bit field error"));
|
||||
BX_FATAL(("interrupt reason bit field error"));
|
||||
|
||||
BX_CONTROLLER(channel,device).sector_count = 0;
|
||||
BX_CONTROLLER(channel,device).interrupt_reason.i_o = 1;
|
||||
if (BX_CONTROLLER(channel,device).sector_count != 0x02)
|
||||
BX_PANIC(("interrupt reason bit field error"));
|
||||
BX_FATAL(("interrupt reason bit field error"));
|
||||
|
||||
BX_CONTROLLER(channel,device).sector_count = 0;
|
||||
BX_CONTROLLER(channel,device).interrupt_reason.rel = 1;
|
||||
if (BX_CONTROLLER(channel,device).sector_count != 0x04)
|
||||
BX_PANIC(("interrupt reason bit field error"));
|
||||
BX_FATAL(("interrupt reason bit field error"));
|
||||
|
||||
BX_CONTROLLER(channel,device).sector_count = 0;
|
||||
BX_CONTROLLER(channel,device).interrupt_reason.tag = 3;
|
||||
if (BX_CONTROLLER(channel,device).sector_count != 0x18)
|
||||
BX_PANIC(("interrupt reason bit field error"));
|
||||
BX_FATAL(("interrupt reason bit field error"));
|
||||
BX_CONTROLLER(channel,device).sector_count = 0;
|
||||
|
||||
// allocate low level driver
|
||||
|
@ -9,8 +9,8 @@
|
||||
* Author: Benjamin D Lunt
|
||||
* Contact: fys [at] fysnet [dot] net
|
||||
*
|
||||
* Copyright (C) 2015 Benjamin D Lunt.
|
||||
* Copyright (C) 2006-2015 The Bochs Project
|
||||
* Copyright (C) 2015 Benjamin D Lunt.
|
||||
* Copyright (C) 2006-2016 The Bochs Project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -66,7 +66,7 @@ vbox_image_t::vbox_image_t()
|
||||
header_dirty(0)
|
||||
{
|
||||
if (sizeof(_VBOX_VDI_Header) != 512) {
|
||||
BX_PANIC(("system error: invalid header structure size"));
|
||||
BX_FATAL(("system error: invalid header structure size"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
* Contact: snrrrub@gmail.com
|
||||
*
|
||||
* Copyright (C) 2006 Sharvil Nanavati.
|
||||
* Copyright (C) 2006-2015 The Bochs Project
|
||||
* Copyright (C) 2006-2016 The Bochs Project
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@ -56,7 +56,7 @@ vmware4_image_t::vmware4_image_t()
|
||||
is_dirty(0)
|
||||
{
|
||||
if (sizeof(_VM4_Header) != 77) {
|
||||
BX_PANIC(("system error: invalid header structure size"));
|
||||
BX_FATAL(("system error: invalid header structure size"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
// ported from QEMU block driver with some additions (see below)
|
||||
//
|
||||
// Copyright (c) 2004,2005 Johannes E. Schindelin
|
||||
// Copyright (C) 2010-2015 The Bochs Project
|
||||
// Copyright (C) 2010-2016 The Bochs Project
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to deal
|
||||
@ -342,7 +342,7 @@ infosector_t;
|
||||
vvfat_image_t::vvfat_image_t(Bit64u size, const char* _redolog_name)
|
||||
{
|
||||
if (sizeof(bootsector_t) != 512) {
|
||||
BX_PANIC(("system error: invalid bootsector structure size"));
|
||||
BX_FATAL(("system error: invalid bootsector structure size"));
|
||||
}
|
||||
|
||||
first_sectors = new Bit8u[0xc000];
|
||||
|
@ -2,7 +2,7 @@
|
||||
// $Id$
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2014 The Bochs Project
|
||||
// Copyright (C) 2014-2016 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -296,7 +296,7 @@ bx_slirp_pktmover_c::bx_slirp_pktmover_c(const char *netif,
|
||||
|
||||
this->netdev = dev;
|
||||
if (sizeof(struct arphdr) != 28) {
|
||||
BX_PANIC(("system error: invalid ARP header structure size"));
|
||||
BX_FATAL(("system error: invalid ARP header structure size"));
|
||||
}
|
||||
BX_INFO(("slirp network driver"));
|
||||
|
||||
|
@ -628,6 +628,20 @@ static void carbonFatalDialog(const char *error, const char *exposition)
|
||||
}
|
||||
#endif
|
||||
|
||||
void logfunctions::fatal1(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
assert(logio != NULL);
|
||||
|
||||
va_start(ap, fmt);
|
||||
logio->out(LOGLEV_PANIC, prefix, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
va_start(ap, fmt);
|
||||
fatal(LOGLEV_PANIC, prefix, fmt, ap, 1);
|
||||
}
|
||||
|
||||
void logfunctions::fatal(int level, const char *prefix, const char *fmt, va_list ap, int exit_status)
|
||||
{
|
||||
char tmpbuf[1024];
|
||||
|
@ -3,7 +3,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2013 Volker Ruppert
|
||||
// Copyright (C) 2001-2013 The Bochs Project
|
||||
// Copyright (C) 2001-2016 The Bochs Project
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
@ -71,6 +71,7 @@ extern const char *hdimage_mode_names[];
|
||||
#define BX_INFO(x) { if (bx_interactive) { (printf) x ; printf("\n"); } }
|
||||
#define BX_ERROR(x) { (printf) x ; printf("\n"); }
|
||||
#define BX_PANIC(x) { (printf) x ; printf("\n"); myexit(1); }
|
||||
#define BX_FATAL(x) { (printf) x ; printf("\n"); myexit(1); }
|
||||
#define BX_ASSERT(x)
|
||||
|
||||
extern int bx_interactive;
|
||||
|
Loading…
Reference in New Issue
Block a user