From: K.Ohta Date: Wed, 29 Jan 2020 16:08:28 +0000 (+0900) Subject: [VM][I386] Prepare support with A20_MASK. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e1c164ca0031105c2b0f3801b7319611fff0b3b8;p=csp-qt%2Fcommon_source_project-fm7.git [VM][I386] Prepare support with A20_MASK. --- diff --git a/source/src/vm/mame/emu/cpu/i386/i386.c b/source/src/vm/mame/emu/cpu/i386/i386.c index f81c23f76..1b50605da 100644 --- a/source/src/vm/mame/emu/cpu/i386/i386.c +++ b/source/src/vm/mame/emu/cpu/i386/i386.c @@ -538,32 +538,7 @@ static UINT32 i386_get_stack_ptr(i386_state* cpustate, UINT8 privilege) i386_load_segment_descriptor(cpustate,reg); } } -#if 0 -static int i386_limit_check(i386_state *cpustate, int seg, UINT32 offset, UINT32 size) -{ - if(PROTECTED_MODE && !V8086_MODE) - { - if((cpustate->sreg[seg].flags & 0x0018) == 0x0010 && cpustate->sreg[seg].flags & 0x0004) // if expand-down data segment - { - // compare if greater then 0xffffffff when we're passed the access size - if(((offset + size - 1) <= cpustate->sreg[seg].limit) || ((cpustate->sreg[seg].d)?0:((offset + size - 1) > 0xffff))) - { - logerror("Limit check at 0x%08x failed. Segment %04x, limit %08x, offset %08x (expand-down)\n",cpustate->pc,cpustate->sreg[seg].selector,cpustate->sreg[seg].limit,offset); - return 1; - } - } - else - { - if((offset + size - 1) > cpustate->sreg[seg].limit) - { - logerror("Limit check at 0x%08x failed. Segment %04x, limit %08x, offset %08x\n",cpustate->pc,cpustate->sreg[seg].selector,cpustate->sreg[seg].limit,offset); - return 1; - } - } - } - return 0; -} -#endif + static void __FASTCALL i386_sreg_load(i386_state *cpustate, UINT16 selector, UINT8 reg, bool *fault) { // Checks done when MOV changes a segment register in protected mode @@ -1565,7 +1540,7 @@ static void __FASTCALL i386_protected_mode_jump(i386_state *cpustate, UINT16 seg logerror("JMP: Segment is not present\n"); FAULT(FAULT_NP,segment & 0xfffc) } - if(offset > desc.limit) + if((offset /*& cpustate->a20_mask*/) > desc.limit) { logerror("JMP: SELECTOR=%04X BASE=%08X LIMIT=%08X FLAGS=%04X D=%d\n", desc.selector, desc.base, desc.limit, desc.flags, desc.d); @@ -1757,9 +1732,9 @@ static void __FASTCALL i386_protected_mode_jump(i386_state *cpustate, UINT16 seg if(SetRPL != 0) segment = (segment & ~0x03) | cpustate->CPL; if(operand32 == 0) - cpustate->eip = offset & 0x0000ffff; + cpustate->eip = (offset & 0x0000ffff) /*& cpustate->a20_mask*/; else - cpustate->eip = offset; + cpustate->eip = offset /*& cpustate->a20_mask*/; cpustate->sreg[CS].selector = segment; cpustate->performed_intersegment_jump = 1; i386_load_segment_descriptor(cpustate,CS); diff --git a/source/src/vm/mame/emu/cpu/i386/i386priv.h b/source/src/vm/mame/emu/cpu/i386/i386priv.h index b00089ba5..be4ece216 100644 --- a/source/src/vm/mame/emu/cpu/i386/i386priv.h +++ b/source/src/vm/mame/emu/cpu/i386/i386priv.h @@ -859,6 +859,7 @@ extern MODRM_TABLE i386_MODRM_table[256]; INLINE int __FASTCALL i386_limit_check(i386_state *cpustate, int seg, UINT32 offset, UINT32 size) { // size = 1; // TBD +// offset &= cpustate->a20_mask; if(PROTECTED_MODE && !V8086_MODE) { if((cpustate->sreg[seg].flags & 0x0018) == 0x0010 && cpustate->sreg[seg].flags & 0x0004) // if expand-down data segment