VirtualBox

Ignore:
Timestamp:
Mar 27, 2024 8:03:46 AM (11 months ago)
Author:
vboxsync
Message:

VMM/IEM: Fix implementation of IEM_MC_SHL_LOCAL_S16() and IEM_MC_SAR_LOCAL_S16() (introduced with r162449), bugref:10371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/IEMAllN8veRecompFuncs.h

    r104072 r104074  
    37133713    IEMNATIVE_ASSERT_VAR_SIZE(pReNative, idxVar, cbLocal);
    37143714
    3715     if (cbLocal <= sizeof(uint32_t)) /** @todo r=bird: for cbLocal < sizeof(uint32_t), this'll require a AND or something to restrict the result. */
     3715    if (cbLocal <= sizeof(uint32_t))
     3716    {
    37163717        off = iemNativeEmitShiftGpr32Left(pReNative, off, idxVarReg, cShift);
     3718        if (cbLocal < sizeof(uint32_t))
     3719            off = iemNativeEmitAndGpr32ByImm(pReNative, off, idxVarReg,
     3720                                               cbLocal == sizeof(uint16_t)
     3721                                             ? UINT32_C(0xffff)
     3722                                             : UINT32_C(0xff));
     3723    }
    37173724    else
    37183725        off = iemNativeEmitShiftGprLeft(pReNative, off, idxVarReg, cShift);
     
    37503757    IEMNATIVE_ASSERT_VAR_SIZE(pReNative, idxVar, cbLocal);
    37513758
    3752     if (cbLocal <= sizeof(uint32_t)) /** @todo r=bird: This is NOT working for cbLocal < sizeof(uint32_t) if negative! */
     3759    /* Need to sign extend the value first to make sure the sign is correct in the following arithmetic shift. */
     3760    if (cbLocal == sizeof(uint8_t))
     3761        off = iemNativeEmitLoadGpr32SignExtendedFromGpr8(pReNative, off, idxVarReg, idxVarReg);
     3762    else if (cbLocal == sizeof(uint16_t))
     3763        off = iemNativeEmitLoadGpr32SignExtendedFromGpr16(pReNative, off, idxVarReg, idxVarReg);
     3764
     3765    if (cbLocal <= sizeof(uint32_t))
    37533766        off = iemNativeEmitArithShiftGpr32Right(pReNative, off, idxVarReg, cShift);
    37543767    else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette