summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/i386/i386.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/i386/i386.h')
-rw-r--r--src/devices/cpu/i386/i386.h85
1 files changed, 65 insertions, 20 deletions
diff --git a/src/devices/cpu/i386/i386.h b/src/devices/cpu/i386/i386.h
index e6fda6278bc..7889ce5f0a8 100644
--- a/src/devices/cpu/i386/i386.h
+++ b/src/devices/cpu/i386/i386.h
@@ -6,13 +6,12 @@
#pragma once
// SoftFloat 2 lacks an include guard
-#ifndef softfloat_h
-#define softfloat_h 1
+#ifndef softfloat2_h
+#define softfloat2_h 1
#include "softfloat/milieu.h"
#include "softfloat/softfloat.h"
#endif
-#include "debug/debugcpu.h"
#include "divtlb.h"
#include "i386dasm.h"
@@ -36,11 +35,11 @@ public:
auto smiact() { return m_smiact.bind(); }
auto ferr() { return m_ferr_handler.bind(); }
- uint64_t debug_segbase(symbol_table &table, int params, const uint64_t *param);
- uint64_t debug_seglimit(symbol_table &table, int params, const uint64_t *param);
- uint64_t debug_segofftovirt(symbol_table &table, int params, const uint64_t *param);
- uint64_t debug_virttophys(symbol_table &table, int params, const uint64_t *param);
- uint64_t debug_cacheflush(symbol_table &table, int params, const uint64_t *param);
+ uint64_t debug_segbase(int params, const uint64_t *param);
+ uint64_t debug_seglimit(int params, const uint64_t *param);
+ uint64_t debug_segofftovirt(int params, const uint64_t *param);
+ uint64_t debug_virttophys(int params, const uint64_t *param);
+ uint64_t debug_cacheflush(int params, const uint64_t *param);
protected:
i386_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int program_data_width, int program_addr_width, int io_data_width);
@@ -60,7 +59,7 @@ protected:
// device_memory_interface overrides
virtual space_config_vector memory_space_config() const override;
- virtual bool memory_translate(int spacenum, int intention, offs_t &address) override;
+ virtual bool memory_translate(int spacenum, int intention, offs_t &address, address_space *&target_space) override;
// device_state_interface overrides
virtual void state_import(const device_state_entry &entry) override;
@@ -90,9 +89,9 @@ protected:
virtual void cache_clean() {}
// routine to access memory
- virtual u8 mem_pr8(offs_t address) { return macache32->read_byte(address); }
- virtual u16 mem_pr16(offs_t address) { return macache32->read_word(address); }
- virtual u32 mem_pr32(offs_t address) { return macache32->read_dword(address); }
+ virtual u8 mem_pr8(offs_t address) { return macache32.read_byte(address); }
+ virtual u16 mem_pr16(offs_t address) { return macache32.read_word(address); }
+ virtual u32 mem_pr32(offs_t address) { return macache32.read_dword(address); }
address_space_config m_program_config;
address_space_config m_io_config;
@@ -228,6 +227,46 @@ protected:
FF_SSE3 = 1 << 0, // SSE3 Extensions
};
+ enum CR0_BITS : uint32_t {
+ CR0_PG = (u32)1 << 31, // Paging
+ CR0_CD = 1 << 30, // Cache disable
+ CR0_NW = 1 << 29, // Not writethrough
+ CR0_AM = 1 << 18, // Alignment mask
+ CR0_WP = 1 << 16, // Write protect
+ CR0_NE = 1 << 5, // Numeric error
+ CR0_ET = 1 << 4, // Extension type
+ CR0_TS = 1 << 3, // Task switched
+ CR0_EM = 1 << 2, // Emulation
+ CR0_MP = 1 << 1, // Monitor coprocessor
+ CR0_PE = 1 << 0, // Protection enabled
+ };
+
+ enum CR3_BITS : uint32_t {
+ CR3_PCD = 1 << 4,
+ CR3_PWT = 1 << 3,
+ };
+
+ enum CR4_BITS : uint32_t {
+ CR4_SMAP = 1 << 21,
+ CR4_SMEP = 1 << 20,
+ CR4_OSXSAVE = 1 << 18,
+ CR4_PCIDE = 1 << 17,
+ CR4_FSGSBASE = 1 << 16,
+ CR4_SMXE = 1 << 14,
+ CR4_VMXE = 1 << 13,
+ CR4_OSXMMEXCPT = 1 << 10,
+ CR4_OSFXSR = 1 << 9,
+ CR4_PCE = 1 << 8,
+ CR4_PGE = 1 << 7,
+ CR4_MCE = 1 << 6,
+ CR4_PAE = 1 << 5,
+ CR4_PSE = 1 << 4,
+ CR4_DE = 1 << 3,
+ CR4_TSD = 1 << 2,
+ CR4_PVI = 1 << 1,
+ CR4_VME = 1 << 0,
+ };
+
typedef void (i386_device::*i386_modrm_func)(uint8_t modrm);
typedef void (i386_device::*i386_op_func)();
struct X86_OPCODE {
@@ -275,8 +314,9 @@ protected:
uint32_t m_dr[8]; // Debug registers
uint32_t m_tr[8]; // Test registers
- memory_passthrough_handler* m_dr_breakpoints[4];
- int m_notifier;
+ memory_passthrough_handler m_dr_breakpoints[4];
+ util::notifier_subscription m_notifier;
+ bool m_dri_changed_active;
//386 Debug Register change handlers.
inline void dri_changed();
@@ -308,8 +348,8 @@ protected:
address_space *m_program;
address_space *m_io;
uint32_t m_a20_mask;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *macache16;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *macache32;
+ memory_access<32, 1, 0, ENDIANNESS_LITTLE>::cache macache16;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache macache32;
int m_cpuid_max_input_value_eax; // Highest CPUID standard function available
uint32_t m_cpuid_id0, m_cpuid_id1, m_cpuid_id2;
@@ -387,6 +427,8 @@ protected:
uint8_t m_opcode_bytes[16];
uint32_t m_opcode_pc;
int m_opcode_bytes_length;
+ offs_t m_opcode_addrs[16];
+ uint32_t m_opcode_addrs_index;
uint64_t m_debugger_temp;
@@ -395,7 +437,7 @@ protected:
void register_state_i386_x87_xmm();
uint32_t i386_translate(int segment, uint32_t ip, int rwn);
inline vtlb_entry get_permissions(uint32_t pte, int wp);
- bool i386_translate_address(int intention, offs_t *address, vtlb_entry *entry);
+ bool i386_translate_address(int intention, bool debug, offs_t *address, vtlb_entry *entry);
bool translate_address(int pl, int type, uint32_t *address, uint32_t *error);
void CHANGE_PC(uint32_t pc);
inline void NEAR_BRANCH(int32_t offs);
@@ -1357,6 +1399,7 @@ protected:
inline void x87_set_stack_overflow();
int x87_inc_stack();
int x87_dec_stack();
+ int x87_ck_over_stack();
int x87_check_exceptions(bool store = false);
int x87_mf_fault();
inline void x87_write_cw(uint16_t cw);
@@ -1529,9 +1572,9 @@ public:
i386sx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
- virtual u8 mem_pr8(offs_t address) override { return macache16->read_byte(address); };
- virtual u16 mem_pr16(offs_t address) override { return macache16->read_word(address); };
- virtual u32 mem_pr32(offs_t address) override { return macache16->read_dword(address); };
+ virtual u8 mem_pr8(offs_t address) override { return macache16.read_byte(address); }
+ virtual u16 mem_pr16(offs_t address) override { return macache16.read_word(address); }
+ virtual u32 mem_pr32(offs_t address) override { return macache16.read_dword(address); }
virtual uint16_t READ16PL(uint32_t ea, uint8_t privilege) override;
virtual uint32_t READ32PL(uint32_t ea, uint8_t privilege) override;
@@ -1648,6 +1691,8 @@ public:
protected:
virtual void device_start() override;
virtual void device_reset() override;
+
+ virtual void opcode_cpuid() override;
};