⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dsmlib.c

📁 VxWorks BSP框架源代码包含头文件和驱动
💻 C
📖 第 1 页 / 共 5 页
字号:
/* dsmLib.c - i80x86 disassembler *//* Copyright 1984-2003 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01m,01mar03,pai  Fixed initialization in dsmInstGet() and printing logic as                 part of (SPR 86339) work.01l,16sep02,pai  Updated support for SSE2 & Pentium 4 instructions.                 Implemented a fix for FP arithmetic insns (SPR 34224).                 Corrected decode of IN and OUT w/ imm8 operands (SPR 75451).01k,27mar02,hdn  fixed the CALL/JMP ptr16:16/32 offset size (spr 73624)01j,30aug01,hdn  added SIMD, sysenter/exit support.                 always print the disassembled address on 8 digits with 0x.01i,06may98,fle  added P5 and P6 related instructions and facilities01h,14nov94,hdn  changed D->DISR, W->WFUL, S->SEXT, P->POP, A->AX, I->IMM.01g,29may94,hdn  removed I80486.01f,31aug93,hdn  changed a type of 1st parameter, from char to UCHAR.01e,02aug93,hdn  fixed a case that has mod=0,rm=5,disp32 operand.01d,01jun93,hdn  updated to 5.1                  - changed functions to ansi style                  - fixed #else and #endif                  - changed VOID to void                  - changed copyright notice01c,18mar93,hdn  supported 486 instructions.01b,05nov92,hdn  supported "16 bit operand","rep","repne","shift by 1".                 fixed a bug that is about "empty index".01a,23jun92,hdn  written. *//*This library contains everything necessary to print i80x86 object code inassembly language format. The programming interface is via dsmInst(), which prints a single disassembledinstruction, and dsmNbytes(), which reports the size of an instruction.To disassemble from the shell, use l(), which calls thislibrary to do the actual work.  See dbgLib for details.INCLUDE FILE: dsmLib.hSEE ALSO: dbgLib*//* includes */#include "wtxtypes.h"#include "stdlib.h"#include "stdio.h"#include "string.h"#include "errnoLib.h"#include "dsmLib.h"/* macros */#define UNKNOWN_INSN_DESC(pInsn) \    ( \    ((const INST *)(pInsn) == NULL) || \    (((const INST *)(pInsn))->pOpc == NULL) \    )/* locals *//* * This table is ordered by the number of bits in an instruction's  * mask, beginning with the greatest number of bits in masks.   * This scheme is used for avoiding conflicts between instructions  * with matching bit patterns.  The instruction ops are arranged  * sequentially within each group of instructions for a particular  * mask so that uniqueness can be easily spotted.   */LOCAL const INST insnTable [] =    {    /* OP3 instructions extended by bits 3, 4, and 5 of ModR/M */    {"PSLLDQ", itPslldq, OP3|MODRM|I8, XMMRM,        0x66, 0x0f, 0x73, 0x38,    /* opcode */        0xff, 0xff, 0xff, 0x38},   /* mask */    {"PSRLDQ", itPsrldq, OP3|MODRM|I8, XMMRM,        0x66, 0x0f, 0x73, 0x18,    /* opcode */        0xff, 0xff, 0xff, 0x38},   /* mask */    /* OP3 instructions */    {"PSLL", itPsll, OP3|GG|MODRM|I8, XMMRM,        0x66, 0x0f, 0x70, 0xf0,    /* opcode */        0xff, 0xff, 0xfc, 0xf8,},  /* mask */    {"PSRA", itPsra, OP3|GG|MODRM|I8, XMMRM,        0x66, 0x0f, 0x70, 0xe0,    /* opcode */        0xff, 0xff, 0xfc, 0xf8},   /* mask */    {"PSRL", itPsrl, OP3|GG|MODRM|I8, XMMRM,        0x66, 0x0f, 0x70, 0xd0,    /* opcode */        0xff, 0xff, 0xfc, 0xf8},   /* mask */    {"ADDPD", itAddpd, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x58, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"ADDSD", itAddsd, OP3|MODRM, XMMREG|XMMRM,        0xf2, 0x0f, 0x58, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"ADDSS", itAddss, OP3|MODRM, XMMREG|XMMRM,        0xf3, 0x0f, 0x58, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"ANDNPD", itAndnpd, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x55, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"ANDPD", itAndpd, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x54, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CMPPD", itCmppd, OP3|MODRM|I8, XMMREG|XMMRM,        0x66, 0x0f, 0xc2, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CMPSD", itCmpsd, OP3|MODRM|I8, XMMREG|XMMRM,        0xf2, 0x0f, 0xc2, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CMPSS", itCmpss, OP3|MODRM|I8, XMMREG|XMMRM,        0xf3, 0x0f, 0xc2, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTDQ2PD", itCvtdq2pd, OP3|MODRM, XMMREG|XMMRM,        0xf3, 0x0f, 0xe6, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTPD2DQ", itCvtpd2dq, OP3|MODRM, XMMREG|XMMRM,        0xf2, 0x0f, 0xe6, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTPD2PS", itCvtpd2ps, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x5a, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTPI2PD", itCvtpi2pd, OP3|MODRM|MMXRM, XMMREG,        0x66, 0x0f, 0x2a, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTPS2DQ", itCvtps2dq, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x5b, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTSD2SI", itCvtsd2si, OP3|MODRM|REG, XMMRM,        0xf2, 0x0f, 0x2d, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTSD2SS", itCvtsd2ss, OP3|MODRM, XMMREG|XMMRM,        0xf2, 0x0f, 0x5a, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTSI2SD", itCvtsi2sd, OP3|MODRM|REGRM, XMMREG,        0xf2, 0x0f, 0x2a, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTSI2SS", itCvtsi2ss, OP3|MODRM|REGRM, XMMREG,        0xf3, 0x0f, 0x2a, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTSS2SD", itCvtss2sd, OP3|MODRM, XMMREG|XMMRM,        0xf3, 0x0f, 0x2d, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTSS2SI", itCvtss2si, OP3|MODRM|REG, XMMRM,        0xf3, 0x0f, 0x2d, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTTPD2DQ", itCvttpd2dq, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xe6, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTTPD2PI", itCvttpd2pi, OP3|MODRM|MMXREG, XMMRM,        0x66, 0x0f, 0x2c, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTTPS2DQ", itCvttps2dq, OP3|MODRM, XMMREG|XMMRM,        0xf3, 0x0f, 0x5b, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTTSD2SI", itCvttsd2si, OP3|MODRM|REG, XMMRM,        0xf2, 0x0f, 0x2c, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"CVTTSS2SI", itCvttss2si, OP3|MODRM|REG, XMMRM,        0xf3, 0x0f, 0x2c, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"DIVPD", itDivpd, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x5e, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"DIVSD", itDivsd, OP3|MODRM, XMMREG|XMMRM,        0xf2, 0x0f, 0x5e, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"DIVSS", itDivss, OP3|MODRM, XMMREG|XMMRM,        0xf3, 0x0f, 0x5e, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"FCLEX", itFclex, OP3, 0,        0x9b, 0xdb, 0xe2, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"FINIT", itFinit, OP3, 0,        0x9b, 0xdb, 0xe3, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"FSTSW", itFstswA, OP3|AX, 0,        0x9b, 0xdf, 0xe0, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MASKMOVDQU", itMaskmovdqu, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xf7, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MAXPD", itMaxpd, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x5f, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MAXSD", itMaxsd, OP3|MODRM, XMMREG|XMMRM,        0xf2, 0x0f, 0x5f, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MAXSS", itMaxss, OP3|MODRM, XMMREG|XMMRM,        0xf3, 0x0f, 0x5f, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MINPD", itMinpd, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x5d, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MINSD", itMinsd, OP3|MODRM, XMMREG|XMMRM,        0xf2, 0x0f, 0x5d, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MINSS", itMinss, OP3|MODRM, XMMREG|XMMRM,        0xf3, 0x0f, 0x5d, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MOVDQ2Q", itMovdq2q, OP3|MODRM|MMXREG, XMMRM,        0xf2, 0x0f, 0xd6, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MOVMSKPD", itMovmskpd, OP3|MODRM|REG, XMMRM,        0x66, 0x0f, 0x50, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MOVNTPD", itMovntpd, OP3|MODRM|DISR, XMMREG|XMMRM,        0x66, 0x0f, 0x2b, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MOVQ", itMovq, OP3|MODRM|DISR, XMMREG|XMMRM,        0x66, 0x0f, 0xd6, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MOVQ", itMovq, OP3|MODRM|DISR, XMMREG|XMMRM,        0xf3, 0x0f, 0x7e, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MOVQ2DQ", itMovq2dq, OP3|MODRM|MMXRM, XMMREG,        0xf3, 0x0f, 0xd6, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MULPD", itMulpd, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x59, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MULSD", itMulsd, OP3|MODRM, XMMREG|XMMRM,        0xf2, 0x0f, 0x59, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"MULSS", itMulss, OP3|MODRM, XMMREG|XMMRM,        0xf3, 0x0f, 0x59, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"ORPD", itOrpd, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x56, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PACKSSDW", itPackssdw, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x6b, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PACKSSWB", itPacksswb, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x63, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PACKUSWB", itPackuswb, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0x67, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PAND", itPand, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xdb, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PANDN", itPandn, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xdf, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PAVGB", itPavgb, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xe0, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */                                    {"PAVGW", itPavgw, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xe3, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PEXTRW", itPextrw, OP3|DISR|MODRM|REGRM|I8, XMMREG,        0x66, 0x0f, 0xc5, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PINSRW", itPinsrw, OP3|MODRM|REGRM|I8, XMMREG,        0x66, 0x0f, 0xc4, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PMADDWD", itPmadd, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xf5, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PMAXSW", itPmaxsw, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xee, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PMAXUB", itPmaxub, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xde, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PMINSW", itPminsw, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xea, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PMINUB", itPminub, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xda, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PMOVMSKB", itPmovmskb, OP3|MODRM|REGRM|DISR, XMMREG,        0x66, 0x0f, 0xd7, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PMULHUW", itPmulhuw, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xe4, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PMULHW", itPmulh, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xe5, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PMULLW", itPmull, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xd5, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PMULUDQ", itPmuludq, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xf4, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"POR", itPor, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xeb, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PSADBW", itPsadbw, OP3|MODRM, XMMREG|XMMRM,        0x66, 0x0f, 0xf6, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PSHUFD", itPshufd, OP3|MODRM|I8, XMMREG|XMMRM,        0x66, 0x0f, 0x70, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PSHUFHW", itPshufhw, OP3|MODRM|I8, XMMREG|XMMRM,        0xf3, 0x0f, 0x70, 0x00,    /* opcode */        0xff, 0xff, 0xff, 0x00},   /* mask */    {"PSHUFLW", itPshuflw, OP3|MODRM|I8, XMMREG|XMMRM,

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -