diff --git a/src/cpu.c b/src/cpu.c index 5fc2d6fe5..95d423eab 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -228,9 +228,9 @@ CPU cpus_i386[] = {"i386DX/25", CPU_386DX, 2, 25000000, 1, 0, 0x0308, 0, 0, 0}, {"i386DX/33", CPU_386DX, 3, 33333333, 1, 0, 0x0308, 0, 0, 0}, {"i386DX/40", CPU_386DX, 4, 40000000, 1, 0, 0x0308, 0, 0, 0}, - {"RapidCAD/25", CPU_i486DX, 2, 25000000, 1, 0, 0x404, 0, 0, CPU_SUPPORTS_DYNAREC}, - {"RapidCAD/33", CPU_i486DX, 3, 33333333, 1, 0, 0x404, 0, 0, CPU_SUPPORTS_DYNAREC}, - {"RapidCAD/40", CPU_i486DX, 4, 40000000, 1, 0, 0x404, 0, 0, CPU_SUPPORTS_DYNAREC}, + {"RapidCAD/25", CPU_RAPIDCAD, 2, 25000000, 1, 0, 0x404, 0, 0, 0}, + {"RapidCAD/33", CPU_RAPIDCAD, 3, 33333333, 1, 0, 0x404, 0, 0, 0}, + {"RapidCAD/40", CPU_RAPIDCAD, 4, 40000000, 1, 0, 0x404, 0, 0, 0}, {"", -1, 0, 0, 0} }; @@ -292,7 +292,6 @@ CPU cpus_i486[] = {"iDX4/100", CPU_i486DX,10, 100000000, 3, 33333333, 0x481, 0x481, 0, CPU_SUPPORTS_DYNAREC}, /*Is on some real Intel DX2s, limit here is pretty arbitary*/ {"Pentium OverDrive/63", CPU_PENTIUM, 6, 62500000, 3, 25000000, 0x1531, 0x1531, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC}, {"Pentium OverDrive/83", CPU_PENTIUM, 8, 83333333, 3, 33333333, 0x1532, 0x1532, 0, CPU_SUPPORTS_DYNAREC | CPU_REQUIRES_DYNAREC}, - {"i386DX/33", CPU_386DX, 3, 33333333, 1, 0, 0x0308, 0, 0, 0}, {"", -1, 0, 0, 0} }; @@ -582,7 +581,8 @@ void cpu_set() is8086 = (cpu_s->cpu_type > CPU_8088); is286 = (cpu_s->cpu_type >= CPU_286); is386 = (cpu_s->cpu_type >= CPU_386SX); - is486 = (cpu_s->cpu_type >= CPU_i486SX) || (cpu_s->cpu_type == CPU_486SLC || cpu_s->cpu_type == CPU_486DLC); + israpidcad = (cpu_s->cpu_type == CPU_RAPIDCAD); + is486 = (cpu_s->cpu_type >= CPU_i486SX) || (cpu_s->cpu_type == CPU_486SLC || cpu_s->cpu_type == CPU_486DLC || cpu_s->cpu_type == CPU_RAPIDCAD); hasfpu = (cpu_s->cpu_type >= CPU_i486DX); cpu_iscyrix = (cpu_s->cpu_type == CPU_486SLC || cpu_s->cpu_type == CPU_486DLC || cpu_s->cpu_type == CPU_Cx486S || cpu_s->cpu_type == CPU_Cx486DX || cpu_s->cpu_type == CPU_Cx5x86 || cpu_s->cpu_type == CPU_Cx6x86 || cpu_s->cpu_type == CPU_Cx6x86MX || cpu_s->cpu_type == CPU_Cx6x86L || cpu_s->cpu_type == CPU_CxGX1); cpu_16bitbus = (cpu_s->cpu_type == CPU_386SX || cpu_s->cpu_type == CPU_486SLC); @@ -800,6 +800,37 @@ void cpu_set() timing_jmp_pm_gate = 45; break; + case CPU_RAPIDCAD: + timing_rr = 1; /*register dest - register src*/ + timing_rm = 2; /*register dest - memory src*/ + timing_mr = 3; /*memory dest - register src*/ + timing_mm = 3; + timing_rml = 2; /*register dest - memory src long*/ + timing_mrl = 3; /*memory dest - register src long*/ + timing_mml = 3; + timing_bt = 3-1; /*branch taken*/ + timing_bnt = 1; /*branch not taken*/ + timing_int = 4; + timing_int_rm = 26; + timing_int_v86 = 82; + timing_int_pm = 44; + timing_int_pm_outer = 71; + timing_iret_rm = 15; + timing_iret_v86 = 36; /*unknown*/ + timing_iret_pm = 20; + timing_iret_pm_outer = 36; + timing_call_rm = 18; + timing_call_pm = 20; + timing_call_pm_gate = 35; + timing_call_pm_gate_inner = 69; + timing_retf_rm = 13; + timing_retf_pm = 17; + timing_retf_pm_outer = 35; + timing_jmp_rm = 17; + timing_jmp_pm = 19; + timing_jmp_pm_gate = 32; + break; + case CPU_486SLC: x86_setopcodes(ops_386, ops_486_0f, dynarec_ops_386, dynarec_ops_486_0f); timing_rr = 1; /*register dest - register src*/ diff --git a/src/cpu.h b/src/cpu.h index a6d20a365..99bcf35ba 100644 --- a/src/cpu.h +++ b/src/cpu.h @@ -13,34 +13,35 @@ extern int cpu, cpu_manufacturer; /*386 class CPUs*/ #define CPU_386SX 3 #define CPU_386DX 4 -#define CPU_486SLC 5 -#define CPU_486DLC 6 +#define CPU_RAPIDCAD 5 +#define CPU_486SLC 6 +#define CPU_486DLC 7 /*486 class CPUs*/ -#define CPU_i486SX 7 -#define CPU_Am486SX 8 -#define CPU_Cx486S 9 -#define CPU_i486DX 10 -#define CPU_Am486DX 11 -#define CPU_Cx486DX 12 -#define CPU_Cx5x86 13 +#define CPU_i486SX 8 +#define CPU_Am486SX 9 +#define CPU_Cx486S 10 +#define CPU_i486DX 11 +#define CPU_Am486DX 12 +#define CPU_Cx486DX 13 +#define CPU_Cx5x86 14 /*586 class CPUs*/ -#define CPU_WINCHIP 14 -#define CPU_PENTIUM 15 -#define CPU_PENTIUMMMX 16 -#define CPU_Cx6x86 17 -#define CPU_Cx6x86MX 18 -#define CPU_Cx6x86L 19 -#define CPU_CxGX1 20 -#define CPU_K5 21 -#define CPU_5K86 22 -#define CPU_K6 23 +#define CPU_WINCHIP 15 +#define CPU_PENTIUM 16 +#define CPU_PENTIUMMMX 17 +#define CPU_Cx6x86 18 +#define CPU_Cx6x86MX 19 +#define CPU_Cx6x86L 20 +#define CPU_CxGX1 21 +#define CPU_K5 22 +#define CPU_5K86 23 +#define CPU_K6 24 /*686 class CPUs*/ -#define CPU_PENTIUMPRO 24 -#define CPU_PENTIUM2 25 -#define CPU_PENTIUM2D 26 +#define CPU_PENTIUMPRO 25 +#define CPU_PENTIUM2 26 +#define CPU_PENTIUM2D 27 #define MANU_INTEL 0 #define MANU_AMD 1 diff --git a/src/ibm.h b/src/ibm.h index 3693f139c..4f1019434 100644 --- a/src/ibm.h +++ b/src/ibm.h @@ -194,6 +194,7 @@ uint32_t dr[8]; //#define IOPLV86 ((!(msw&1)) || (CPL<=IOPL)) extern int cycles; extern int cycles_lost; +extern int israpidcad; extern int is486; extern uint8_t opcode; extern int insc; diff --git a/src/mem.c b/src/mem.c index 9a4fb8da7..72faa3f48 100644 --- a/src/mem.c +++ b/src/mem.c @@ -1647,7 +1647,7 @@ void mem_write_nulll(uint32_t addr, uint32_t val, void *p) void mem_updatecache() { flushmmucache(); - if (!is386) + if (!is386 || israpidcad) { cachesize=256; memwaitstate=0; diff --git a/src/x86_ops_int - Cópia.h b/src/x86_ops_int - Cópia.h deleted file mode 100644 index 0cfb959dd..000000000 --- a/src/x86_ops_int - Cópia.h +++ /dev/null @@ -1,77 +0,0 @@ -static int opINT3(uint32_t fetchdat) -{ - if ((cr0 & 1) && (eflags & VM_FLAG) && (IOPL != 3)) - { - x86gpf(NULL,0); - return 1; - } - x86_int_sw(3); - CLOCK_CYCLES((is486) ? 44 : 59); - return 1; -} - -static int opINT(uint32_t fetchdat) -{ - uint8_t temp; - - /*if (msw&1) pclog("INT %i %i %i\n",cr0&1,eflags&VM_FLAG,IOPL);*/ - if ((cr0 & 1) && (eflags & VM_FLAG) && (IOPL != 3)) - { - x86gpf(NULL,0); - return 1; - } - temp = getbytef(); -// /*if (temp == 0x10 && AH == 0xe) */pclog("INT %02X : %04X %04X %04X %04X %c %04X:%04X\n", temp, AX, BX, CX, DX, (AL < 32) ? ' ' : AL, CS, pc); -// if (CS == 0x0028 && pc == 0xC03813C0) -// output = 3; -/* if (pc == 0x8028009A) - output = 3; - if (pc == 0x80282B6F) - { - __times++; - if (__times == 2) - fatal("WRONG\n"); - } - if (pc == 0x802809CE) - fatal("RIGHT\n");*/ -// if (CS == 0x0028 && pc == 0x80037FE9) -// output = 3; -//if (CS == 0x9087 && pc == 0x3763) -// fatal("Here\n"); -//if (CS==0x9087 && pc == 0x0850) -// output = 1; - -/* if (output && pc == 0x80033008) - { - __times++; - if (__times == 2) - fatal("WRONG\n"); - }*/ -/* if (output && pc == 0x80D8) - { - __times++; - if (__times == 2) - fatal("RIGHT\n"); - }*/ - - x86_int_sw(temp); - return 1; -} - -static int opINTO(uint32_t fetchdat) -{ - if ((cr0 & 1) && (eflags & VM_FLAG) && (IOPL != 3)) - { - x86gpf(NULL,0); - return 1; - } - if (VF_SET()) - { - oldpc = pc; - x86_int_sw(4); - return 1; - } - CLOCK_CYCLES(3); - return 0; -} - diff --git a/src/x86_ops_io - Cópia.h b/src/x86_ops_io - Cópia.h deleted file mode 100644 index c7bde30aa..000000000 --- a/src/x86_ops_io - Cópia.h +++ /dev/null @@ -1,112 +0,0 @@ -static int opIN_AL_imm(uint32_t fetchdat) -{ - uint16_t port = (uint16_t)getbytef(); - check_io_perm(port); - AL = inb(port); - CLOCK_CYCLES(12); - return 0; -} -static int opIN_AX_imm(uint32_t fetchdat) -{ - uint16_t port = (uint16_t)getbytef(); - check_io_perm(port); - check_io_perm(port + 1); - AX = inw(port); - CLOCK_CYCLES(12); - return 0; -} -static int opIN_EAX_imm(uint32_t fetchdat) -{ - uint16_t port = (uint16_t)getbytef(); - check_io_perm(port); - check_io_perm(port + 1); - check_io_perm(port + 2); - check_io_perm(port + 3); - EAX = inl(port); - CLOCK_CYCLES(12); - return 0; -} - -static int opOUT_AL_imm(uint32_t fetchdat) -{ - uint16_t port = (uint16_t)getbytef(); - check_io_perm(port); - outb(port, AL); - CLOCK_CYCLES(10); - if (port == 0x64) - return x86_was_reset; - return 0; -} -static int opOUT_AX_imm(uint32_t fetchdat) -{ - uint16_t port = (uint16_t)getbytef(); - check_io_perm(port); - check_io_perm(port + 1); - outw(port, AX); - CLOCK_CYCLES(10); - return 0; -} -static int opOUT_EAX_imm(uint32_t fetchdat) -{ - uint16_t port = (uint16_t)getbytef(); - check_io_perm(port); - check_io_perm(port + 1); - check_io_perm(port + 2); - check_io_perm(port + 3); - outl(port, EAX); - CLOCK_CYCLES(10); - return 0; -} - -static int opIN_AL_DX(uint32_t fetchdat) -{ - check_io_perm(DX); - AL = inb(DX); - CLOCK_CYCLES(12); - return 0; -} -static int opIN_AX_DX(uint32_t fetchdat) -{ - check_io_perm(DX); - check_io_perm(DX + 1); - AX = inw(DX); - CLOCK_CYCLES(12); - return 0; -} -static int opIN_EAX_DX(uint32_t fetchdat) -{ - check_io_perm(DX); - check_io_perm(DX + 1); - check_io_perm(DX + 2); - check_io_perm(DX + 3); - EAX = inl(DX); - CLOCK_CYCLES(12); - return 0; -} - -static int opOUT_AL_DX(uint32_t fetchdat) -{ - check_io_perm(DX); - outb(DX, AL); - CLOCK_CYCLES(11); - return x86_was_reset; -} -static int opOUT_AX_DX(uint32_t fetchdat) -{ - //pclog("OUT_AX_DX %04X %04X\n", DX, AX); - check_io_perm(DX); - check_io_perm(DX + 1); - outw(DX, AX); - CLOCK_CYCLES(11); - return 0; -} -static int opOUT_EAX_DX(uint32_t fetchdat) -{ - check_io_perm(DX); - check_io_perm(DX + 1); - check_io_perm(DX + 2); - check_io_perm(DX + 3); - outl(DX, EAX); - CLOCK_CYCLES(11); - return 0; -} diff --git a/src/x86_ops_misc.h b/src/x86_ops_misc.h index d23421b89..836a56637 100644 --- a/src/x86_ops_misc.h +++ b/src/x86_ops_misc.h @@ -723,6 +723,8 @@ static int opLOADALL386(uint32_t fetchdat) { uint32_t la_addr = es + EDI; + if (is486) return ILLEGAL; + cr0 = readmeml(0, la_addr); flags = readmemw(0, la_addr + 4); eflags = readmemw(0, la_addr + 6);