diff --git a/bochs/cpu/descriptor.h b/bochs/cpu/descriptor.h index 80aeb28f5..a0e71d956 100755 --- a/bochs/cpu/descriptor.h +++ b/bochs/cpu/descriptor.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: descriptor.h,v 1.17 2006-08-31 18:18:15 sshwarts Exp $ +// $Id: descriptor.h,v 1.18 2007-09-26 19:09:10 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -169,9 +169,12 @@ union { #define IS_CODE_SEGMENT(type) (((type) >> 3) & 0x1) #define IS_CODE_SEGMENT_CONFORMING(type) (((type) >> 2) & 0x1) #define IS_DATA_SEGMENT_EXPAND_DOWN(type) (((type) >> 2) & 0x1) -#define IS_CODE_SEGMENT_READABLE(type) (((type) >> 1) & 0x1) -#define IS_DATA_SEGMENT_WRITEABLE(type) (((type) >> 1) & 0x1) -#define IS_SEGMENT_ACCESSED(type) ( (type) & 0x1) + +// readable/writeable bit is ignored when in 64-bit mode +#define IS_CODE_SEGMENT_READABLE(type) (Is64BitMode() || (((type) >> 1) & 0x1)) +#define IS_DATA_SEGMENT_WRITEABLE(type) (Is64BitMode() || (((type) >> 1) & 0x1)) + +#define IS_SEGMENT_ACCESSED(type) ((type) & 0x1) #define BX_SEGMENT_CODE (0x8) #define BX_SEGMENT_DATA_EXPAND_DOWN (0x4) diff --git a/bochs/cpu/iret.cc b/bochs/cpu/iret.cc index 175076c1c..7b852fd2c 100755 --- a/bochs/cpu/iret.cc +++ b/bochs/cpu/iret.cc @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////// -// $Id: iret.cc,v 1.19 2007-09-10 20:47:08 sshwarts Exp $ +// $Id: iret.cc,v 1.20 2007-09-26 19:09:10 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -279,7 +279,7 @@ BX_CPU_C::iret_protected(bxInstruction_c *i) IS_CODE_SEGMENT(ss_descriptor.type) || !IS_DATA_SEGMENT_WRITEABLE(ss_descriptor.type)) { - BX_ERROR(("iret: SS AR byte not writable code segment")); + BX_ERROR(("iret: SS AR byte not writable or code segment")); exception(BX_GP_EXCEPTION, raw_ss_selector & 0xfffc, 0); } @@ -540,7 +540,7 @@ BX_CPU_C::long_iret(bxInstruction_c *i) IS_CODE_SEGMENT(ss_descriptor.type) || !IS_DATA_SEGMENT_WRITEABLE(ss_descriptor.type)) { - BX_ERROR(("iret64: SS AR byte not writable code segment")); + BX_ERROR(("iret64: SS AR byte not writable or code segment: %d", ss_descriptor.type)); exception(BX_GP_EXCEPTION, raw_ss_selector & 0xfffc, 0); }