diff --git a/bochs/cpu/access.cc b/bochs/cpu/access.cc index 36f6664bb..57f91cccd 100644 --- a/bochs/cpu/access.cc +++ b/bochs/cpu/access.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: access.cc,v 1.81 2007-12-13 21:30:04 sshwarts Exp $ +// $Id: access.cc,v 1.82 2007-12-16 20:47:09 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -1434,7 +1434,7 @@ accessOK: laddr = seg->cache.u.segment.base + offset; BX_INSTR_MEM_DATA(BX_CPU_ID, laddr, 2, BX_WRITE); #if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK - if (user && BX_CPU_THIS_PTR alignment_check) { + if (BX_CPU_THIS_PTR alignment_check) { if (laddr & 1) { BX_ERROR(("write_new_stack_word(): #AC misaligned access")); exception(BX_AC_EXCEPTION, 0, 0); @@ -1473,7 +1473,7 @@ accessOK: laddr = seg->cache.u.segment.base + offset; BX_INSTR_MEM_DATA(BX_CPU_ID, laddr, 4, BX_WRITE); #if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK - if (user && BX_CPU_THIS_PTR alignment_check) { + if (BX_CPU_THIS_PTR alignment_check) { if (laddr & 3) { BX_ERROR(("write_new_stack_dword(): #AC misaligned access")); exception(BX_AC_EXCEPTION, 0, 0); @@ -1509,7 +1509,7 @@ void BX_CPU_C::write_new_stack_qword(bx_address offset, bx_bool user, Bit64u dat if (IsCanonical(offset)) { BX_INSTR_MEM_DATA(BX_CPU_ID, laddr, 8, BX_WRITE); #if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK - if (user && BX_CPU_THIS_PTR alignment_check) { + if (BX_CPU_THIS_PTR alignment_check) { if (laddr & 7) { BX_ERROR(("write_new_stack_qword(): #AC misaligned access")); exception(BX_AC_EXCEPTION, 0, 0); diff --git a/bochs/cpu/cpu.h b/bochs/cpu/cpu.h index 1372c20ab..d96816674 100644 --- a/bochs/cpu/cpu.h +++ b/bochs/cpu/cpu.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: cpu.h,v 1.392 2007-12-15 17:42:20 sshwarts Exp $ +// $Id: cpu.h,v 1.393 2007-12-16 20:47:09 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -3780,20 +3780,19 @@ IMPLEMENT_EFLAG_ACCESSOR (TF, 8) #define BxImmediate 0x000f // bits 3..0: any immediate #define BxImmediate_Ib 0x0001 // 8 bit #define BxImmediate_Ib_SE 0x0002 // sign extend to OS size -#define BxImmediate_Iw 0x0003 // 16 bit or SSE4A IbIb immediate -#define BxImmediate_IvIw 0x0004 // call_Ap, not encodable in 64-bit mode +#define BxImmediate_Iw 0x0003 // 16 bit +#define BxImmediate_IbIb 0x0004 // SSE4A #define BxImmediate_IwIb 0x0005 // enter_IwIb -#define BxImmediate_Id 0x0006 // 32 bit -#define BxImmediate_O 0x0007 // MOV_ALOd, mov_OdAL, mov_eAXOv, mov_OveAX -#define BxImmediate_BrOff8 0x0008 // Relative branch offset byte -#define BxImmediate_BrOff16 0x0009 // Relative branch offset word, not encodable in 64-bit mode -#define BxImmediate_BrOff32 0x000A // Relative branch offset dword +#define BxImmediate_IvIw 0x0006 // call_Ap, not encodable in 64-bit mode +#define BxImmediate_Id 0x0007 // 32 bit +#define BxImmediate_O 0x0008 // MOV_ALOd, mov_OdAL, mov_eAXOv, mov_OveAX +#define BxImmediate_BrOff8 0x0009 // Relative branch offset byte +#define BxImmediate_BrOff16 0x000A // Relative branch offset word, not encodable in 64-bit mode +#define BxImmediate_BrOff32 0x000B // Relative branch offset dword #if BX_SUPPORT_X86_64 -#define BxImmediate_Iq 0x000B // 64 bit override +#define BxImmediate_Iq 0x000C // 64 bit override #endif -#define BxImmediate_IbIb BxImmediate_Iw - // Lookup for opcode and attributes in another opcode tables // Totally 7 opcode groups supported #define BxGroupX 0x0070 // bits 6..4: opcode groups definition diff --git a/bochs/cpu/fetchdecode.cc b/bochs/cpu/fetchdecode.cc index afecaadfe..9e384b851 100644 --- a/bochs/cpu/fetchdecode.cc +++ b/bochs/cpu/fetchdecode.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: fetchdecode.cc,v 1.150 2007-12-15 17:42:20 sshwarts Exp $ +// $Id: fetchdecode.cc,v 1.151 2007-12-16 20:47:09 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -2840,15 +2840,27 @@ modrm_done: return(0); } break; + case BxImmediate_IbIb: + if (ilen < remain) { + instruction->IxIxForm.Ib = *iptr++; + ilen++; + } + else return(0); + if (ilen < remain) { + instruction->IxIxForm.Ib2 = *iptr; + ilen++; + } + else { + return(0); + } + break; case BxImmediate_IwIb: if ((ilen+1) < remain) { instruction->IxIxForm.Iw = FetchWORD(iptr); iptr += 2; ilen += 2; } - else { - return(0); - } + else return(0); if (ilen < remain) { instruction->IxIxForm.Ib2 = *iptr; ilen++; diff --git a/bochs/cpu/fetchdecode64.cc b/bochs/cpu/fetchdecode64.cc index 298b540d2..bf32ad0b2 100644 --- a/bochs/cpu/fetchdecode64.cc +++ b/bochs/cpu/fetchdecode64.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: fetchdecode64.cc,v 1.158 2007-12-15 17:42:20 sshwarts Exp $ +// $Id: fetchdecode64.cc,v 1.159 2007-12-16 20:47:10 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -3817,6 +3817,20 @@ modrm_done: return(0); } break; + case BxImmediate_IbIb: + if (ilen < remain) { + instruction->IxIxForm.Ib = *iptr++; + ilen++; + } + else return(0); + if (ilen < remain) { + instruction->IxIxForm.Ib2 = *iptr; + ilen++; + } + else { + return(0); + } + break; case BxImmediate_IwIb: if ((ilen+1) < remain) { instruction->IxIxForm.Iw = FetchWORD(iptr); @@ -3852,8 +3866,7 @@ modrm_done: break; case BxImmediate_BrOff8: if (ilen < remain) { - Bit8s temp8s = *iptr; - instruction->modRMForm.Id = temp8s; + instruction->modRMForm.Id = (Bit8s) (*iptr); ilen++; } else {