📄 gdefs.h
字号:
/*---------------------------------------------------------------*//*--- ---*//*--- This file (guest-x86/gdefs.h) is ---*//*--- Copyright (C) OpenWorks LLP. All rights reserved. ---*//*--- ---*//*---------------------------------------------------------------*//* This file is part of LibVEX, a library for dynamic binary instrumentation and translation. Copyright (C) 2004-2006 OpenWorks LLP. All rights reserved. This library is made available under a dual licensing scheme. If you link LibVEX against other code all of which is itself licensed under the GNU General Public License, version 2 dated June 1991 ("GPL v2"), then you may use LibVEX under the terms of the GPL v2, as appearing in the file LICENSE.GPL. If the file LICENSE.GPL is missing, you can obtain a copy of the GPL v2 from the Free Software Foundation Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. For any other uses of LibVEX, you must first obtain a commercial license from OpenWorks LLP. Please contact info@open-works.co.uk for information about commercial licensing. This software is provided by OpenWorks LLP "as is" and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall OpenWorks LLP be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage. Neither the names of the U.S. Department of Energy nor the University of California nor the names of its contributors may be used to endorse or promote products derived from this software without prior written permission.*//* Only to be used within the guest-x86 directory. */#ifndef __LIBVEX_GUEST_X86_DEFS_H#define __LIBVEX_GUEST_X86_DEFS_H/*---------------------------------------------------------*//*--- x86 to IR conversion ---*//*---------------------------------------------------------*//* Convert one x86 insn to IR. See the type DisOneInstrFn in bb_to_IR.h. */externDisResult disInstr_X86 ( IRBB* irbb, Bool put_IP, Bool (*resteerOkFn) ( void*, Addr64 ), void* callback_opaque, UChar* guest_code, Long delta, Addr64 guest_IP, VexArch guest_arch, VexArchInfo* archinfo, Bool host_bigendian );/* Used by the optimiser to specialise calls to helpers. */externIRExpr* guest_x86_spechelper ( HChar* function_name, IRExpr** args );/* Describes to the optimiser which part of the guest state require precise memory exceptions. This is logically part of the guest state description. */extern Bool guest_x86_state_requires_precise_mem_exns ( Int, Int );externVexGuestLayout x86guest_layout;/*---------------------------------------------------------*//*--- x86 guest helpers ---*//*---------------------------------------------------------*//* --- CLEAN HELPERS --- */extern UInt x86g_calculate_eflags_all ( UInt cc_op, UInt cc_dep1, UInt cc_dep2, UInt cc_ndep );__attribute((regparm(3)))extern UInt x86g_calculate_eflags_c ( UInt cc_op, UInt cc_dep1, UInt cc_dep2, UInt cc_ndep );extern UInt x86g_calculate_condition ( UInt/*X86Condcode*/ cond, UInt cc_op, UInt cc_dep1, UInt cc_dep2, UInt cc_ndep );extern UInt x86g_calculate_FXAM ( UInt tag, ULong dbl );extern ULong x86g_calculate_RCR ( UInt arg, UInt rot_amt, UInt eflags_in, UInt sz );extern ULong x86g_calculate_RCL ( UInt arg, UInt rot_amt, UInt eflags_in, UInt sz );extern ULong x86g_check_fldcw ( UInt fpucw );extern UInt x86g_create_fpucw ( UInt fpround );extern ULong x86g_check_ldmxcsr ( UInt mxcsr );extern UInt x86g_create_mxcsr ( UInt sseround );/* Translate a guest virtual_addr into a guest linear address by consulting the supplied LDT/GDT structures. Their representation must be as specified in pub/libvex_guest_x86.h. To indicate a translation failure, 1<<32 is returned. On success, the lower 32 bits of the returned result indicate the linear address. */extern ULong x86g_use_seg_selector ( HWord ldt, HWord gdt, UInt seg_selector, UInt virtual_addr );extern ULong x86g_calculate_mmx_pmaddwd ( ULong, ULong );extern ULong x86g_calculate_mmx_psadbw ( ULong, ULong );extern UInt x86g_calculate_mmx_pmovmskb ( ULong );extern UInt x86g_calculate_sse_pmovmskb ( ULong w64hi, ULong w64lo );/* --- DIRTY HELPERS --- */extern ULong x86g_dirtyhelper_loadF80le ( UInt );extern void x86g_dirtyhelper_storeF80le ( UInt, ULong );extern void x86g_dirtyhelper_CPUID_sse0 ( VexGuestX86State* );extern void x86g_dirtyhelper_CPUID_sse1 ( VexGuestX86State* );extern void x86g_dirtyhelper_CPUID_sse2 ( VexGuestX86State* );extern void x86g_dirtyhelper_FINIT ( VexGuestX86State* );extern void x86g_dirtyhelper_FXSAVE ( VexGuestX86State*, HWord );extern void x86g_dirtyhelper_FSAVE ( VexGuestX86State*, HWord );extern void x86g_dirtyhelper_FSTENV ( VexGuestX86State*, HWord );extern ULong x86g_dirtyhelper_RDTSC ( void );extern UInt x86g_dirtyhelper_IN ( UInt portno, UInt sz/*1,2 or 4*/ );extern void x86g_dirtyhelper_OUT ( UInt portno, UInt data, UInt sz/*1,2 or 4*/ );extern VexEmWarn x86g_dirtyhelper_FRSTOR ( VexGuestX86State*, HWord );extern VexEmWarn x86g_dirtyhelper_FLDENV ( VexGuestX86State*, HWord );/*---------------------------------------------------------*//*--- Condition code stuff ---*//*---------------------------------------------------------*//* eflags masks */#define X86G_CC_SHIFT_O 11#define X86G_CC_SHIFT_S 7#define X86G_CC_SHIFT_Z 6#define X86G_CC_SHIFT_A 4#define X86G_CC_SHIFT_C 0#define X86G_CC_SHIFT_P 2#define X86G_CC_MASK_O (1 << X86G_CC_SHIFT_O)#define X86G_CC_MASK_S (1 << X86G_CC_SHIFT_S)#define X86G_CC_MASK_Z (1 << X86G_CC_SHIFT_Z)#define X86G_CC_MASK_A (1 << X86G_CC_SHIFT_A)#define X86G_CC_MASK_C (1 << X86G_CC_SHIFT_C)#define X86G_CC_MASK_P (1 << X86G_CC_SHIFT_P)/* FPU flag masks */#define X86G_FC_SHIFT_C3 14#define X86G_FC_SHIFT_C2 10#define X86G_FC_SHIFT_C1 9#define X86G_FC_SHIFT_C0 8#define X86G_FC_MASK_C3 (1 << X86G_FC_SHIFT_C3)#define X86G_FC_MASK_C2 (1 << X86G_FC_SHIFT_C2)#define X86G_FC_MASK_C1 (1 << X86G_FC_SHIFT_C1)#define X86G_FC_MASK_C0 (1 << X86G_FC_SHIFT_C0)/* %EFLAGS thunk descriptors. A four-word thunk is used to record details of the most recent flag-setting operation, so the flags can be computed later if needed. It is possible to do this a little more efficiently using a 3-word thunk, but that makes it impossible to describe the flag data dependencies sufficiently accurately for Memcheck. Hence 4 words are used, with minimal loss of efficiency.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -