2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2009-03-23 00:12:35 +03:00
|
|
|
// $Id: lazy_flags.cc,v 1.52 2009-03-22 21:12:35 sshwarts Exp $
|
2001-10-03 17:10:38 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2001-04-10 06:20:02 +04:00
|
|
|
// Copyright (C) 2001 MandrakeSoft S.A.
|
2001-04-10 05:04:59 +04:00
|
|
|
//
|
|
|
|
// MandrakeSoft S.A.
|
|
|
|
// 43, rue d'Aboukir
|
|
|
|
// 75002 Paris - France
|
|
|
|
// http://www.linux-mandrake.com/
|
|
|
|
// http://www.mandrakesoft.com/
|
|
|
|
//
|
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
2009-01-16 21:18:59 +03:00
|
|
|
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA B 02110-1301 USA
|
2005-10-14 00:21:35 +04:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2001-05-24 22:46:34 +04:00
|
|
|
#define NEED_CPU_REG_SHORTCUTS 1
|
2001-04-10 05:04:59 +04:00
|
|
|
#include "bochs.h"
|
2006-03-07 01:03:16 +03:00
|
|
|
#include "cpu.h"
|
merge in BRANCH-io-cleanup.
To see the commit logs for this use either cvsweb or
cvs update -r BRANCH-io-cleanup and then 'cvs log' the various files.
In general this provides a generic interface for logging.
logfunctions:: is a class that is inherited by some classes, and also
. allocated as a standalone global called 'genlog'. All logging uses
. one of the ::info(), ::error(), ::ldebug(), ::panic() methods of this
. class through 'BX_INFO(), BX_ERROR(), BX_DEBUG(), BX_PANIC()' macros
. respectively.
.
. An example usage:
. BX_INFO(("Hello, World!\n"));
iofunctions:: is a class that is allocated once by default, and assigned
as the iofunction of each logfunctions instance. It is this class that
maintains the file descriptor and other output related code, at this
point using vfprintf(). At some future point, someone may choose to
write a gui 'console' for bochs to which messages would be redirected
simply by assigning a different iofunction class to the various logfunctions
objects.
More cleanup is coming, but this works for now. If you want to see alot
of debugging output, in main.cc, change onoff[LOGLEV_DEBUG]=0 to =1.
Comments, bugs, flames, to me: todd@fries.net
2001-05-15 18:49:57 +04:00
|
|
|
#define LOG_THIS BX_CPU_THIS_PTR
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2005-10-20 21:33:36 +04:00
|
|
|
// This array defines a look-up table for the even parity-ness
|
|
|
|
// of an 8bit quantity, for optimal assignment of the parity bit
|
|
|
|
// in the EFLAGS register
|
2008-09-06 22:21:29 +04:00
|
|
|
const Bit8u bx_parity_lookup[256] = {
|
2005-10-20 21:33:36 +04:00
|
|
|
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
|
|
|
|
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
|
|
|
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
|
|
|
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
|
|
|
|
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
|
|
|
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
|
|
|
|
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
|
|
|
|
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
|
|
|
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
|
|
|
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
|
|
|
|
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
|
|
|
|
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
|
|
|
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1,
|
|
|
|
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
|
|
|
0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0,
|
|
|
|
1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 1
|
|
|
|
};
|
2005-10-14 00:21:35 +04:00
|
|
|
|
2008-05-04 19:07:08 +04:00
|
|
|
#define op1_8 ((Bit8u)(BX_CPU_THIS_PTR oszapc.op1))
|
|
|
|
#define op2_8 ((Bit8u)(BX_CPU_THIS_PTR oszapc.op2))
|
|
|
|
#define result_8 ((Bit8u)(BX_CPU_THIS_PTR oszapc.result))
|
|
|
|
|
|
|
|
#define op1_16 ((Bit16u)(BX_CPU_THIS_PTR oszapc.op1))
|
|
|
|
#define op2_16 ((Bit16u)(BX_CPU_THIS_PTR oszapc.op2))
|
2007-12-05 09:17:09 +03:00
|
|
|
#define result_16 ((Bit16u)(BX_CPU_THIS_PTR oszapc.result))
|
2008-05-04 19:07:08 +04:00
|
|
|
|
|
|
|
#define op1_32 ((Bit32u)(BX_CPU_THIS_PTR oszapc.op1))
|
|
|
|
#define op2_32 ((Bit32u)(BX_CPU_THIS_PTR oszapc.op2))
|
2007-12-05 09:17:09 +03:00
|
|
|
#define result_32 ((Bit32u)(BX_CPU_THIS_PTR oszapc.result))
|
2008-05-04 19:07:08 +04:00
|
|
|
|
|
|
|
#if BX_SUPPORT_X86_64
|
2009-03-23 00:12:35 +03:00
|
|
|
#define op1_64 ((Bit64u)(BX_CPU_THIS_PTR oszapc.op1))
|
|
|
|
#define op2_64 ((Bit64u)(BX_CPU_THIS_PTR oszapc.op2))
|
|
|
|
#define result_64 ((Bit64u)(BX_CPU_THIS_PTR oszapc.result))
|
2008-05-04 19:07:08 +04:00
|
|
|
#endif
|
2007-11-19 22:55:09 +03:00
|
|
|
|
2004-08-10 01:28:47 +04:00
|
|
|
bx_bool BX_CPU_C::get_CFLazy(void)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
2002-09-08 08:08:14 +04:00
|
|
|
unsigned cf;
|
|
|
|
|
2007-03-18 22:29:17 +03:00
|
|
|
switch (BX_CPU_THIS_PTR oszapc.instr) {
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_ADD8:
|
|
|
|
case BX_LF_INSTR_ADD16:
|
|
|
|
case BX_LF_INSTR_ADD32:
|
2009-03-23 00:12:35 +03:00
|
|
|
cf = (result_32 < op1_32);
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_ADD64:
|
2009-03-23 00:12:35 +03:00
|
|
|
cf = (result_64 < op1_64);
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2007-03-18 22:29:17 +03:00
|
|
|
// used only if CF = 1 when executing ADC instruction
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_ADC8:
|
|
|
|
case BX_LF_INSTR_ADC16:
|
|
|
|
case BX_LF_INSTR_ADC32:
|
2009-03-23 00:12:35 +03:00
|
|
|
cf = (result_32 <= op1_32);
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2007-03-18 22:29:17 +03:00
|
|
|
// used only if CF = 1 when executing ADC instruction
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_ADC64:
|
2009-03-23 00:12:35 +03:00
|
|
|
cf = (result_64 <= op1_64);
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_SUB8:
|
|
|
|
case BX_LF_INSTR_SUB16:
|
|
|
|
case BX_LF_INSTR_SUB32:
|
2008-05-04 19:07:08 +04:00
|
|
|
cf = (op1_32 < op2_32);
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_SUB64:
|
2008-05-04 19:07:08 +04:00
|
|
|
cf = (op1_64 < op2_64);
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2007-03-18 22:29:17 +03:00
|
|
|
// used only if CF = 1 when executing SBB instruction
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_SBB8:
|
2008-05-04 19:07:08 +04:00
|
|
|
cf = (op1_8 < result_8) || (op2_8==0xff);
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
|
|
|
// used only if CF = 1 when executing SBB instruction
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_SBB16:
|
2008-05-04 19:07:08 +04:00
|
|
|
cf = (op1_16 < result_16) || (op2_16==0xffff);
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
|
|
|
// used only if CF = 1 when executing SBB instruction
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_SBB32:
|
2008-05-04 19:07:08 +04:00
|
|
|
cf = (op1_32 < result_32) || (op2_32==0xffffffff);
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2007-03-18 22:29:17 +03:00
|
|
|
// used only if CF = 1 when executing SBB instruction
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_SBB64:
|
2008-05-04 19:07:08 +04:00
|
|
|
cf = (op1_64 < result_64) || (op2_64==BX_CONST64(0xffffffffffffffff));
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_NEG8:
|
|
|
|
case BX_LF_INSTR_NEG16:
|
|
|
|
case BX_LF_INSTR_NEG32:
|
2007-12-05 09:17:09 +03:00
|
|
|
cf = (result_32 != 0);
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_NEG64:
|
2007-12-05 09:17:09 +03:00
|
|
|
cf = (result_64 != 0);
|
2007-03-18 22:29:17 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_LOGIC8:
|
|
|
|
case BX_LF_INSTR_LOGIC16:
|
|
|
|
case BX_LF_INSTR_LOGIC32:
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_LOGIC64:
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2007-03-18 22:29:17 +03:00
|
|
|
cf = 0;
|
|
|
|
break;
|
2001-04-10 05:04:59 +04:00
|
|
|
default:
|
2007-03-18 22:29:17 +03:00
|
|
|
cf = 0; // Keep compiler quiet.
|
|
|
|
BX_PANIC(("get_CF: OSZAPC: unknown instr %u",
|
|
|
|
(unsigned) BX_CPU_THIS_PTR oszapc.instr));
|
2005-10-14 00:21:35 +04:00
|
|
|
}
|
2008-02-03 00:46:54 +03:00
|
|
|
|
2007-03-18 22:29:17 +03:00
|
|
|
return(cf);
|
2001-04-10 05:04:59 +04:00
|
|
|
}
|
|
|
|
|
2004-08-10 01:28:47 +04:00
|
|
|
bx_bool BX_CPU_C::get_AFLazy(void)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
2002-09-08 08:08:14 +04:00
|
|
|
unsigned af;
|
|
|
|
|
2007-12-04 22:27:23 +03:00
|
|
|
switch (BX_CPU_THIS_PTR oszapc.instr) {
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_ADD8:
|
|
|
|
case BX_LF_INSTR_ADC8:
|
2009-03-13 21:26:10 +03:00
|
|
|
case BX_LF_INSTR_SUB8:
|
|
|
|
case BX_LF_INSTR_SBB8:
|
2009-03-23 00:12:35 +03:00
|
|
|
case BX_LF_INSTR_ADD16:
|
|
|
|
case BX_LF_INSTR_ADC16:
|
2009-03-13 21:26:10 +03:00
|
|
|
case BX_LF_INSTR_SUB16:
|
|
|
|
case BX_LF_INSTR_SBB16:
|
2009-03-23 00:12:35 +03:00
|
|
|
case BX_LF_INSTR_ADD32:
|
|
|
|
case BX_LF_INSTR_ADC32:
|
2009-03-13 21:26:10 +03:00
|
|
|
case BX_LF_INSTR_SUB32:
|
|
|
|
case BX_LF_INSTR_SBB32:
|
|
|
|
#if BX_SUPPORT_X86_64
|
2009-03-23 00:12:35 +03:00
|
|
|
case BX_LF_INSTR_ADD64:
|
|
|
|
case BX_LF_INSTR_ADC64:
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_SUB64:
|
|
|
|
case BX_LF_INSTR_SBB64:
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2008-05-04 19:07:08 +04:00
|
|
|
af = ((op1_8 ^ op2_8) ^ result_8) & 0x10;
|
|
|
|
break;
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_NEG8:
|
|
|
|
case BX_LF_INSTR_NEG16:
|
|
|
|
case BX_LF_INSTR_NEG32:
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_NEG64:
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2007-12-05 09:17:09 +03:00
|
|
|
af = (result_8 & 0xf) != 0;
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_INC8:
|
|
|
|
case BX_LF_INSTR_INC16:
|
|
|
|
case BX_LF_INSTR_INC32:
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_INC64:
|
2007-11-19 22:55:09 +03:00
|
|
|
#endif
|
2007-12-05 09:17:09 +03:00
|
|
|
af = (result_8 & 0xf) == 0;
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_DEC8:
|
|
|
|
case BX_LF_INSTR_DEC16:
|
|
|
|
case BX_LF_INSTR_DEC32:
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_DEC64:
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2007-12-05 09:17:09 +03:00
|
|
|
af = (result_8 & 0xf) == 0xf;
|
|
|
|
break;
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_LOGIC8:
|
|
|
|
case BX_LF_INSTR_LOGIC16:
|
|
|
|
case BX_LF_INSTR_LOGIC32:
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_LOGIC64:
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2007-12-04 22:27:23 +03:00
|
|
|
af = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
af = 0; // Keep compiler quiet.
|
|
|
|
BX_PANIC(("get_AF: OSZAPC: unknown instr %u", (unsigned) BX_CPU_THIS_PTR oszapc.instr));
|
|
|
|
}
|
2007-12-05 09:17:09 +03:00
|
|
|
|
2007-12-04 22:27:23 +03:00
|
|
|
return(af);
|
2001-04-10 05:04:59 +04:00
|
|
|
}
|
|
|
|
|
2006-05-12 21:04:19 +04:00
|
|
|
#define GET_ADD_OVERFLOW(op1, op2, result, mask) \
|
|
|
|
(((~((op1) ^ (op2)) & ((op2) ^ (result))) & (mask)) != 0)
|
|
|
|
|
|
|
|
#define GET_SUB_OVERFLOW(op1, op2, result, mask) \
|
|
|
|
(((((op1) ^ (op2)) & ((op1) ^ (result))) & (mask)) != 0)
|
|
|
|
|
2004-08-10 01:28:47 +04:00
|
|
|
bx_bool BX_CPU_C::get_OFLazy(void)
|
2001-04-10 05:04:59 +04:00
|
|
|
{
|
2002-09-08 08:08:14 +04:00
|
|
|
unsigned of;
|
2001-04-10 05:04:59 +04:00
|
|
|
|
2007-12-04 22:27:23 +03:00
|
|
|
switch (BX_CPU_THIS_PTR oszapc.instr) {
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_ADD8:
|
|
|
|
case BX_LF_INSTR_ADC8:
|
|
|
|
case BX_LF_INSTR_ADD16:
|
|
|
|
case BX_LF_INSTR_ADC16:
|
|
|
|
case BX_LF_INSTR_ADD32:
|
|
|
|
case BX_LF_INSTR_ADC32:
|
2008-05-04 19:07:08 +04:00
|
|
|
of = GET_ADD_OVERFLOW(op1_32, op2_32, result_32, 0x80000000);
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_ADD64:
|
|
|
|
case BX_LF_INSTR_ADC64:
|
2008-05-04 19:07:08 +04:00
|
|
|
of = GET_ADD_OVERFLOW(op1_64, op2_64, result_64, BX_CONST64(0x8000000000000000));
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_SUB8:
|
|
|
|
case BX_LF_INSTR_SBB8:
|
|
|
|
case BX_LF_INSTR_SUB16:
|
|
|
|
case BX_LF_INSTR_SBB16:
|
|
|
|
case BX_LF_INSTR_SUB32:
|
|
|
|
case BX_LF_INSTR_SBB32:
|
2008-05-04 19:07:08 +04:00
|
|
|
of = GET_SUB_OVERFLOW(op1_32, op2_32, result_32, 0x80000000);
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_SUB64:
|
|
|
|
case BX_LF_INSTR_SBB64:
|
2008-05-04 19:07:08 +04:00
|
|
|
of = GET_SUB_OVERFLOW(op1_64, op2_64, result_64, BX_CONST64(0x8000000000000000));
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_LOGIC8:
|
|
|
|
case BX_LF_INSTR_LOGIC16:
|
|
|
|
case BX_LF_INSTR_LOGIC32:
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_LOGIC64:
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2007-12-04 22:27:23 +03:00
|
|
|
of = 0;
|
|
|
|
break;
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_NEG8:
|
|
|
|
case BX_LF_INSTR_INC8:
|
2008-05-07 00:29:26 +04:00
|
|
|
of = (result_8 == 0x80);
|
|
|
|
break;
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_NEG16:
|
|
|
|
case BX_LF_INSTR_INC16:
|
2008-05-07 00:29:26 +04:00
|
|
|
of = (result_16 == 0x8000);
|
|
|
|
break;
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_NEG32:
|
|
|
|
case BX_LF_INSTR_INC32:
|
2007-12-05 09:17:09 +03:00
|
|
|
of = (result_32 == 0x80000000);
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_NEG64:
|
|
|
|
case BX_LF_INSTR_INC64:
|
2007-12-05 09:17:09 +03:00
|
|
|
of = (result_64 == BX_CONST64(0x8000000000000000));
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_DEC8:
|
2007-12-05 09:17:09 +03:00
|
|
|
of = (result_8 == 0x7F);
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_DEC16:
|
2007-12-05 09:17:09 +03:00
|
|
|
of = (result_16 == 0x7FFF);
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_DEC32:
|
2007-12-05 09:17:09 +03:00
|
|
|
of = (result_32 == 0x7FFFFFFF);
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#if BX_SUPPORT_X86_64
|
2008-04-05 02:39:45 +04:00
|
|
|
case BX_LF_INSTR_DEC64:
|
2007-12-05 09:17:09 +03:00
|
|
|
of = (result_64 == BX_CONST64(0x7FFFFFFFFFFFFFFF));
|
2007-12-04 22:27:23 +03:00
|
|
|
break;
|
2002-09-15 04:18:41 +04:00
|
|
|
#endif
|
2007-12-04 22:27:23 +03:00
|
|
|
default:
|
|
|
|
of = 0; // Keep compiler happy.
|
|
|
|
BX_PANIC(("get_OF: OSZAPC: unknown instr"));
|
|
|
|
}
|
2007-12-05 09:17:09 +03:00
|
|
|
|
2007-12-04 22:27:23 +03:00
|
|
|
return(of);
|
2001-04-10 05:04:59 +04:00
|
|
|
}
|