mirror of
https://github.com/joncampbell123/dosbox-x.git
synced 2025-10-14 19:08:32 +08:00
Change INT 21h and file I/O logging so that it is default off, but can be enabled from dosbox.conf
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
0.83.1
|
||||
- Added INT 21h debug logging for file I/O and general
|
||||
INT 21h usage [patch by ognjenmi]
|
||||
INT 21h usage [patch by ognjenmi]. Added enables for
|
||||
the logging which are off by default since the INT 21h
|
||||
and file I/O logging are fairly noisy under normal
|
||||
usage.
|
||||
|
||||
0.83.0
|
||||
- Added mt32.romdir dosbox.conf configuration option
|
||||
|
@@ -42,6 +42,9 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool log_int21 = false;
|
||||
bool log_fileio = false;
|
||||
|
||||
static bool has_LOG_Init = false;
|
||||
static bool has_LOG_EarlyInit = false;
|
||||
static bool do_LOG_stderr = false;
|
||||
@@ -826,6 +829,9 @@ void LOG::Init() {
|
||||
debuglog=0;
|
||||
}
|
||||
|
||||
log_int21 = sect->Get_bool("int21");
|
||||
log_fileio = sect->Get_bool("fileio");
|
||||
|
||||
/* end of early init logging */
|
||||
do_LOG_stderr = false;
|
||||
|
||||
@@ -924,5 +930,13 @@ void LOG::SetupConfigSection(void) {
|
||||
Pstring->Set_values(log_values);
|
||||
Pstring->Set_help("Enable/Disable logging of this type.");
|
||||
}
|
||||
|
||||
Prop_bool* Pbool;
|
||||
|
||||
Pbool = sect->Add_bool("int21",Property::Changeable::Always,false);
|
||||
Pbool->Set_help("Log all INT 21h calls");
|
||||
|
||||
Pbool = sect->Add_bool("fileio",Property::Changeable::Always,false);
|
||||
Pbool->Set_help("Log file I/O through INT 21h");
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,9 @@
|
||||
#include "serialport.h"
|
||||
#include "dos_network.h"
|
||||
|
||||
extern bool log_int21;
|
||||
extern bool log_fileio;
|
||||
|
||||
Bitu INT29_HANDLER(void);
|
||||
Bit32u BIOS_get_PC98_INT_STUB(void);
|
||||
|
||||
@@ -415,6 +418,14 @@ void XMS_DOS_LocalA20EnableIfNotEnabled(void);
|
||||
static Bitu DOS_21Handler(void) {
|
||||
bool unmask_irq0 = false;
|
||||
|
||||
/* NTS to ognjenmi: Your INT 21h logging patch was modified to log ALL INT 21h calls (the original
|
||||
* placement put it after the ignore case below), and is now conditional on
|
||||
* whether INT 21h logging is enabled. Also removed unnecessary copying of reg_al
|
||||
* and reg_ah to auto type variables. */
|
||||
if (log_int21) {
|
||||
LOG(LOG_CPU, LOG_DEBUG)("Executing interrupt 21, ah=%x, al=%x", reg_ah, reg_al);
|
||||
}
|
||||
|
||||
/* Real MS-DOS behavior:
|
||||
* If HIMEM.SYS is loaded and CONFIG.SYS says DOS=HIGH, DOS will load itself into the HMA area.
|
||||
* To prevent crashes, the INT 21h handler down below will enable the A20 gate before executing
|
||||
@@ -433,9 +444,6 @@ static Bitu DOS_21Handler(void) {
|
||||
char name2[DOSNAMEBUF+2+DOS_NAMELENGTH_ASCII];
|
||||
|
||||
static Bitu time_start = 0; //For emulating temporary time changes.
|
||||
auto ah = reg_ah;
|
||||
auto al = reg_al;
|
||||
LOG(LOG_CPU, LOG_DEBUG)("Executing interrupt 21, ah=%x, al=%x", ah, al);
|
||||
switch (reg_ah) {
|
||||
case 0x00: /* Terminate Program */
|
||||
/* HACK for demoscene prod parties/1995/wired95/surprisecode/w95spcod.zip/WINNERS/SURP-KLF
|
||||
|
@@ -40,6 +40,9 @@
|
||||
#define FCB_ERR_EOF 3
|
||||
#define FCB_ERR_WRITE 1
|
||||
|
||||
extern bool log_int21;
|
||||
extern bool log_fileio;
|
||||
|
||||
Bitu DOS_FILES = 127;
|
||||
DOS_File ** Files = NULL;
|
||||
DOS_Drive * Drives[DOS_DRIVES] = {NULL};
|
||||
@@ -369,7 +372,9 @@ bool DOS_ReadFile(Bit16u entry,Bit8u * data,Bit16u * amount,bool fcb) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (log_fileio) {
|
||||
LOG(LOG_FILES, LOG_DEBUG)("Reading %d bytes from %s ", *amount, Files[handle]->name);
|
||||
}
|
||||
/*
|
||||
if ((Files[handle]->flags & 0x0f) == OPEN_WRITE)) {
|
||||
DOS_SetError(DOSERR_INVALID_HANDLE);
|
||||
@@ -397,7 +402,9 @@ bool DOS_WriteFile(Bit16u entry,Bit8u * data,Bit16u * amount,bool fcb) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (log_fileio) {
|
||||
LOG(LOG_FILES, LOG_DEBUG)("Writing %d bytes to %s", *amount, Files[handle]->name);
|
||||
}
|
||||
/*
|
||||
if ((Files[handle]->flags & 0x0f) == OPEN_READ)) {
|
||||
DOS_SetError(DOSERR_INVALID_HANDLE);
|
||||
@@ -459,7 +466,9 @@ bool DOS_CloseFile(Bit16u entry, bool fcb) {
|
||||
return false;
|
||||
}
|
||||
if (Files[handle]->IsOpen()) {
|
||||
if (log_fileio) {
|
||||
LOG(LOG_FILES, LOG_NORMAL)("Closing file %s", Files[handle]->name);
|
||||
}
|
||||
Files[handle]->Close();
|
||||
}
|
||||
|
||||
@@ -673,7 +682,9 @@ bool DOS_OpenFileExtended(char const * name, Bit16u flags, Bit16u createAttr, Bi
|
||||
bool DOS_UnlinkFile(char const * const name) {
|
||||
char fullname[DOS_PATHLENGTH];Bit8u drive;
|
||||
// An existing device returns an access denied error
|
||||
if (log_fileio) {
|
||||
LOG(LOG_FILES, LOG_NORMAL)("Deleting file %s", name);
|
||||
}
|
||||
if (DOS_FindDevice(name) != DOS_DEVICES) {
|
||||
DOS_SetError(DOSERR_ACCESS_DENIED);
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user