3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * CPU Instruction Decoding & Execution Tests - First bunch of instructions.
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * Copyright (C) 2014 Oracle Corporation
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * available from http://www.virtualbox.org. This file is free software;
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * you can redistribute it and/or modify it under the terms of the GNU
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * General Public License (GPL) as published by the Free Software
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * The contents of this file may alternatively be used under the terms
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * of the Common Development and Distribution License Version 1.0
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * VirtualBox OSE distribution, in which case the provisions of the
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * CDDL are applicable instead of those of the GPL.
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * You may elect to license modified versions of this file under the
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync * terms and conditions of either the GPL or the CDDL or both.
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync/*******************************************************************************
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync* Header Files *
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync*******************************************************************************/
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync/*******************************************************************************
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync* Defined Constants And Macros *
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync*******************************************************************************/
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync * Shorter defines for the EFLAGS to save table space.
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync/*******************************************************************************
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync* Structures and Typedefs *
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync*******************************************************************************/
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsynctypedef CIDET2IN1OUTWITHFLAGSU8ENTRY const *PCCIDET2IN1OUTWITHFLAGSU8ENTRY;
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsynctypedef CIDET2IN1OUTWITHFLAGSU16ENTRY const *PCCIDET2IN1OUTWITHFLAGSU16ENTRY;
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsynctypedef CIDET2IN1OUTWITHFLAGSU32ENTRY const *PCCIDET2IN1OUTWITHFLAGSU32ENTRY;
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsynctypedef CIDET2IN1OUTWITHFLAGSU64ENTRY const *PCCIDET2IN1OUTWITHFLAGSU64ENTRY;
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync#define CIDET2IN1OUTWITHFLAGS_INITIALIZER(a_fRelevantEFlags) \
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync &s_a8Results[0], &s_a16Results[0], &s_a32Results[0], &s_a64Results[0], \
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync RT_ELEMENTS(s_a8Results), RT_ELEMENTS(s_a16Results), RT_ELEMENTS(s_a32Results), RT_ELEMENTS(s_a64Results), \
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync * Generic worker for a FNCIDETSETUPINOUT function with two GPR/MEM registers,
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync * storing result in the first and flags.
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync * @returns See FNCIDETSETUPINOUT.
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync * @param pThis The core CIDET state structure. The InCtx
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync * and ExpectedCtx members will be modified.
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync * @param fInvalid When set, get the next invalid operands that will
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync * @param pResults The result collection.
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsyncstatic int CidetGenericIn2Out1WithFlags(PCIDETCORE pThis, bool fInvalid, CIDET2IN1OUTWITHFLAGS const *pResults)
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync pThis->InCtx.rfl &= ~(uint64_t)pResults->fRelevantEFlags;
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync pThis->ExpectedCtx.rfl &= ~(uint64_t)pResults->fRelevantEFlags;
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync uint16_t idx = ++pThis->aiInOut[0] % pResults->c8Entries;
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync PCCIDET2IN1OUTWITHFLAGSU8ENTRY pEntry = &pResults->pa8Entries[idx];
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync uint16_t idx = ++pThis->aiInOut[1] % pResults->c16Entries;
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync PCCIDET2IN1OUTWITHFLAGSU16ENTRY pEntry = &pResults->pa16Entries[idx];
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync uint16_t idx = ++pThis->aiInOut[2] % pResults->c32Entries;
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync PCCIDET2IN1OUTWITHFLAGSU32ENTRY pEntry = &pResults->pa32Entries[idx];
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync uint16_t idx = ++pThis->aiInOut[3] % pResults->c64Entries;
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync PCCIDET2IN1OUTWITHFLAGSU64ENTRY pEntry = &pResults->pa64Entries[idx];
3bc264992af3416ecba168e6ffae1a334fe79088vboxsyncstatic DECLCALLBACK(int) cidetInOutAdd(PCIDETCORE pThis, bool fInvalid)
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync static const CIDET2IN1OUTWITHFLAGSU8ENTRY s_a8Results[] =
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync { UINT8_C(0x00), UINT8_C(0x00), 0, UINT8_C(0x00), ZF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT8_C(0xff), UINT8_C(0x01), 0, UINT8_C(0x00), CF | ZF | AF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT8_C(0x7f), UINT8_C(0x80), 0, UINT8_C(0xff), SF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT8_C(0x01), UINT8_C(0x01), 0, UINT8_C(0x02), 0 },
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync static const CIDET2IN1OUTWITHFLAGSU16ENTRY s_a16Results[] =
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync { UINT16_C(0x0000), UINT16_C(0x0000), 0, UINT16_C(0x0000), ZF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT16_C(0xfefd), UINT16_C(0x0103), 0, UINT16_C(0x0000), CF | ZF | AF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT16_C(0x8e7d), UINT16_C(0x7182), 0, UINT16_C(0xffff), SF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT16_C(0x0001), UINT16_C(0x0001), 0, UINT16_C(0x0002), 0 },
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync static const CIDET2IN1OUTWITHFLAGSU32ENTRY s_a32Results[] =
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync { UINT32_C(0x00000000), UINT32_C(0x00000000), 0, UINT32_C(0x00000000), ZF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT32_C(0xfefdfcfb), UINT32_C(0x01020305), 0, UINT32_C(0x00000000), CF | ZF | AF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT32_C(0x8efdfcfb), UINT32_C(0x71020304), 0, UINT32_C(0xffffffff), SF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT32_C(0x00000001), UINT32_C(0x00000001), 0, UINT32_C(0x00000002), 0 },
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync static const CIDET2IN1OUTWITHFLAGSU64ENTRY s_a64Results[] =
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync { UINT64_C(0x0000000000000000), UINT64_C(0x0000000000000000), 0, UINT64_C(0x0000000000000000), ZF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT64_C(0xfefdfcfbfaf9f8f7), UINT64_C(0x0102030405060709), 0, UINT64_C(0x0000000000000000), CF | ZF | AF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT64_C(0x7efdfcfbfaf9f8f7), UINT64_C(0x8102030405060708), 0, UINT64_C(0xffffffffffffffff), SF | PF },
ff454903834d245c742b066ebca74bdeac46d0f4vboxsync { UINT64_C(0x0000000000000001), UINT64_C(0x0000000000000001), 0, UINT64_C(0x0000000000000002), 0 },
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync static const CIDET2IN1OUTWITHFLAGS s_Results = CIDET2IN1OUTWITHFLAGS_INITIALIZER(CF | PF | AF | SF | OF);
c7522a3707ee4cc598fcb8d20bf679649dba09b3vboxsync return CidetGenericIn2Out1WithFlags(pThis, fInvalid, &s_Results);
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync/** First bunch of instructions. */
25ceded49a517b215750ee9e4193dafec2609db8vboxsync { CIDET_OF_K_GPR | CIDET_OF_Z_BYTE | CIDET_OF_M_RM | CIDET_OF_A_RW,
25ceded49a517b215750ee9e4193dafec2609db8vboxsync CIDET_OF_K_GPR | CIDET_OF_Z_BYTE | CIDET_OF_M_REG | CIDET_OF_A_R,
fdf66bdf7b03d58ec33dbc065f2d28e1f7d4986avboxsync { CIDET_OF_K_GPR | CIDET_OF_Z_VAR_WDQ | CIDET_OF_M_RM | CIDET_OF_A_RW,
fdf66bdf7b03d58ec33dbc065f2d28e1f7d4986avboxsync CIDET_OF_K_GPR | CIDET_OF_Z_VAR_WDQ | CIDET_OF_M_REG | CIDET_OF_A_R,
3bc264992af3416ecba168e6ffae1a334fe79088vboxsync/** Number of instruction in the g_aInstructions1 array. */