#define U64(v) UINT64(v)
-#define fatalerror(...) exit(1)
+//#define fatalerror(...) exit(1)
+#define fatalerror(...)
#define logerror(...)
#define popmessage(...)
void i386_vtlb_free(void);
void i386_free_state(void);
+ i386_state *get_cpu_state(void) { return cpustate; }
int get_extra_clock() { return cpustate->extra_cycles; }
void set_extra_clock(int n) { cpustate->extra_cycles += n; }
}
virtual bool write_debug_reg(const _TCHAR *reg, uint32_t data) { return false; }
- virtual void get_debug_regs_info(_TCHAR *buffer, size_t buffer_len) {};
+
virtual int debug_dasm(uint32_t pc, _TCHAR *buffer, size_t buffer_len) { return 0;}
+ void vtlb_flush_dynamic(void) { vtlb_flush_dynamic(cpustate->vtlb); }
void save_state(FILEIO *state_fio);
bool load_state(FILEIO *state_fio);
INLINE void PUSH16(UINT16 value);
INLINE UINT16 POP16();
INLINE void PUSH32(UINT32 value);
+ INLINE void PUSH32SEG(UINT32 value);
INLINE UINT32 POP32();
INLINE UINT8 OR8(UINT8 dst, UINT8 src);
UINT16 value;
UINT32 address = cpustate->pc, error;
- if( address & 0x1 ) { /* Unaligned read */
+ if( !WORD_ALIGNED(address) ) { /* Unaligned read */
value = (FETCH() << 0);
value |= (FETCH() << 8);
} else {
UINT32 value;
UINT32 address = cpustate->pc, error;
- if( cpustate->pc & 0x3 ) { /* Unaligned read */
+ if( !DWORD_ALIGNED(cpustate->pc) ) { /* Unaligned read */
value = (FETCH() << 0);
value |= (FETCH() << 8);
value |= (FETCH() << 16);
UINT16 value;
UINT32 address = ea, error;
- if( ea & 0x1 ) { /* Unaligned read */
+ if( !WORD_ALIGNED(ea) ) { /* Unaligned read */
value = (READ8(address+0) << 0);
value |= (READ8(address+1) << 8);
} else {
UINT32 value;
UINT32 address = ea, error;
- if( ea & 0x3 ) { /* Unaligned read */
+ if( !DWORD_ALIGNED(ea) ) { /* Unaligned read */
value = (READ8(address+0) << 0);
value |= (READ8(address+1) << 8);
value |= (READ8(address+2) << 16),
UINT64 value;
UINT32 address = ea, error;
- if( ea & 0x7 ) { /* Unaligned read */
+ if( !QWORD_ALIGNED(ea) ) { /* Unaligned read */
value = (((UINT64) READ8( address+0 )) << 0);
value |= (((UINT64) READ8( address+1 )) << 8);
value |= (((UINT64) READ8( address+2 )) << 16);
UINT16 value;
UINT32 address = ea, error;
- if( ea & 0x1 ) { /* Unaligned read */
+ if( !WORD_ALIGNED(ea) ) { /* Unaligned read */
value = (READ8PL0( address+0 ) << 0);
value |= (READ8PL0( address+1 ) << 8);
} else {
UINT32 value;
UINT32 address = ea, error;
- if( ea & 0x3 ) { /* Unaligned read */
+ if( !DWORD_ALIGNED(ea) ) { /* Unaligned read */
value = (READ8PL0( address+0 ) << 0);
value |= (READ8PL0( address+1 ) << 8);
value |= (READ8PL0( address+2 ) << 16);
{
UINT32 address = ea, error;
- if( ea & 0x1 ) { /* Unaligned write */
+ if( !WORD_ALIGNED(ea) ) { /* Unaligned write */
WRITE8( address+0, value & 0xff );
WRITE8( address+1, (value >> 8) & 0xff );
} else {
{
UINT32 address = ea, error;
- if( ea & 0x3 ) { /* Unaligned write */
+ if( !DWORD_ALIGNED(ea) ) { /* Unaligned write */
WRITE8( address+0, value & 0xff );
WRITE8( address+1, (value >> 8) & 0xff );
WRITE8( address+2, (value >> 16) & 0xff );
{
UINT32 address = ea, error;
- if( ea & 0x7 ) { /* Unaligned write */
+ if( !QWORD_ALIGNED(ea) ) { /* Unaligned write */
WRITE8( address+0, value & 0xff );
WRITE8( address+1, (value >> 8) & 0xff );
WRITE8( address+2, (value >> 16) & 0xff );
REG16(SP) = new_esp;
}
}
+
+INLINE void I386_OPS_BASE::PUSH32SEG(UINT32 value)
+{
+ UINT32 ea, new_esp;
+ if( STACK_32BIT ) {
+ new_esp = REG32(ESP) - 4;
+ ea = i386_translate(SS, new_esp, 1);
+ ((cpustate->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);
+ ((cpustate->cpu_version & 0xf00) == 0x300) ? WRITE16(ea, value) : WRITE32(ea, value );
+ REG16(SP) = new_esp;
+ }
+}
+
INLINE void I386_OPS_BASE::PUSH8(UINT8 value)
{
if( cpustate->operand_size ) {