Previous 15994 Revisions Next

r12017 Tuesday 21st June, 2011 at 16:42:35 UTC by Miodrag Milanović
i286 - fix for OS/2 "interrupts disabled when entering system" problem by Carl (no whatsnew)
[src/emu/cpu/i86]i286.c i86priv.h instr286.c

src/emu/cpu/i86/instr286.c
r12016r12017
718718
719719static void i80286_load_flags(i8086_state *cpustate, UINT16 flags, int cpl)
720720{
721   cpustate->flags = CompressFlags();
721722   if(PM && cpl) {
722723      UINT16 mask = 0x3000;
723724      if(cpl>IOPL) mask |= 0x200;
r12016r12017
727728   else if(!PM) (flags &= ~0xf000);
728729   ExpandFlags(flags);
729730   cpustate->flags = flags;
730   cpustate->flags = CompressFlags();
731731
732732   if (cpustate->TF) PREFIX(_trap)(cpustate);
733733   /* if the IF is set, and an interrupt is pending, signal an interrupt */
r12016r12017
778778      else if (DPL(r)!=RPL(sel)) throw TRAP(GENERAL_PROTECTION_FAULT,IDXTBL(sel));
779779
780780      if (!PRES(r)) throw TRAP(SEG_NOT_PRESENT,IDXTBL(sel));
781      if (off > LIMIT(desc)) throw TRAP(GENERAL_PROTECTION_FAULT, IDXTBL(sel));
781      if (off > LIMIT(desc)) throw TRAP(GENERAL_PROTECTION_FAULT,0);
782782      if (CPL<RPL(sel)) {
783783         i80286_check_permission(cpustate, SS, cpustate->regs.w[SP]+(iret?6:4)+bytes, 4, I80286_READ);
784784         newsp = ReadWord(spaddr+((iret?6:4)+bytes));
r12016r12017
792792      cpustate->limit[CS]=LIMIT(desc);
793793      cpustate->base[CS]=BASE(desc);
794794      cpustate->rights[CS]=RIGHTS(desc);
795      cpustate->pc=(cpustate->base[CS]+off)&AMASK ;
795      cpustate->pc=(cpustate->base[CS]+off)&AMASK;
796796
797797      // docs say check rpl but windows doesn't like it
798      if (i80286_verify(cpustate, cpustate->sregs[DS], I80286_READ, cpustate->rights[DS]) || (DPL(cpustate->rights[DS]) < CPL))
798      r = cpustate->rights[DS];
799      if (i80286_verify(cpustate, cpustate->sregs[DS], I80286_READ, r) || (CODE(r) && CONF(r) ? 0 : (DPL(r) < CPL)))
799800         i80286_data_descriptor(cpustate, DS, 0);
800
801      if (i80286_verify(cpustate, cpustate->sregs[ES], I80286_READ, cpustate->rights[ES]) || (DPL(cpustate->rights[ES]) < CPL))
801      r = cpustate->rights[ES];
802      if (i80286_verify(cpustate, cpustate->sregs[ES], I80286_READ, r) || (CODE(r) && CONF(r) ? 0 : (DPL(r) < CPL)))
802803         i80286_data_descriptor(cpustate, ES, 0);
803804   } else {
804805      cpustate->regs.w[SP] += (iret?6:4) + bytes;
805806      cpustate->sregs[CS]=sel;
806807      cpustate->base[CS]=sel<<4;
807      cpustate->rights[CS]=0x93;
808      cpustate->rights[CS]=0x9a;
808809      cpustate->limit[CS]=0xffff;
809810      cpustate->pc=(cpustate->base[CS]+off)&AMASK;
810811   }
src/emu/cpu/i86/i86priv.h
r12016r12017
8484#define CF               (int)(cpustate->CarryVal != 0)
8585#define SF               (int)(cpustate->SignVal < 0)
8686#define ZF               (int)(cpustate->ZeroVal == 0)
87#define PF               parity_table[cpustate->ParityVal]
87#define PF               parity_table[cpustate->ParityVal&0xff]
8888#define AF               (int)(cpustate->AuxVal != 0)
8989#define OF               (int)(cpustate->OverVal != 0)
9090#define DF               (int)(cpustate->DirVal < 0)
src/emu/cpu/i86/i286.c
r12016r12017
160160   cpustate->limit[CS]=cpustate->limit[SS]=cpustate->limit[DS]=cpustate->limit[ES]=0xffff;
161161   cpustate->sregs[DS]=cpustate->sregs[SS]=cpustate->sregs[ES]=0;
162162   cpustate->base[DS]=cpustate->base[SS]=cpustate->base[ES]=0;
163   cpustate->rights[CS]=cpustate->rights[DS]=cpustate->rights[SS]=cpustate->rights[ES]=0x93;
163   cpustate->rights[DS]=cpustate->rights[SS]=cpustate->rights[ES]=0x93;
164   cpustate->rights[CS]=0x9a;
164165   cpustate->msw=0xfff0;
165166   cpustate->flags=2;
166167   ExpandFlags(cpustate->flags);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team