VirtualBox

Changeset 99220 in vbox for trunk/src/VBox/HostDrivers


Ignore:
Timestamp:
Mar 30, 2023 12:40:46 PM (20 months ago)
Author:
vboxsync
Message:

Disassember,*: Start separating the disassembler into a architecture specific and common part, bugref:10394

Location:
trunk/src/VBox/HostDrivers/Support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/posix/SUPR3HardenedMain-posix.cpp

    r98103 r99220  
    360360            || (   Dis.pCurInstr->fOpType & DISOPTYPE_CONTROLFLOW
    361361                && Dis.pCurInstr->uOpcode != OP_CALL)
    362             || (   Dis.ModRM.Bits.Mod == 0
    363                 && Dis.ModRM.Bits.Rm  == 5 /* wrt RIP */
     362            || (   Dis.arch.x86.ModRM.Bits.Mod == 0
     363                && Dis.arch.x86.ModRM.Bits.Rm  == 5 /* wrt RIP */
    364364                && Dis.pCurInstr->uOpcode != OP_MOV))
    365365            return VERR_SUPLIB_UNEXPECTED_INSTRUCTION;
    366366
    367         if (Dis.ModRM.Bits.Mod == 0 && Dis.ModRM.Bits.Rm == 5 /* wrt RIP */)
     367        if (Dis.arch.x86.ModRM.Bits.Mod == 0 && Dis.ModRM.Bits.Rm == 5 /* wrt RIP */)
    368368            cRipRelMovs++;
    369369        if (   Dis.pCurInstr->uOpcode == OP_CALL
     
    418418            return VERR_SUPLIB_UNEXPECTED_INSTRUCTION;
    419419
    420         if (   Dis.ModRM.Bits.Mod == 0
    421             && Dis.ModRM.Bits.Rm  == 5 /* wrt RIP */
     420        if (   Dis.arch.x86.ModRM.Bits.Mod == 0
     421            && Dis.arch.x86.ModRM.Bits.Rm  == 5 /* wrt RIP */
    422422            && Dis.pCurInstr->uOpcode == OP_MOV)
    423423        {
     
    437437
    438438                *pbPatchMem++ = 0x48;
    439                 *pbPatchMem++ = 0xb8 + Dis.Param1.Base.idxGenReg;
     439                *pbPatchMem++ = 0xb8 + Dis.Param1.arch.x86.Base.idxGenReg;
    440440                *(uintptr_t *)pbPatchMem = uAddr;
    441441                pbPatchMem   += sizeof(uintptr_t);
     
    443443                *pbPatchMem++ = 0x48;
    444444                *pbPatchMem++ = 0x8b;
    445                 *pbPatchMem++ = (Dis.Param1.Base.idxGenReg << X86_MODRM_REG_SHIFT) | Dis.Param1.Base.idxGenReg;
     445                *pbPatchMem++ = (Dis.Param1.Base.arch.x86.idxGenReg << X86_MODRM_REG_SHIFT) | Dis.Param1.Base.arch.x86.idxGenReg;
    446446            }
    447447            else
     
    453453                *pbPatchMem++ = 0x48;
    454454                *pbPatchMem++ = 0x8b;
    455                 *pbPatchMem++ = (Dis.Param1.Base.idxGenReg << X86_MODRM_REG_SHIFT) | 5;
     455                *pbPatchMem++ = (Dis.Param1.arch.x86.Base.idxGenReg << X86_MODRM_REG_SHIFT) | 5;
    456456                *(int32_t *)pbPatchMem = (int32_t)iDispNew;
    457457                pbPatchMem   += sizeof(int32_t);
  • trunk/src/VBox/HostDrivers/Support/win/SUPR3HardenedMain-win.cpp

    r98103 r99220  
    30773077        if (   RT_FAILURE(rc)
    30783078            || (Dis.pCurInstr->fOpType & (DISOPTYPE_CONTROLFLOW))
    3079             || (Dis.ModRM.Bits.Mod == 0 && Dis.ModRM.Bits.Rm == 5 /* wrt RIP */) )
     3079            || (Dis.arch.x86.ModRM.Bits.Mod == 0 && Dis.arch.x86.ModRM.Bits.Rm == 5 /* wrt RIP */) )
    30803080            supR3HardenedWinHookFailed("LdrLoadDll", pbLdrLoadDll);
    30813081        offJmpBack += cbInstr;
     
    31643164        if (   RT_FAILURE(rc)
    31653165            || (Dis.pCurInstr->fOpType & (DISOPTYPE_CONTROLFLOW))
    3166             || (Dis.ModRM.Bits.Mod == 0 && Dis.ModRM.Bits.Rm == 5 /* wrt RIP */) )
     3166            || (Dis.arch.x86.ModRM.Bits.Mod == 0 && Dis.arch.x86.ModRM.Bits.Rm == 5 /* wrt RIP */) )
    31673167            supR3HardenedWinHookFailed("KiUserApcDispatcher", pbKiUserApcDispatcher);
    31683168        offJmpBack += cbInstr;
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