5b281ba489ca18f0380d7efc7a5108b606cce449vboxsync * IPRT - RTLdr test object.
38856343f90103280eb83b5e697f9f618b407d83vboxsync * We use precompiled versions of this object for testing all the loaders.
38856343f90103280eb83b5e697f9f618b407d83vboxsync * This is not supposed to be pretty or usable code, just something which
38856343f90103280eb83b5e697f9f618b407d83vboxsync * make life difficult for the loader.
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2006-2012 Oracle Corporation
38856343f90103280eb83b5e697f9f618b407d83vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
38856343f90103280eb83b5e697f9f618b407d83vboxsync * available from http://www.virtualbox.org. This file is free software;
38856343f90103280eb83b5e697f9f618b407d83vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * The contents of this file may alternatively be used under the terms
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * of the Common Development and Distribution License Version 1.0
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution, in which case the provisions of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * CDDL are applicable instead of those of the GPL.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * You may elect to license modified versions of this file under the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * terms and conditions of either the GPL or the CDDL or both.
38856343f90103280eb83b5e697f9f618b407d83vboxsync/*******************************************************************************
38856343f90103280eb83b5e697f9f618b407d83vboxsync* Header Files *
38856343f90103280eb83b5e697f9f618b407d83vboxsync*******************************************************************************/
a4d7fc6f54717c342281099fe14f5666be9b7921vboxsync#if defined(IN_RING0) && !defined(RT_OS_WINDOWS) /* Too lazy to make import libs. */
38856343f90103280eb83b5e697f9f618b407d83vboxsyncextern "C" DECLIMPORT(int) MyPrintf(const char *pszFormat, ...);
38856343f90103280eb83b5e697f9f618b407d83vboxsync/*******************************************************************************
38856343f90103280eb83b5e697f9f618b407d83vboxsync* Global Variables *
38856343f90103280eb83b5e697f9f618b407d83vboxsync*******************************************************************************/
38856343f90103280eb83b5e697f9f618b407d83vboxsync/* 32-bit code */
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0x8b,0x45,0x08, // 1000ab53 8b4508 mov eax,dword ptr [ebp+8]
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0x81,0x38,0x07,0x07,// 1000ab56 813807076419 cmp dword ptr [eax],19640707h
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0x75,0x09, // 1000ab5c 7509 jne kLdr!kLdrModMap+0x17 (1000ab67)
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0x8b,0x4d,0x08, // 1000ab5e 8b4d08 mov ecx,dword ptr [ebp+8]
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0x83,0x79,0x2c,0x00,// 1000ab61 83792c00 cmp dword ptr [ecx+2Ch],0
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0x75,0x07, // 1000ab65 7507 jne kLdr!kLdrModMap+0x1e (1000ab6e)
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0xb8,0xc0,0x68,0x06,// 1000ab67 b8c0680600 mov eax,668C0h
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0xeb,0x14, // 1000ab6c eb14 jmp kLdr!kLdrModMap+0x32 (1000ab82)
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0x75,0xe1, // 1000ab70 75e1 jne kLdr!kLdrModMap+0x3 (1000ab53)
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0x8b,0x45,0x08, // 1000ab72 8b4508 mov eax,dword ptr [ebp+8]
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0x8b,0x4d,0x08, // 1000ab76 8b4d08 mov ecx,dword ptr [ebp+8]
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0x8b,0x51,0x2c, // 1000ab79 8b512c mov edx,dword ptr [ecx+2Ch]
38856343f90103280eb83b5e697f9f618b407d83vboxsync 0xff,0x52,0x3c, // 1000ab7c ff523c call dword ptr [edx+3Ch]
99cd1ce586a12bf6b8c6084cbcdebe8fe3553cc2vboxsync * @callback_method_impl{FNDISREADBYTES}
10f18618390096a9c968016b6ca94d77b91618fbvboxsyncstatic DECLCALLBACK(int) DisasmTest1ReadCode(PDISCPUSTATE pDis, uint8_t offInstr, uint8_t cbMinRead, uint8_t cbMaxRead)
10f18618390096a9c968016b6ca94d77b91618fbvboxsync if (cb + pDis->uInstrAddr + offInstr > sizeof(g_ab32BitCode))
10f18618390096a9c968016b6ca94d77b91618fbvboxsync memcpy(&pDis->abInstr[offInstr], &g_ab32BitCode[pDis->uInstrAddr + offInstr], cb);
b0553043536ae0bdf9921b91597f9dc6c316b1b4vboxsync * Use an inline function here just to test '__textcoal_nt' sections on darwin.
b0553043536ae0bdf9921b91597f9dc6c316b1b4vboxsyncinline int MyDisasm(uintptr_t CodeIndex, PDISCPUSTATE pCpu, uint32_t *pcb)
98502a585f6eda30527b54f7df18dd3de3d3d7c6vboxsync int rc = DISInstrWithReader(CodeIndex, DISCPUMODE_32BIT, DisasmTest1ReadCode, 0, pCpu, &cb);
f3701698f9d61fed78c320c3b35c64a0c63d6db1vboxsync MY_PRINTF(("DISCoreOneEx -> rc=%d cb=%d Cpu: bOpCode=%#x pCurInstr=%p (42=%d)\n", \
38856343f90103280eb83b5e697f9f618b407d83vboxsync } while (0)