diff --git a/src/cpu/core_full.cpp b/src/cpu/core_full.cpp index 2f7af7ae..7e2d8e53 100644 --- a/src/cpu/core_full.cpp +++ b/src/cpu/core_full.cpp @@ -3,24 +3,51 @@ #include "pic.h" #include "regs.h" #include "cpu.h" +#include "lazyflags.h" #include "fpu.h" #include "debug.h" #include "inout.h" #include "callback.h" + +Bit8u PAGE_Readb(PhysPt address); +Bit16u PAGE_Readw(PhysPt address); +Bit32u PAGE_Readd(PhysPt address); + +void PAGE_Writeb(PhysPt address,Bit8u val); +void PAGE_Writew(PhysPt address,Bit16u val); +void PAGE_Writed(PhysPt address,Bit32u val); + typedef PhysPt EAPoint; #define SegBase(c) SegPhys(c) -#define LoadMb(off) mem_readb_inline(off) -#define LoadMw(off) mem_readw_inline(off) -#define LoadMd(off) mem_readd_inline(off) +#if 1 +#define LoadMb(off) mem_readb(off) +#define LoadMw(off) mem_readw(off) +#define LoadMd(off) mem_readd(off) #define LoadMbs(off) (Bit8s)(LoadMb(off)) #define LoadMws(off) (Bit16s)(LoadMw(off)) #define LoadMds(off) (Bit32s)(LoadMd(off)) -#define SaveMb(off,val) mem_writeb_inline(off,val) -#define SaveMw(off,val) mem_writew_inline(off,val) -#define SaveMd(off,val) mem_writed_inline(off,val) +#define SaveMb(off,val) mem_writeb(off,val) +#define SaveMw(off,val) mem_writew(off,val) +#define SaveMd(off,val) mem_writed(off,val) + +#else + +#define LoadMb(off) PAGE_Readb(off) +#define LoadMw(off) PAGE_Readw(off) +#define LoadMd(off) PAGE_Readd(off) + +#define LoadMbs(off) (Bit8s)(LoadMb(off)) +#define LoadMws(off) (Bit16s)(LoadMw(off)) +#define LoadMds(off) (Bit32s)(LoadMd(off)) + +#define SaveMb(off,val) PAGE_Writeb(off,val) +#define SaveMw(off,val) PAGE_Writew(off,val) +#define SaveMd(off,val) PAGE_Writed(off,val) + +#endif #define LoadD(reg) reg #define SaveD(reg,val) reg=val @@ -43,10 +70,14 @@ static INLINE void DecodeModRM(void) { if (inst.rm<0xc0) inst.rm_eaa=(inst.prefix & PREFIX_ADDR) ? RMAddress_32() : RMAddress_16(); } +#define LEAVECORE \ + SaveIP(); \ + FILLFLAGS; + #define EXCEPTION(blah) \ { \ Bit8u new_num=blah; \ - SaveIP(); \ + LEAVECORE; \ Interrupt(new_num); \ LoadIP(); \ goto nextopcode; \ @@ -55,11 +86,12 @@ static INLINE void DecodeModRM(void) { Bitu Full_DeCode(void) { LoadIP(); + flags.type=t_UNKNOWN; while (CPU_Cycles>0) { #if C_DEBUG cycle_count++; #if C_HEAVY_DEBUG - SaveIP(); + LEAVECORE; if (DEBUG_HeavyIsBreakpoint()) return 1; #endif #endif @@ -76,8 +108,8 @@ restartopcode: nextopcode:; CPU_Cycles--; } - SaveIP(); - return 0; + LEAVECORE; + return CBRET_NONE; } diff --git a/src/cpu/core_full/load.h b/src/cpu/core_full/load.h index 9636a499..97e2b348 100644 --- a/src/cpu/core_full/load.h +++ b/src/cpu/core_full/load.h @@ -265,10 +265,12 @@ l_M_Ed: inst.op1.d=4; break; case D_IRETw: + flags.type=t_UNKNOWN; CPU_IRET(false); LoadIP(); goto nextopcode; case D_IRETd: + flags.type=t_UNKNOWN; CPU_IRET(true); LoadIP(); goto nextopcode; @@ -470,7 +472,7 @@ l_M_Ed: CPU_CPUID(); goto nextopcode; case D_HLT: - SaveIP(); + LEAVECORE; CPU_HLT(); return 0x0; default: diff --git a/src/cpu/core_full/loadwrite.h b/src/cpu/core_full/loadwrite.h index 77a9c61d..3b3aec07 100644 --- a/src/cpu/core_full/loadwrite.h +++ b/src/cpu/core_full/loadwrite.h @@ -80,10 +80,9 @@ static INLINE Bit32u Pop_32(void) { } } - #if 0 if (flags.intf && PIC_IRQCheck) { \ - SaveIP(); \ + LEAVECORE; \ PIC_runIRQs(); \ LoadIP(); \ } \ diff --git a/src/cpu/core_full/op.h b/src/cpu/core_full/op.h index 0adb0a64..7e425a57 100644 --- a/src/cpu/core_full/op.h +++ b/src/cpu/core_full/op.h @@ -339,7 +339,7 @@ switch (inst.code.op) { goto nextopcode; case O_INT: - SaveIP(); + LEAVECORE; #if C_DEBUG if (((inst.entry & 0xFF)==0xcc) && DEBUG_Breakpoint()) return 1; else if (DEBUG_IntBreakpoint(inst.op1.b)) return 1; @@ -371,7 +371,7 @@ switch (inst.code.op) { goto nextopcode; case O_CBACK: if (inst.op1.d