@@ -52,6 +52,8 @@ static uint32_t MAIN_DMA_MappedAddr = 0;
52
52
static uint8_t MAIN_QEMM_Present = 0 ;
53
53
static uint8_t MAIN_HDPMI_Present = 0 ;
54
54
static uint8_t MAIN_InINT ;
55
+ #define MAIN_ININT_PM 0x01
56
+ #define MAIN_ININT_RM 0x02
55
57
56
58
SBEMU_EXTFUNS MAIN_SbemuExtFun ;
57
59
@@ -917,30 +919,34 @@ int main(int argc, char* argv[])
917
919
918
920
static void MAIN_InterruptPM ()
919
921
{
920
- if (MAIN_InINT ) return ;
922
+ if (MAIN_InINT & MAIN_ININT_PM ) return ;
923
+ //DBG_Log("INTPM %d\n", MAIN_InINT);
924
+
921
925
HDPMIPT_GetInterrupContext (& MAIN_IntContext );
922
- if (aui .card_handler -> irq_routine && aui .card_handler -> irq_routine (& aui )) //check if the irq belong the sound card
926
+ if (! MAIN_InINT && aui .card_handler -> irq_routine && aui .card_handler -> irq_routine (& aui )) //check if the irq belong the sound card
923
927
{
924
928
MAIN_Interrupt ();
925
929
PIC_SendEOIWithIRQ (aui .card_irq );
926
930
}
927
931
else
928
932
{
929
- BOOL InInt = MAIN_InINT ;
930
- MAIN_InINT = TRUE;
931
- if (MAIN_IntContext .EFLAGS & CPU_VMFLAG )
933
+ MAIN_InINT |= MAIN_ININT_PM ;
934
+ if ((MAIN_InINT & MAIN_ININT_RM ) || (MAIN_IntContext .EFLAGS & CPU_VMFLAG ))
932
935
DPMI_CallOldISR (& MAIN_IntHandlePM );
933
936
else
934
937
DPMI_CallOldISRWithContext (& MAIN_IntHandlePM , & MAIN_IntContext .regs );
935
938
PIC_UnmaskIRQ (aui .card_irq );
936
- MAIN_InINT = InInt ;
939
+ MAIN_InINT &= ~MAIN_ININT_PM ;
940
+ //DBG_Log("INTPME %d\n", MAIN_InINT);
937
941
}
938
942
}
939
943
940
944
static void MAIN_InterruptRM ()
941
945
{
942
- if (MAIN_InINT ) return ;
943
- if (aui .card_handler -> irq_routine && aui .card_handler -> irq_routine (& aui )) //check if the irq belong the sound card
946
+ if (MAIN_InINT & MAIN_ININT_RM ) return ;
947
+ //DBG_Log("INTRM %d\n", MAIN_InINT);
948
+
949
+ if (!MAIN_InINT && aui .card_handler -> irq_routine && aui .card_handler -> irq_routine (& aui )) //check if the irq belong the sound card
944
950
{
945
951
MAIN_IntContext .regs = MAIN_RMIntREG ;
946
952
MAIN_IntContext .EFLAGS = MAIN_RMIntREG .w .flags | CPU_VMFLAG ;
@@ -949,12 +955,12 @@ static void MAIN_InterruptRM()
949
955
}
950
956
else
951
957
{
952
- BOOL InInt = MAIN_InINT ;
953
- MAIN_InINT = TRUE;
958
+ MAIN_InINT |= MAIN_ININT_RM ;
954
959
DPMI_REG r = MAIN_RMIntREG ; //don't modify MAIN_RMIntREG on hardware interrupt
955
960
DPMI_CallRealModeOldISR (& MAIN_IntHandleRM , & r );
956
961
PIC_UnmaskIRQ (aui .card_irq );
957
- MAIN_InINT = InInt ;
962
+ MAIN_InINT &= ~MAIN_ININT_RM ;
963
+ //DBG_Log("INTRME %d\n", MAIN_InINT);
958
964
}
959
965
}
960
966
0 commit comments