?? decode.c
字號:
uint segment, uint offset){#ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset);#endif return (*sys_rdw)(((u32)segment << 4) + offset);}/****************************************************************************PARAMETERS:segment - Segment to load data fromoffset - Offset to load data fromRETURNS:Long value read from the absolute memory location.NOTE: Do not inline this function as (*sys_rdX) is already inline!****************************************************************************/u32 fetch_data_long_abs( uint segment, uint offset){#ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset);#endif return (*sys_rdl)(((u32)segment << 4) + offset);}/****************************************************************************PARAMETERS:offset - Offset to store data atval - Value to storeREMARKS:Writes a word value to an segmented memory location. The segment used isthe current 'default' segment, which may have been overridden.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_byte( uint offset, u8 val){#ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16)get_data_segment(), offset);#endif (*sys_wrb)((get_data_segment() << 4) + offset, val);}/****************************************************************************PARAMETERS:offset - Offset to store data atval - Value to storeREMARKS:Writes a word value to an segmented memory location. The segment used isthe current 'default' segment, which may have been overridden.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_word( uint offset, u16 val){#ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16)get_data_segment(), offset);#endif (*sys_wrw)((get_data_segment() << 4) + offset, val);}/****************************************************************************PARAMETERS:offset - Offset to store data atval - Value to storeREMARKS:Writes a long value to an segmented memory location. The segment used isthe current 'default' segment, which may have been overridden.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_long( uint offset, u32 val){#ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access((u16)get_data_segment(), offset);#endif (*sys_wrl)((get_data_segment() << 4) + offset, val);}/****************************************************************************PARAMETERS:segment - Segment to store data atoffset - Offset to store data atval - Value to storeREMARKS:Writes a byte value to an absolute memory location.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_byte_abs( uint segment, uint offset, u8 val){#ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset);#endif (*sys_wrb)(((u32)segment << 4) + offset, val);}/****************************************************************************PARAMETERS:segment - Segment to store data atoffset - Offset to store data atval - Value to storeREMARKS:Writes a word value to an absolute memory location.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_word_abs( uint segment, uint offset, u16 val){#ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset);#endif (*sys_wrw)(((u32)segment << 4) + offset, val);}/****************************************************************************PARAMETERS:segment - Segment to store data atoffset - Offset to store data atval - Value to storeREMARKS:Writes a long value to an absolute memory location.NOTE: Do not inline this function as (*sys_wrX) is already inline!****************************************************************************/void store_data_long_abs( uint segment, uint offset, u32 val){#ifdef DEBUG if (CHECK_DATA_ACCESS()) x86emu_check_data_access(segment, offset);#endif (*sys_wrl)(((u32)segment << 4) + offset, val);}/****************************************************************************PARAMETERS:reg - Register to decodeRETURNS:Pointer to the appropriate registerREMARKS:Return a pointer to the register given by the R/RM field of themodrm byte, for byte operands. Also enables the decoding of instructions.****************************************************************************/u8* decode_rm_byte_register( int reg){ switch (reg) { case 0: DECODE_PRINTF("AL"); return &M.x86.R_AL; case 1: DECODE_PRINTF("CL"); return &M.x86.R_CL; case 2: DECODE_PRINTF("DL"); return &M.x86.R_DL; case 3: DECODE_PRINTF("BL"); return &M.x86.R_BL; case 4: DECODE_PRINTF("AH"); return &M.x86.R_AH; case 5: DECODE_PRINTF("CH"); return &M.x86.R_CH; case 6: DECODE_PRINTF("DH"); return &M.x86.R_DH; case 7: DECODE_PRINTF("BH"); return &M.x86.R_BH; } HALT_SYS(); return NULL; /* NOT REACHED OR REACHED ON ERROR */}/****************************************************************************PARAMETERS:reg - Register to decodeRETURNS:Pointer to the appropriate registerREMARKS:Return a pointer to the register given by the R/RM field of themodrm byte, for word operands. Also enables the decoding of instructions.****************************************************************************/u16* decode_rm_word_register( int reg){ switch (reg) { case 0: DECODE_PRINTF("AX"); return &M.x86.R_AX; case 1: DECODE_PRINTF("CX"); return &M.x86.R_CX; case 2: DECODE_PRINTF("DX"); return &M.x86.R_DX; case 3: DECODE_PRINTF("BX"); return &M.x86.R_BX; case 4: DECODE_PRINTF("SP"); return &M.x86.R_SP; case 5: DECODE_PRINTF("BP"); return &M.x86.R_BP; case 6: DECODE_PRINTF("SI"); return &M.x86.R_SI; case 7: DECODE_PRINTF("DI"); return &M.x86.R_DI; } HALT_SYS(); return NULL; /* NOTREACHED OR REACHED ON ERROR */}/****************************************************************************PARAMETERS:reg - Register to decodeRETURNS:Pointer to the appropriate registerREMARKS:Return a pointer to the register given by the R/RM field of themodrm byte, for dword operands. Also enables the decoding of instructions.****************************************************************************/u32* decode_rm_long_register( int reg){ switch (reg) { case 0: DECODE_PRINTF("EAX"); return &M.x86.R_EAX; case 1: DECODE_PRINTF("ECX"); return &M.x86.R_ECX; case 2: DECODE_PRINTF("EDX"); return &M.x86.R_EDX; case 3: DECODE_PRINTF("EBX"); return &M.x86.R_EBX; case 4: DECODE_PRINTF("ESP"); return &M.x86.R_ESP; case 5: DECODE_PRINTF("EBP"); return &M.x86.R_EBP; case 6: DECODE_PRINTF("ESI"); return &M.x86.R_ESI; case 7: DECODE_PRINTF("EDI"); return &M.x86.R_EDI; } HALT_SYS(); return NULL; /* NOTREACHED OR REACHED ON ERROR */}/****************************************************************************PARAMETERS:reg - Register to decodeRETURNS:Pointer to the appropriate registerREMARKS:Return a pointer to the register given by the R/RM field of themodrm byte, for word operands, modified from above for the weirdospecial case of segreg operands. Also enables the decoding of instructions.****************************************************************************/u16* decode_rm_seg_register( int reg){ switch (reg) { case 0: DECODE_PRINTF("ES"); return &M.x86.R_ES; case 1: DECODE_PRINTF("CS"); return &M.x86.R_CS; case 2: DECODE_PRINTF("SS"); return &M.x86.R_SS; case 3: DECODE_PRINTF("DS"); return &M.x86.R_DS; case 4: DECODE_PRINTF("FS"); return &M.x86.R_FS; case 5: DECODE_PRINTF("GS"); return &M.x86.R_GS; case 6: case 7: DECODE_PRINTF("ILLEGAL SEGREG"); break; } HALT_SYS(); return NULL; /* NOT REACHED OR REACHED ON ERROR */}/****************************************************************************PARAMETERS:scale - scale value of SIB byteindex - index value of SIB byteRETURNS:Value of scale * indexREMARKS:Decodes scale/index of SIB byte and returns relevant offset part ofeffective address.****************************************************************************/unsigned decode_sib_si( int scale, int index){ scale = 1 << scale; if (scale > 1) { DECODE_PRINTF2("[%d*", scale); } else { DECODE_PRINTF("["); } switch (index) { case 0: DECODE_PRINTF("EAX]"); return M.x86.R_EAX * index; case 1: DECODE_PRINTF("ECX]"); return M.x86.R_ECX * index; case 2: DECODE_PRINTF("EDX]"); return M.x86.R_EDX * index; case 3: DECODE_PRINTF("EBX]"); return M.x86.R_EBX * index; case 4: DECODE_PRINTF("0]"); return 0; case 5: DECODE_PRINTF("EBP]"); return M.x86.R_EBP * index;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -