summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/i386
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/i386')
-rw-r--r--src/devices/cpu/i386/i386.cpp92
-rw-r--r--src/devices/cpu/i386/i386.h9
-rw-r--r--src/devices/cpu/i386/i386op32.inc16
-rw-r--r--src/devices/cpu/i386/i386ops.h1
-rw-r--r--src/devices/cpu/i386/i386ops.inc63
-rw-r--r--src/devices/cpu/i386/i386priv.h41
-rw-r--r--src/devices/cpu/i386/i486ops.inc8
7 files changed, 71 insertions, 159 deletions
diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp
index 4f593de3dea..f0d57ada9a0 100644
--- a/src/devices/cpu/i386/i386.cpp
+++ b/src/devices/cpu/i386/i386.cpp
@@ -41,31 +41,23 @@ const device_type PENTIUM4 = &device_creator<pentium4_device>;
i386_device::i386_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: cpu_device(mconfig, I386, "I386", tag, owner, clock, "i386", __FILE__)
- , device_vtlb_interface(mconfig, *this, AS_PROGRAM)
, m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0)
, m_io_config("io", ENDIANNESS_LITTLE, 32, 16, 0)
, m_smiact(*this)
{
m_program_config.m_logaddr_width = 32;
m_program_config.m_page_shift = 12;
-
- // 32 unified
- set_vtlb_dynamic_entries(32);
}
i386_device::i386_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source, int program_data_width, int program_addr_width, int io_data_width)
: cpu_device(mconfig, type, name, tag, owner, clock, shortname, source)
- , device_vtlb_interface(mconfig, *this, AS_PROGRAM)
, m_program_config("program", ENDIANNESS_LITTLE, program_data_width, program_addr_width, 0)
, m_io_config("io", ENDIANNESS_LITTLE, io_data_width, 16, 0)
, m_smiact(*this)
{
m_program_config.m_logaddr_width = 32;
m_program_config.m_page_shift = 12;
-
- // 32 unified
- set_vtlb_dynamic_entries(32);
}
i386SX_device::i386SX_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
@@ -81,15 +73,11 @@ i486_device::i486_device(const machine_config &mconfig, const char *tag, device_
pentium_device::pentium_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: i386_device(mconfig, PENTIUM, "PENTIUM", tag, owner, clock, "pentium", __FILE__)
{
- // 64 dtlb small, 8 dtlb large, 32 itlb
- set_vtlb_dynamic_entries(96);
}
pentium_device::pentium_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
: i386_device(mconfig, type, name, tag, owner, clock, shortname, source)
{
- // 64 dtlb small, 8 dtlb large, 32 itlb
- set_vtlb_dynamic_entries(96);
}
mediagx_device::mediagx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
@@ -105,29 +93,21 @@ pentium_pro_device::pentium_pro_device(const machine_config &mconfig, const char
pentium_mmx_device::pentium_mmx_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: pentium_device(mconfig, PENTIUM_MMX, "Pentium MMX", tag, owner, clock, "pentium_mmx", __FILE__)
{
- // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large
- set_vtlb_dynamic_entries(96);
}
pentium2_device::pentium2_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: pentium_device(mconfig, PENTIUM2, "Pentium II", tag, owner, clock, "pentium2", __FILE__)
{
- // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large
- set_vtlb_dynamic_entries(96);
}
pentium3_device::pentium3_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: pentium_device(mconfig, PENTIUM3, "Pentium III", tag, owner, clock, "pentium3", __FILE__)
{
- // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large
- set_vtlb_dynamic_entries(96);
}
pentium4_device::pentium4_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
: pentium_device(mconfig, PENTIUM4, "Pentium 4", tag, owner, clock, "pentium4", __FILE__)
{
- // 128 dtlb, 64 itlb
- set_vtlb_dynamic_entries(196);
}
@@ -976,10 +956,10 @@ void i386_device::i386_trap(int irq, int irq_gate, int trap_level)
//logerror("IRQ (%08x): Interrupt during V8086 task\n",m_pc);
if(type & 0x08)
{
- PUSH32SEG(m_sreg[GS].selector & 0xffff);
- PUSH32SEG(m_sreg[FS].selector & 0xffff);
- PUSH32SEG(m_sreg[DS].selector & 0xffff);
- PUSH32SEG(m_sreg[ES].selector & 0xffff);
+ PUSH32(m_sreg[GS].selector & 0xffff);
+ PUSH32(m_sreg[FS].selector & 0xffff);
+ PUSH32(m_sreg[DS].selector & 0xffff);
+ PUSH32(m_sreg[ES].selector & 0xffff);
}
else
{
@@ -1001,7 +981,7 @@ void i386_device::i386_trap(int irq, int irq_gate, int trap_level)
if(type & 0x08)
{
// 32-bit gate
- PUSH32SEG(oldSS);
+ PUSH32(oldSS);
PUSH32(oldESP);
}
else
@@ -1063,7 +1043,7 @@ void i386_device::i386_trap(int irq, int irq_gate, int trap_level)
else
{
PUSH32(oldflags & 0x00ffffff );
- PUSH32SEG(m_sreg[CS].selector );
+ PUSH32(m_sreg[CS].selector );
if(irq == 3 || irq == 4 || irq == 9 || irq_gate == 1)
PUSH32(m_eip );
else
@@ -1326,7 +1306,7 @@ void i386_device::i386_task_switch(UINT16 selector, UINT8 nested)
}
m_cr[3] = READ32(tss+0x1c); // CR3 (PDBR)
if(oldcr3 != m_cr[3])
- vtlb_flush_dynamic();
+ vtlb_flush_dynamic(m_vtlb);
/* Set the busy bit in the new task's descriptor */
if(selector & 0x0004)
@@ -1935,7 +1915,7 @@ void i386_device::i386_protected_mode_call(UINT16 seg, UINT32 off, int indirect,
if(operand32 != 0)
{
- PUSH32SEG(oldSS);
+ PUSH32(oldSS);
PUSH32(oldESP);
}
else
@@ -2069,7 +2049,7 @@ void i386_device::i386_protected_mode_call(UINT16 seg, UINT32 off, int indirect,
else
{
/* 32-bit operand size */
- PUSH32SEG(m_sreg[CS].selector );
+ PUSH32(m_sreg[CS].selector );
PUSH32(m_eip );
m_sreg[CS].selector = selector;
m_performed_intersegment_jump = 1;
@@ -2364,7 +2344,6 @@ void i386_device::i386_protected_mode_iret(int operand32)
I386_SREG desc,stack;
UINT8 CPL, RPL, DPL;
UINT32 newflags;
- UINT8 IOPL = m_IOP1 | (m_IOP2 << 1);
CPL = m_CPL;
UINT32 ea = i386_translate(SS, (STACK_32BIT)?REG32(ESP):REG16(SP), 0);
@@ -2384,7 +2363,7 @@ void i386_device::i386_protected_mode_iret(int operand32)
if(V8086_MODE)
{
UINT32 oldflags = get_flags();
- if(IOPL != 3)
+ if(!m_IOP1 || !m_IOP2)
{
logerror("IRET (%08x): Is in Virtual 8086 mode and IOPL != 3.\n",m_pc);
FAULT(FAULT_GP,0)
@@ -2456,8 +2435,6 @@ void i386_device::i386_protected_mode_iret(int operand32)
{
UINT32 oldflags = get_flags();
newflags = (newflags & ~0x00003000) | (oldflags & 0x00003000);
- if(CPL > IOPL)
- newflags = (newflags & ~0x200 ) | (oldflags & 0x200);
}
set_flags(newflags);
m_eip = POP32() & 0xffff; // high 16 bits are ignored
@@ -2574,7 +2551,7 @@ void i386_device::i386_protected_mode_iret(int operand32)
}
if((desc.flags & 0x0080) == 0)
{
- logerror("IRET: (%08x) Return CS segment is not present.\n", m_pc);
+ logerror("IRET: Return CS segment is not present.\n");
FAULT(FAULT_NP,newCS & ~0x03)
}
if(newEIP > desc.limit)
@@ -2587,8 +2564,6 @@ void i386_device::i386_protected_mode_iret(int operand32)
{
UINT32 oldflags = get_flags();
newflags = (newflags & ~0x00003000) | (oldflags & 0x00003000);
- if(CPL > IOPL)
- newflags = (newflags & ~0x200 ) | (oldflags & 0x200);
}
if(operand32 == 0)
@@ -2758,8 +2733,6 @@ void i386_device::i386_protected_mode_iret(int operand32)
{
UINT32 oldflags = get_flags();
newflags = (newflags & ~0x00003000) | (oldflags & 0x00003000);
- if(CPL > IOPL)
- newflags = (newflags & ~0x200 ) | (oldflags & 0x200);
}
if(operand32 == 0)
@@ -3205,7 +3178,7 @@ void i386_device::i386_postload()
CHANGE_PC(m_eip);
}
-void i386_device::i386_common_init()
+void i386_device::i386_common_init(int tlbsize)
{
int i, j;
static const int regs8[8] = {AL,CL,DL,BL,AH,CH,DH,BH};
@@ -3238,6 +3211,7 @@ void i386_device::i386_common_init()
m_program = &space(AS_PROGRAM);
m_direct = &m_program->direct();
m_io = &space(AS_IO);
+ m_vtlb = vtlb_alloc(this, AS_PROGRAM, 0, tlbsize);
m_smi = false;
m_debugger_temp = 0;
m_lock = false;
@@ -3320,7 +3294,7 @@ void i386_device::i386_common_init()
void i386_device::device_start()
{
- i386_common_init();
+ i386_common_init(32);
build_opcode_table(OP_I386);
m_cycle_table_rm = cycle_table_rm[CPU_CYCLES_I386].get();
@@ -3724,6 +3698,7 @@ void i386_device::zero_state()
void i386_device::device_reset()
{
zero_state();
+ vtlb_flush_dynamic(m_vtlb);
m_sreg[CS].selector = 0xf000;
m_sreg[CS].base = 0xffff0000;
@@ -3756,7 +3731,6 @@ void i386_device::device_reset()
// Family 3 (386), Model 0 (DX), Stepping 8 (D1)
REG32(EAX) = 0;
REG32(EDX) = (3 << 8) | (0 << 4) | (8);
- m_cpu_version = REG32(EDX);
m_CPL = 0;
@@ -3830,7 +3804,7 @@ void i386_device::pentium_smi()
WRITE32(REG32(ESI), smram_state+SMRAM_ESI);
WRITE32(REG32(EDI), smram_state+SMRAM_EDI);
WRITE32(m_eip, smram_state+SMRAM_EIP);
- WRITE32(old_flags, smram_state+SMRAM_EFLAGS);
+ WRITE32(old_flags, smram_state+SMRAM_EAX);
WRITE32(m_cr[3], smram_state+SMRAM_CR3);
WRITE32(old_cr0, smram_state+SMRAM_CR0);
@@ -3916,7 +3890,7 @@ void i386_device::i386_set_a20_line(int state)
m_a20_mask = ~(1 << 20);
}
// TODO: how does A20M and the tlb interact
- vtlb_flush_dynamic();
+ vtlb_flush_dynamic(m_vtlb);
}
void i386_device::execute_run()
@@ -4002,7 +3976,7 @@ offs_t i386_device::disasm_disassemble(char *buffer, offs_t pc, const UINT8 *opr
void i486_device::device_start()
{
- i386_common_init();
+ i386_common_init(32);
build_opcode_table(OP_I386 | OP_FPU | OP_I486);
build_x87_opcode_table();
@@ -4015,6 +3989,7 @@ void i486_device::device_start()
void i486_device::device_reset()
{
zero_state();
+ vtlb_flush_dynamic(m_vtlb);
m_sreg[CS].selector = 0xf000;
m_sreg[CS].base = 0xffff0000;
@@ -4047,7 +4022,6 @@ void i486_device::device_reset()
// Family 4 (486), Model 0/1 (DX), Stepping 3
REG32(EAX) = 0;
REG32(EDX) = (4 << 8) | (0 << 4) | (3);
- m_cpu_version = REG32(EDX);
CHANGE_PC(m_eip);
}
@@ -4059,7 +4033,8 @@ void i486_device::device_reset()
void pentium_device::device_start()
{
- i386_common_init();
+ // 64 dtlb small, 8 dtlb large, 32 itlb
+ i386_common_init(96);
register_state_i386_x87();
build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM);
@@ -4071,6 +4046,7 @@ void pentium_device::device_start()
void pentium_device::device_reset()
{
zero_state();
+ vtlb_flush_dynamic(m_vtlb);
m_sreg[CS].selector = 0xf000;
m_sreg[CS].base = 0xffff0000;
@@ -4131,7 +4107,8 @@ void pentium_device::device_reset()
void mediagx_device::device_start()
{
- i386_common_init();
+ // probably 32 unified
+ i386_common_init(32);
register_state_i386_x87();
build_x87_opcode_table();
@@ -4143,6 +4120,7 @@ void mediagx_device::device_start()
void mediagx_device::device_reset()
{
zero_state();
+ vtlb_flush_dynamic(m_vtlb);
m_sreg[CS].selector = 0xf000;
m_sreg[CS].base = 0xffff0000;
@@ -4194,7 +4172,8 @@ void mediagx_device::device_reset()
void pentium_pro_device::device_start()
{
- i386_common_init();
+ // 64 dtlb small, 32 itlb
+ i386_common_init(96);
register_state_i386_x87();
build_x87_opcode_table();
@@ -4206,6 +4185,7 @@ void pentium_pro_device::device_start()
void pentium_pro_device::device_reset()
{
zero_state();
+ vtlb_flush_dynamic(m_vtlb);
m_sreg[CS].selector = 0xf000;
m_sreg[CS].base = 0xffff0000;
@@ -4267,7 +4247,8 @@ void pentium_pro_device::device_reset()
void pentium_mmx_device::device_start()
{
- i386_common_init();
+ // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large
+ i386_common_init(96);
register_state_i386_x87();
build_x87_opcode_table();
@@ -4279,6 +4260,7 @@ void pentium_mmx_device::device_start()
void pentium_mmx_device::device_reset()
{
zero_state();
+ vtlb_flush_dynamic(m_vtlb);
m_sreg[CS].selector = 0xf000;
m_sreg[CS].base = 0xffff0000;
@@ -4338,7 +4320,8 @@ void pentium_mmx_device::device_reset()
void pentium2_device::device_start()
{
- i386_common_init();
+ // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large
+ i386_common_init(96);
register_state_i386_x87();
build_x87_opcode_table();
@@ -4350,6 +4333,7 @@ void pentium2_device::device_start()
void pentium2_device::device_reset()
{
zero_state();
+ vtlb_flush_dynamic(m_vtlb);
m_sreg[CS].selector = 0xf000;
m_sreg[CS].base = 0xffff0000;
@@ -4403,7 +4387,8 @@ void pentium2_device::device_reset()
void pentium3_device::device_start()
{
- i386_common_init();
+ // 64 dtlb small, 8 dtlb large, 32 itlb small, 2 itlb large
+ i386_common_init(96);
register_state_i386_x87_xmm();
build_x87_opcode_table();
@@ -4415,6 +4400,7 @@ void pentium3_device::device_start()
void pentium3_device::device_reset()
{
zero_state();
+ vtlb_flush_dynamic(m_vtlb);
m_sreg[CS].selector = 0xf000;
m_sreg[CS].base = 0xffff0000;
@@ -4470,7 +4456,8 @@ void pentium3_device::device_reset()
void pentium4_device::device_start()
{
- i386_common_init();
+ // 128 dtlb, 64 itlb
+ i386_common_init(196);
register_state_i386_x87_xmm();
build_x87_opcode_table();
@@ -4482,6 +4469,7 @@ void pentium4_device::device_start()
void pentium4_device::device_reset()
{
zero_state();
+ vtlb_flush_dynamic(m_vtlb);
m_sreg[CS].selector = 0xf000;
m_sreg[CS].base = 0xffff0000;
diff --git a/src/devices/cpu/i386/i386.h b/src/devices/cpu/i386/i386.h
index 8e64458f228..c9ef38b4280 100644
--- a/src/devices/cpu/i386/i386.h
+++ b/src/devices/cpu/i386/i386.h
@@ -8,7 +8,7 @@
#include "softfloat/milieu.h"
#include "softfloat/softfloat.h"
#include "debug/debugcpu.h"
-#include "divtlb.h"
+#include "cpu/vtlb.h"
#define INPUT_LINE_A20 1
@@ -24,7 +24,7 @@
#define X86_NUM_CPUS 4
-class i386_device : public cpu_device, public device_vtlb_interface
+class i386_device : public cpu_device
{
public:
// construction/destruction
@@ -270,6 +270,8 @@ struct I386_CALL_GATE
UINT8 *m_cycle_table_pm;
UINT8 *m_cycle_table_rm;
+ vtlb_state *m_vtlb;
+
bool m_smm;
bool m_smi;
bool m_smi_latched;
@@ -333,7 +335,6 @@ struct I386_CALL_GATE
inline UINT32 DEC32(UINT32 dst);
inline void PUSH16(UINT16 value);
inline void PUSH32(UINT32 value);
- inline void PUSH32SEG(UINT32 value);
inline void PUSH8(UINT8 value);
inline UINT8 POP8();
inline UINT16 POP16();
@@ -1410,7 +1411,7 @@ struct I386_CALL_GATE
void build_x87_opcode_table_df();
void build_x87_opcode_table();
void i386_postload();
- void i386_common_init();
+ void i386_common_init(int tlbsize);
void build_opcode_table(UINT32 features);
void pentium_smi();
void zero_state();
diff --git a/src/devices/cpu/i386/i386op32.inc b/src/devices/cpu/i386/i386op32.inc
index 89c7bab44b4..af5358e4bff 100644
--- a/src/devices/cpu/i386/i386op32.inc
+++ b/src/devices/cpu/i386/i386op32.inc
@@ -475,7 +475,7 @@ void i386_device::i386_call_abs32() // Opcode 0x9a
}
else
{
- PUSH32SEG(m_sreg[CS].selector );
+ PUSH32(m_sreg[CS].selector );
PUSH32(m_eip );
m_sreg[CS].selector = ptr;
m_performed_intersegment_jump = 1;
@@ -1717,7 +1717,7 @@ void i386_device::i386_push_cs32() // Opcode 0x0e
else
offset = (REG16(SP) - 4) & 0xffff;
if(i386_limit_check(SS,offset) == 0)
- PUSH32SEG(m_sreg[CS].selector );
+ PUSH32(m_sreg[CS].selector );
else
FAULT(FAULT_SS,0)
CYCLES(CYCLES_PUSH_SREG);
@@ -1731,7 +1731,7 @@ void i386_device::i386_push_ds32() // Opcode 0x1e
else
offset = (REG16(SP) - 4) & 0xffff;
if(i386_limit_check(SS,offset) == 0)
- PUSH32SEG(m_sreg[DS].selector );
+ PUSH32(m_sreg[DS].selector );
else
FAULT(FAULT_SS,0)
CYCLES(CYCLES_PUSH_SREG);
@@ -1745,7 +1745,7 @@ void i386_device::i386_push_es32() // Opcode 0x06
else
offset = (REG16(SP) - 4) & 0xffff;
if(i386_limit_check(SS,offset) == 0)
- PUSH32SEG(m_sreg[ES].selector );
+ PUSH32(m_sreg[ES].selector );
else
FAULT(FAULT_SS,0)
CYCLES(CYCLES_PUSH_SREG);
@@ -1759,7 +1759,7 @@ void i386_device::i386_push_fs32() // Opcode 0x0f a0
else
offset = (REG16(SP) - 4) & 0xffff;
if(i386_limit_check(SS,offset) == 0)
- PUSH32SEG(m_sreg[FS].selector );
+ PUSH32(m_sreg[FS].selector );
else
FAULT(FAULT_SS,0)
CYCLES(CYCLES_PUSH_SREG);
@@ -1773,7 +1773,7 @@ void i386_device::i386_push_gs32() // Opcode 0x0f a8
else
offset = (REG16(SP) - 4) & 0xffff;
if(i386_limit_check(SS,offset) == 0)
- PUSH32SEG(m_sreg[GS].selector );
+ PUSH32(m_sreg[GS].selector );
else
FAULT(FAULT_SS,0)
CYCLES(CYCLES_PUSH_SREG);
@@ -1787,7 +1787,7 @@ void i386_device::i386_push_ss32() // Opcode 0x16
else
offset = (REG16(SP) - 4) & 0xffff;
if(i386_limit_check(SS,offset) == 0)
- PUSH32SEG(m_sreg[SS].selector );
+ PUSH32(m_sreg[SS].selector );
else
FAULT(FAULT_SS,0)
CYCLES(CYCLES_PUSH_SREG);
@@ -2845,7 +2845,7 @@ void i386_device::i386_groupFF_32() // Opcode 0xff
}
else
{
- PUSH32SEG(m_sreg[CS].selector );
+ PUSH32(m_sreg[CS].selector );
PUSH32(m_eip );
m_sreg[CS].selector = selector;
m_performed_intersegment_jump = 1;
diff --git a/src/devices/cpu/i386/i386ops.h b/src/devices/cpu/i386/i386ops.h
index ccf89a8720d..2760b9cf410 100644
--- a/src/devices/cpu/i386/i386ops.h
+++ b/src/devices/cpu/i386/i386ops.h
@@ -297,7 +297,6 @@ const i386_device::X86_OPCODE i386_device::s_x86_opcode_table[] =
{ 0x03, OP_2BYTE|OP_I386, &i386_device::i386_lsl_r16_rm16, &i386_device::i386_lsl_r32_rm32, false},
{ 0x06, OP_2BYTE|OP_I386, &i386_device::i386_clts, &i386_device::i386_clts, false},
{ 0x07, OP_2BYTE|OP_I386, &i386_device::i386_loadall, &i386_device::i386_loadall, false},
- { 0x07, OP_2BYTE|OP_I486, &i386_device::i386_invalid, &i386_device::i386_invalid, false},
{ 0x08, OP_2BYTE|OP_I486, &i386_device::i486_invd, &i386_device::i486_invd, false},
{ 0x09, OP_2BYTE|OP_I486, &i386_device::i486_wbinvd, &i386_device::i486_wbinvd, false},
{ 0x0B, OP_2BYTE|OP_PENTIUM, &i386_device::pentium_ud2, &i386_device::pentium_ud2, false},
diff --git a/src/devices/cpu/i386/i386ops.inc b/src/devices/cpu/i386/i386ops.inc
index 2f13445c8be..dc237c98469 100644
--- a/src/devices/cpu/i386/i386ops.inc
+++ b/src/devices/cpu/i386/i386ops.inc
@@ -701,7 +701,7 @@ void i386_device::i386_mov_cr_r32() // Opcode 0x0f 22
case 2: CYCLES(CYCLES_MOV_REG_CR2); break;
case 3:
CYCLES(CYCLES_MOV_REG_CR3);
- vtlb_flush_dynamic();
+ vtlb_flush_dynamic(m_vtlb);
break;
case 4: CYCLES(1); break; // TODO
default:
@@ -2504,66 +2504,7 @@ void i386_device::i386_mov_tr_r32() // Opcode 0x0f 26
void i386_device::i386_loadall() // Opcode 0x0f 0x07 (0x0f 0x05 on 80286), undocumented
{
- if(PROTECTED_MODE && (m_CPL != 0))
- FAULT(FAULT_GP,0)
- UINT32 ea = i386_translate(ES, REG32(EDI), 0);
- m_cr[0] = READ32(ea) & 0xfffeffff; // wp not supported on 386
- set_flags(READ32(ea + 0x04));
- m_eip = READ32(ea + 0x08);
- REG32(EDI) = READ32(ea + 0x0c);
- REG32(ESI) = READ32(ea + 0x10);
- REG32(EBP) = READ32(ea + 0x14);
- REG32(ESP) = READ32(ea + 0x18);
- REG32(EBX) = READ32(ea + 0x1c);
- REG32(EDX) = READ32(ea + 0x20);
- REG32(ECX) = READ32(ea + 0x24);
- REG32(EAX) = READ32(ea + 0x28);
- m_dr[6] = READ32(ea + 0x2c);
- m_dr[7] = READ32(ea + 0x30);
- m_task.segment = READ16(ea + 0x34);
- m_ldtr.segment = READ16(ea + 0x38);
- m_sreg[GS].selector = READ16(ea + 0x3c);
- m_sreg[FS].selector = READ16(ea + 0x40);
- m_sreg[DS].selector = READ16(ea + 0x44);
- m_sreg[SS].selector = READ16(ea + 0x48);
- m_sreg[CS].selector = READ16(ea + 0x4c);
- m_sreg[ES].selector = READ16(ea + 0x50);
- m_task.flags = READ32(ea + 0x54) >> 8;
- m_task.base = READ32(ea + 0x58);
- m_task.limit = READ32(ea + 0x5c);
- m_idtr.base = READ32(ea + 0x64);
- m_idtr.limit = READ32(ea + 0x68);
- m_gdtr.base = READ32(ea + 0x70);
- m_gdtr.limit = READ32(ea + 0x74);
- m_ldtr.flags = READ32(ea + 0x78) >> 8;
- m_ldtr.base = READ32(ea + 0x7c);
- m_ldtr.limit = READ32(ea + 0x80);
- m_sreg[GS].flags = READ32(ea + 0x84) >> 8;
- m_sreg[GS].base = READ32(ea + 0x88);
- m_sreg[GS].limit = READ32(ea + 0x8c);
- m_sreg[FS].flags = READ32(ea + 0x90) >> 8;
- m_sreg[FS].base = READ32(ea + 0x94);
- m_sreg[FS].limit = READ32(ea + 0x98);
- m_sreg[DS].flags = READ32(ea + 0x9c) >> 8;
- m_sreg[DS].base = READ32(ea + 0xa0);
- m_sreg[DS].limit = READ32(ea + 0xa4);
- m_sreg[SS].flags = READ32(ea + 0xa8) >> 8;
- m_sreg[SS].base = READ32(ea + 0xac);
- m_sreg[SS].limit = READ32(ea + 0xb0);
- m_sreg[CS].flags = READ32(ea + 0xb4) >> 8;
- m_sreg[CS].base = READ32(ea + 0xb8);
- m_sreg[CS].limit = READ32(ea + 0xbc);
- m_sreg[ES].flags = READ32(ea + 0xc0) >> 8;
- m_sreg[ES].base = READ32(ea + 0xc4);
- m_sreg[ES].limit = READ32(ea + 0xc8);
- m_CPL = (m_sreg[SS].flags >> 5) & 3; // cpl == dpl of ss
-
- for(int i = 0; i < GS; i++)
- {
- m_sreg[i].valid = (m_sreg[i].flags & 0x80) ? true : false;
- m_sreg[i].d = (m_sreg[i].flags & 0x4000) ? 1 : 0;
- }
- CHANGE_PC(m_eip);
+ fatalerror("i386: LOADALL unimplemented at %08X\n", m_pc - 1);
}
void i386_device::i386_invalid()
diff --git a/src/devices/cpu/i386/i386priv.h b/src/devices/cpu/i386/i386priv.h
index 0a471adfe36..9913d851fa2 100644
--- a/src/devices/cpu/i386/i386priv.h
+++ b/src/devices/cpu/i386/i386priv.h
@@ -486,7 +486,7 @@ int i386_device::translate_address(int pl, int type, UINT32 *address, UINT32 *er
if(!(m_cr[0] & 0x80000000)) // Some (very few) old OS's won't work with this
return TRUE;
- const vtlb_entry *table = vtlb_table();
+ const vtlb_entry *table = vtlb_table(m_vtlb);
UINT32 index = *address >> 12;
vtlb_entry entry = table[index];
if(type == TRANSLATE_FETCH)
@@ -506,7 +506,7 @@ int i386_device::translate_address(int pl, int type, UINT32 *address, UINT32 *er
*error |= 1;
return FALSE;
}
- vtlb_dynload(index, *address, entry);
+ vtlb_dynload(m_vtlb, index, *address, entry);
return TRUE;
}
if(!(entry & (1 << type)))
@@ -557,7 +557,7 @@ UINT16 i386_device::FETCH16()
UINT16 value;
UINT32 address = m_pc, error;
- if( !WORD_ALIGNED(address) ) { /* Unaligned read */
+ if( address & 0x1 ) { /* Unaligned read */
value = (FETCH() << 0);
value |= (FETCH() << 8);
} else {
@@ -575,7 +575,7 @@ UINT32 i386_device::FETCH32()
UINT32 value;
UINT32 address = m_pc, error;
- if( !DWORD_ALIGNED(m_pc) ) { /* Unaligned read */
+ if( m_pc & 0x3 ) { /* Unaligned read */
value = (FETCH() << 0);
value |= (FETCH() << 8);
value |= (FETCH() << 16);
@@ -607,7 +607,7 @@ UINT16 i386_device::READ16(UINT32 ea)
UINT16 value;
UINT32 address = ea, error;
- if( !WORD_ALIGNED(ea) ) { /* Unaligned read */
+ if( ea & 0x1 ) { /* Unaligned read */
value = (READ8( address+0 ) << 0);
value |= (READ8( address+1 ) << 8);
} else {
@@ -624,7 +624,7 @@ UINT32 i386_device::READ32(UINT32 ea)
UINT32 value;
UINT32 address = ea, error;
- if( !DWORD_ALIGNED(ea) ) { /* Unaligned read */
+ if( ea & 0x3 ) { /* Unaligned read */
value = (READ8( address+0 ) << 0);
value |= (READ8( address+1 ) << 8);
value |= (READ8( address+2 ) << 16),
@@ -644,7 +644,7 @@ UINT64 i386_device::READ64(UINT32 ea)
UINT64 value;
UINT32 address = ea, error;
- if( !QWORD_ALIGNED(ea) ) { /* Unaligned read */
+ if( ea & 0x7 ) { /* Unaligned read */
value = (((UINT64) READ8( address+0 )) << 0);
value |= (((UINT64) READ8( address+1 )) << 8);
value |= (((UINT64) READ8( address+2 )) << 16);
@@ -678,7 +678,7 @@ UINT16 i386_device::READ16PL0(UINT32 ea)
UINT16 value;
UINT32 address = ea, error;
- if( !WORD_ALIGNED(ea) ) { /* Unaligned read */
+ if( ea & 0x1 ) { /* Unaligned read */
value = (READ8PL0( address+0 ) << 0);
value |= (READ8PL0( address+1 ) << 8);
} else {
@@ -696,7 +696,7 @@ UINT32 i386_device::READ32PL0(UINT32 ea)
UINT32 value;
UINT32 address = ea, error;
- if( !DWORD_ALIGNED(ea) ) { /* Unaligned read */
+ if( ea & 0x3 ) { /* Unaligned read */
value = (READ8PL0( address+0 ) << 0);
value |= (READ8PL0( address+1 ) << 8);
value |= (READ8PL0( address+2 ) << 16);
@@ -732,7 +732,7 @@ void i386_device::WRITE16(UINT32 ea, UINT16 value)
{
UINT32 address = ea, error;
- if( !WORD_ALIGNED(ea) ) { /* Unaligned write */
+ if( ea & 0x1 ) { /* Unaligned write */
WRITE8( address+0, value & 0xff );
WRITE8( address+1, (value >> 8) & 0xff );
} else {
@@ -747,7 +747,7 @@ void i386_device::WRITE32(UINT32 ea, UINT32 value)
{
UINT32 address = ea, error;
- if( !DWORD_ALIGNED(ea) ) { /* Unaligned write */
+ if( ea & 0x3 ) { /* Unaligned write */
WRITE8( address+0, value & 0xff );
WRITE8( address+1, (value >> 8) & 0xff );
WRITE8( address+2, (value >> 16) & 0xff );
@@ -765,7 +765,7 @@ void i386_device::WRITE64(UINT32 ea, UINT64 value)
{
UINT32 address = ea, error;
- if( !QWORD_ALIGNED(ea) ) { /* Unaligned write */
+ if( ea & 0x7 ) { /* Unaligned write */
WRITE8( address+0, value & 0xff );
WRITE8( address+1, (value >> 8) & 0xff );
WRITE8( address+2, (value >> 16) & 0xff );
@@ -1000,23 +1000,6 @@ void i386_device::PUSH32(UINT32 value)
REG16(SP) = new_esp;
}
}
-
-void i386_device::PUSH32SEG(UINT32 value)
-{
- UINT32 ea, new_esp;
- if( STACK_32BIT ) {
- new_esp = REG32(ESP) - 4;
- ea = i386_translate(SS, new_esp, 1);
- ((m_cpu_version & 0xf00) == 0x300) ? WRITE16(ea, value) : WRITE32(ea, value ); // 486 also?
- REG32(ESP) = new_esp;
- } else {
- new_esp = (REG16(SP) - 4) & 0xffff;
- ea = i386_translate(SS, new_esp, 1);
- ((m_cpu_version & 0xf00) == 0x300) ? WRITE16(ea, value) : WRITE32(ea, value );
- REG16(SP) = new_esp;
- }
-}
-
void i386_device::PUSH8(UINT8 value)
{
if( m_operand_size ) {
diff --git a/src/devices/cpu/i386/i486ops.inc b/src/devices/cpu/i386/i486ops.inc
index 8be406692d4..d22f6c079c3 100644
--- a/src/devices/cpu/i386/i486ops.inc
+++ b/src/devices/cpu/i386/i486ops.inc
@@ -312,7 +312,7 @@ void i386_device::i486_group0F01_16() // Opcode 0x0f 01
}
ea = GetEA(modrm,-1);
CYCLES(25); // TODO: add to cycles.h
- vtlb_flush_address(ea);
+ vtlb_flush_address(m_vtlb, ea);
break;
}
default:
@@ -430,7 +430,7 @@ void i386_device::i486_group0F01_32() // Opcode 0x0f 01
}
ea = GetEA(modrm,-1);
CYCLES(25); // TODO: add to cycles.h
- vtlb_flush_address(ea);
+ vtlb_flush_address(m_vtlb, ea);
break;
}
default:
@@ -500,12 +500,12 @@ void i386_device::i486_mov_cr_r32() // Opcode 0x0f 22
case 0:
CYCLES(CYCLES_MOV_REG_CR0);
if((oldcr ^ m_cr[cr]) & 0x80010000)
- vtlb_flush_dynamic();
+ vtlb_flush_dynamic(m_vtlb);
break;
case 2: CYCLES(CYCLES_MOV_REG_CR2); break;
case 3:
CYCLES(CYCLES_MOV_REG_CR3);
- vtlb_flush_dynamic();
+ vtlb_flush_dynamic(m_vtlb);
break;
case 4: CYCLES(1); break; // TODO
default: