SVN r4009

Handle errant IRQs as a real BIOS does. Also remove r3263 workaround, as
it's no longer needed.
This commit is contained in:
Allofich 2019-09-03 00:19:12 +09:00 committed by Allofich
parent 10d7f4bd1c
commit 4f7f88f907
5 changed files with 45 additions and 18 deletions

View File

@ -57,6 +57,10 @@
- LABEL reimplemented to imitate MS-DOS behavior
with regard to how it handles the command line.
- File I/O checking and cleanup (Allofich)
- Integrated commits from mainline (Allofich)
- Handle errant IRQs as a real BIOS does. Also
remove r3263 workaround, as it's no longer
needed.
0.82.21
- Reduced title bar size of the Configuration GUI.
- Fixed sizing and positions of some Help menu dialog

View File

@ -85,6 +85,7 @@
#define BIOS_VDU_CONTROL 0x465
#define BIOS_VDU_COLOR_REGISTER 0x466
/* 0x467-0x468 is reserved */
#define BIOS_LAST_UNEXPECTED_IRQ 0x46b
#define BIOS_TIMER 0x46c
#define BIOS_24_HOURS_FLAG 0x470
#define BIOS_CTRL_BREAK_FLAG 0x471

View File

@ -1,13 +1,5 @@
Commit#: Reason for skipping:
4002 Conflict
4003 Conflict
4007 Conflict
4008 Conflict
4009 Conflict
4013 Conflict
4019 Conflict
4023 Conflict
4028 Conflict
4038 Conflict
4049 Conflict

View File

@ -45,7 +45,7 @@ unsigned int last_callback = 0;
CallBack_Handler CallBack_Handlers[CB_MAX] = {NULL};
char* CallBack_Description[CB_MAX] = {NULL};
Bitu call_stop,call_default,call_default2;
Bitu call_stop,call_default;
Bit8u call_idle;
Bitu call_priv_io;
@ -887,8 +887,6 @@ void CALLBACK_Init() {
/* Default handlers for unhandled interrupts that have to be non-null */
call_default=CALLBACK_Allocate();
CALLBACK_Setup(call_default,&default_handler,CB_IRET,"default");
call_default2=CALLBACK_Allocate();
CALLBACK_Setup(call_default2,&default_handler,CB_IRET,"default");
/* Setup block of 0xCD 0xxx instructions */
PhysPt rint_base=CALLBACK_GetBase()+CB_MAX*CB_SIZE;

View File

@ -6494,7 +6494,32 @@ void BIOS_SetupKeyboard(void);
void BIOS_UnsetupDisks(void);
void BIOS_SetupDisks(void);
void CPU_Snap_Back_To_Real_Mode();
void CPU_Snap_Back_Restore();
void CPU_Snap_Back_Restore();
static Bitu Default_IRQ_Handler(void) {
IO_WriteB(0x20, 0x0b);
Bit8u master_isr = IO_ReadB(0x20);
if (master_isr) {
IO_WriteB(0xa0, 0x0b);
Bit8u slave_isr = IO_ReadB(0xa0);
if (slave_isr) {
IO_WriteB(0xa1, IO_ReadB(0xa1) | slave_isr);
IO_WriteB(0xa0, 0x20);
}
else IO_WriteB(0x21, IO_ReadB(0x21) | (master_isr & ~4));
IO_WriteB(0x20, 0x20);
#if C_DEBUG
Bit16u irq = 0;
Bit16u isr = master_isr;
if (slave_isr) isr = slave_isr << 8;
while (isr >>= 1) irq++;
LOG(LOG_BIOS, LOG_WARN)("Unexpected IRQ %u", irq);
#endif
}
else master_isr = 0xff;
mem_writeb(BIOS_LAST_UNEXPECTED_IRQ, master_isr);
return CBRET_NONE;
}
static Bitu IRQ14_Dummy(void) {
/* FIXME: That's it? Don't I EOI the PIC? */
@ -7532,10 +7557,6 @@ private:
}
}
// setup a few interrupt handlers that point to bios IRETs by default
if (!IS_PC98_ARCH)
real_writed(0,0x0e*4,CALLBACK_RealPointer(call_default2)); //design your own railroad
if (IS_PC98_ARCH) {
real_writew(0,0x58A,0x0000U); // countdown timer value
PIC_SetIRQMask(0,true); /* PC-98 keeps the timer off unless INT 1Ch is called to set a timer interval */
@ -7547,8 +7568,19 @@ private:
Section_prop * section=static_cast<Section_prop *>(control->GetSection("dos"));
null_68h = section->Get_bool("zero unused int 68h");
}
}
/* Default IRQ handler */
Bitu call_irq_default = CALLBACK_Allocate();
CALLBACK_Setup(call_irq_default, &Default_IRQ_Handler, CB_IRET, "irq default");
RealSetVec(0x0b, CALLBACK_RealPointer(call_irq_default)); // IRQ 3
RealSetVec(0x0c, CALLBACK_RealPointer(call_irq_default)); // IRQ 4
RealSetVec(0x0d, CALLBACK_RealPointer(call_irq_default)); // IRQ 5
RealSetVec(0x0f, CALLBACK_RealPointer(call_irq_default)); // IRQ 7
RealSetVec(0x72, CALLBACK_RealPointer(call_irq_default)); // IRQ 10
RealSetVec(0x73, CALLBACK_RealPointer(call_irq_default)); // IRQ 11
// setup a few interrupt handlers that point to bios IRETs by default
real_writed(0,0x66*4,CALLBACK_RealPointer(call_default)); //war2d
real_writed(0,0x67*4,CALLBACK_RealPointer(call_default));
if (machine==MCH_CGA || null_68h) real_writed(0,0x68*4,0); //Popcorn