Ejemplo n.º 1
0
/* ====================================================================
 *
 * ==================================================================== */
void __bea_callspec__ eAX_Iv(PDISASM pMyDisasm)
{
    UInt32 MyNumber;
    (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0;
    (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
    (*pMyDisasm).Argument1.ArgSize = (*pMyDisasm).Instruction.OperandSize;
    if ((*pMyDisasm).Instruction.OperandSize == 64) {
        GV.EIP_+= 4;
        (*pMyDisasm).Argument2.ArgSize = 32;
        if (!Security(0, pMyDisasm)) return;
        MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_-4));
        (*pMyDisasm).Instruction.Immediat = (Int32) MyNumber;
    }
    else if ((*pMyDisasm).Instruction.OperandSize >= 32) {
        GV.EIP_+= 4;
        (*pMyDisasm).Argument2.ArgSize = 32;
        if (!Security(0, pMyDisasm)) return;
        MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_-4));
        (*pMyDisasm).Instruction.Immediat = MyNumber;
    }
    else {
        GV.EIP_+= 2;
        (*pMyDisasm).Argument2.ArgSize = 16;
        if (!Security(0, pMyDisasm)) return;
        MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_-2));
        (*pMyDisasm).Instruction.Immediat = MyNumber;
    }
}
Ejemplo n.º 2
0
/* ====================================================================
 *
 * ==================================================================== */
void __bea_callspec__ EvIv(PDISASM pMyDisasm)
{
    (*pMyDisasm).Argument1.ArgSize = (*pMyDisasm).Instruction.OperandSize;
    if ((*pMyDisasm).Instruction.OperandSize >= 32) {
        GV.ImmediatSize = 32;                       /* place this instruction before MOD_RM routine to inform it there is an immediat value */
        MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
        GV.EIP_ += GV.DECALAGE_EIP+4;
        if (!Security(0, pMyDisasm)) return;

        (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
        (*pMyDisasm).Argument2.ArgSize = 32;
        if ((*pMyDisasm).Instruction.OperandSize == 64) {
            (*pMyDisasm).Instruction.Immediat = *((Int32*)(UIntPtr) (GV.EIP_-4));
        }
        else {
            (*pMyDisasm).Instruction.Immediat = *((UInt32*)(UIntPtr) (GV.EIP_-4));
        }
    }
    else {
        GV.ImmediatSize = 16;
        MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
        GV.EIP_ += GV.DECALAGE_EIP+2;
        if (!Security(0, pMyDisasm)) return;
        (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
        (*pMyDisasm).Argument2.ArgSize = 16;
        (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_-2));
    }
}
Ejemplo n.º 3
0
/* ====================================================================
 *
 * ==================================================================== */
void __bea_callspec__ EvIb(PDISASM pMyDisasm)
{
    Int8 MyNumber;
    (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
    (*pMyDisasm).Argument2.ArgSize = 8;
    GV.ImmediatSize = 8;
    if (GV.OperandSize >= 32) {
        if (GV.OperandSize == 64) {
            GV.MemDecoration = Arg1qword;
        }
        else {
            GV.MemDecoration = Arg1dword;
        }
        MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
        GV.EIP_ += GV.DECALAGE_EIP+3;
        if (!Security(0, pMyDisasm)) return;
		if (GV.OperandSize == 32) {
			#ifndef BEA_LIGHT_DISASSEMBLY
			MyNumber = *((Int8*)(UIntPtr) (GV.EIP_-1));
			if (MyNumber > 0) {
                (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1)));
			}
			else {
                (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64)*((Int8*)(IntPtr) (GV.EIP_-1)));
			}
            #endif
		}
		else {
			#ifndef BEA_LIGHT_DISASSEMBLY
			MyNumber = *((Int8*)(UIntPtr) (GV.EIP_-1));
			if (MyNumber > 0) {
                (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1)));
			}
			else {
                (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.16llX",(Int64)*((Int8*)(IntPtr) (GV.EIP_-1)));
			}
            #endif
		}

        (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_-1));
    }
    else {
        GV.MemDecoration = Arg1word;
        MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
        GV.EIP_ += GV.DECALAGE_EIP+3;
        if (!Security(0, pMyDisasm)) return;
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.4X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1)));
        #endif

        (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_-1));
    }
}
Ejemplo n.º 4
0
/* ====================================================================
 *      Legacy Prefix 66h-Group 3
 * ==================================================================== */
void __bea_callspec__ PrefOpSize(PDISASM pMyDisasm)
{
    if (!Security(0, pMyDisasm)) return;
    (*pMyDisasm).Prefix.OperandSize = InUsePrefix;
    GV.EIP_++;
    (*pMyDisasm).Prefix.Number++;
    GV.NB_PREFIX++;
    GV.OriginalOperandSize = GV.OperandSize;  /* if GV.OperandSize is used as a mandatory prefix, keep the real operandsize value */
    if (GV.Architecture == 16) {
        GV.OperandSize = 32;
    }
    else {
        if (GV.OperandSize != 64) {
            GV.OperandSize = 16;
        }
    }
    (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_);
    (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm);
    if (GV.Architecture == 16) {
        GV.OperandSize = 16;
    }
    else {
        GV.OperandSize = 32;
    }
}
Ejemplo n.º 5
0
// ====================================================================
//      Escape Prefix 0F3Ah - three bytes opcodes
// ====================================================================
void __stdcall Esc_tableA5(PDISASM pMyDisasm)
{
    if (!Security(0)) return;
    EIP_++;
    (*pMyDisasm).Instruction.Opcode = *((BYTE*) EIP_) + 0x0F3A00;
    (void) opcode_map4[*((BYTE*) EIP_)](pMyDisasm);
}
Ejemplo n.º 6
0
/* ====================================================================
 *      Legacy Prefix F3h-Group 1
 * ==================================================================== */
void __bea_callspec__ PrefREPE(PDISASM pMyDisasm)
{
    if (!Security(0, pMyDisasm)) return;
    (*pMyDisasm).Prefix.RepPrefix = SuperfluousPrefix;
    GV.EIP_++;
    (*pMyDisasm).Prefix.Number++;
    GV.NB_PREFIX++;
    GV.PrefRepe = 1;
    (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_);
    if (GV.VEX.state != InUsePrefix) {
        (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm);
    }
    else if (GV.VEX.mmmmm == 0x1) {
        (void) opcode_map2[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm);
    }
    else if (GV.VEX.mmmmm == 0x2) {
        (void) opcode_map3[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm);
    }
    else if (GV.VEX.mmmmm == 0x3) {
        (void) opcode_map4[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm);
    }
    else {
        (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm);
    }
    GV.PrefRepe = 0;
}
Ejemplo n.º 7
0
/* ====================================================================
 *      Legacy Prefix 2Eh-Group 2
 * ==================================================================== */
void __bea_callspec__ PrefSEGCS(PDISASM pMyDisasm)
{
    if (!Security(0, pMyDisasm)) return;
    (*pMyDisasm).Prefix.CSPrefix = InUsePrefix;
    GV.EIP_++;
    (*pMyDisasm).Prefix.Number++;
    GV.NB_PREFIX++;
    (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_);
    (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm);
}
Ejemplo n.º 8
0
// ====================================================================
//      Legacy Prefix 3Eh - Group 2
// ====================================================================
void __stdcall PrefSEGDS(PDISASM pMyDisasm)
{
    if (!Security(0)) return;
    (*pMyDisasm).Prefix.FSPrefix = InUsePrefix;
    EIP_++;
    (*pMyDisasm).Prefix.Number++;
    NB_PREFIX++;
    (*pMyDisasm).Instruction.Opcode = *((BYTE*) EIP_);
    (void) opcode_map1[*((BYTE*) EIP_)](pMyDisasm);
}
Ejemplo n.º 9
0
/* ====================================================================
 *      Legacy Prefix F0h-Group 1
 * ==================================================================== */
void __bea_callspec__ PrefLock(PDISASM pMyDisasm)
{
    if (!Security(0, pMyDisasm)) return;
    (*pMyDisasm).Prefix.LockPrefix = InvalidPrefix;
    GV.EIP_++;
    (*pMyDisasm).Prefix.Number++;
    GV.NB_PREFIX++;
    (*pMyDisasm).Instruction.Opcode =  *((UInt8*) (UIntPtr)GV.EIP_);
    (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm);
    GV.OperandSize = 32;
}
Ejemplo n.º 10
0
/* ====================================================================
 *
 * ==================================================================== */
void __bea_callspec__ EvIb(PDISASM pMyDisasm)
{
    (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
    (*pMyDisasm).Argument2.ArgSize = 8;
    GV.ImmediatSize = 8;
    (*pMyDisasm).Argument1.ArgSize = (*pMyDisasm).Instruction.OperandSize;
    MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
    GV.EIP_ += GV.DECALAGE_EIP+1;
    if (!Security(0, pMyDisasm)) return;

    (*pMyDisasm).Instruction.Immediat = *((Int8*)(UIntPtr) (GV.EIP_-1));
}
Ejemplo n.º 11
0
/* ====================================================================
 *
 * ==================================================================== */
void __bea_callspec__ ALIb(PDISASM pMyDisasm)
{
    long MyNumber;
    if (!Security(1, pMyDisasm)) return;
    MyNumber = *((UInt8*)(IntPtr) (GV.EIP_));
    (*pMyDisasm).Instruction.Immediat = MyNumber;
    (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0;
    (*pMyDisasm).Argument1.ArgSize = 8;
    (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
    (*pMyDisasm).Argument2.ArgSize = 8;
    GV.EIP_++;
}
Ejemplo n.º 12
0
/* ====================================================================
 *      Legacy Prefix F3h-Group 1
 * ==================================================================== */
void __bea_callspec__ PrefREPE(PDISASM pMyDisasm)
{
    if (!Security(0, pMyDisasm)) return;
    (*pMyDisasm).Prefix.RepPrefix = SuperfluousPrefix;
    GV.EIP_++;
    (*pMyDisasm).Prefix.Number++;
    GV.NB_PREFIX++;
    GV.PrefRepe = 1;
    (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_);
    (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm);
    GV.PrefRepe = 0;
}
Ejemplo n.º 13
0
// ====================================================================
//      Legacy Prefix F0h - Group 1
// ====================================================================
void __stdcall PrefLock(PDISASM pMyDisasm)
{
    if (!Security(0)) return;
    (*pMyDisasm).Prefix.LockPrefix = InvalidPrefix;
    (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "lock ");
    EIP_++;
    (*pMyDisasm).Prefix.Number++;
    NB_PREFIX++;
    (*pMyDisasm).Instruction.Opcode = *((BYTE*) EIP_);
    (void) opcode_map1[*((BYTE*) EIP_)](pMyDisasm);
    OperandSize = 32;
}
Ejemplo n.º 14
0
// ====================================================================
//      Legacy Prefix 67h - Group 4
// ====================================================================
void __stdcall PrefAdSize(PDISASM pMyDisasm)
{
    if (!Security(0)) return;
    (*pMyDisasm).Prefix.AddressSize = InUsePrefix;
    EIP_++;
    (*pMyDisasm).Prefix.Number++;
    NB_PREFIX++;
    AddressSize = AddressSize >> 1;
    (*pMyDisasm).Instruction.Opcode = *((BYTE*) EIP_);
    (void) opcode_map1[*((BYTE*) EIP_)](pMyDisasm);
    AddressSize = AddressSize << 1;
}
Ejemplo n.º 15
0
// ====================================================================
//      Legacy Prefix 66h - Group 3
// ====================================================================
void __stdcall PrefOpSize(PDISASM pMyDisasm)
{
    if (!Security(0)) return;
    (*pMyDisasm).Prefix.OperandSize = InUsePrefix;
    EIP_++;
    (*pMyDisasm).Prefix.Number++;
    NB_PREFIX++;
    OperandSize = 16;
    (*pMyDisasm).Instruction.Opcode = *((BYTE*) EIP_);
    (void) opcode_map1[*((BYTE*) EIP_)](pMyDisasm);
    OperandSize = 32;
}
Ejemplo n.º 16
0
/* ====================================================================
 *
 * ==================================================================== */
void __bea_callspec__ EvIv(PDISASM pMyDisasm)
{
    if (GV.OperandSize >= 32) {
        if (GV.OperandSize == 64) {
            GV.MemDecoration = Arg1qword;
        }
        else {
            GV.MemDecoration = Arg1dword;
        }
        GV.ImmediatSize = 32;                       /* place this instruction before MOD_RM routine to inform it there is an immediat value */
        MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
        GV.EIP_ += GV.DECALAGE_EIP+6;
        if (!Security(0, pMyDisasm)) return;
        #ifndef BEA_LIGHT_DISASSEMBLY
            if (GV.OperandSize == 64) {
                (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.16llX",(Int64) *((Int32*)(UIntPtr) (GV.EIP_-4)));
            }
            else {
                (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64) *((UInt32*)(UIntPtr) (GV.EIP_-4)));
            }
        #endif

        (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
        (*pMyDisasm).Argument2.ArgSize = 32;
        (*pMyDisasm).Instruction.Immediat = *((UInt32*)(UIntPtr) (GV.EIP_-4));
    }
    else {
        GV.MemDecoration = Arg1word;
        GV.ImmediatSize = 16;
        MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
        GV.EIP_ += GV.DECALAGE_EIP+4;
        if (!Security(0, pMyDisasm)) return;
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.4X",(Int64)*((UInt16*)(UIntPtr) (GV.EIP_-2)));
        #endif
        (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
        (*pMyDisasm).Argument2.ArgSize = 16;
        (*pMyDisasm).Instruction.Immediat = *((UInt16*)(UIntPtr) (GV.EIP_-2));
    }
}
Ejemplo n.º 17
0
// ====================================================================
//      Legacy Prefix F3h - Group 1
// ====================================================================
void __stdcall PrefREPE(PDISASM pMyDisasm)
{
    if (!Security(0)) return;
    if (PrefRepe == 0) {
        (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "repe ");
    }
    (*pMyDisasm).Prefix.RepPrefix = SuperfluousPrefix;
    EIP_++;
    (*pMyDisasm).Prefix.Number++;
    NB_PREFIX++;
    PrefRepe = 1;
    (*pMyDisasm).Instruction.Opcode = *((BYTE*) EIP_);
    (void) opcode_map1[*((BYTE*) EIP_)](pMyDisasm);
    PrefRepe = 0;
}
Ejemplo n.º 18
0
/* ====================================================================
 *
 * ==================================================================== */
void __bea_callspec__ EbIb(PDISASM pMyDisasm)
{
    (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
    (*pMyDisasm).Argument2.ArgSize = 8;
    GV.ImmediatSize = 8;
    GV.MemDecoration = Arg1byte;
    GV.OperandSize = 8;
    MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
    GV.OperandSize = 32;
    GV.EIP_ += GV.DECALAGE_EIP+3;
    if (!Security(0, pMyDisasm)) return;
    #ifndef BEA_LIGHT_DISASSEMBLY
       (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64)*((Int8*)(UIntPtr) (GV.EIP_-1)));
    #endif
    (*pMyDisasm).Instruction.Immediat = *((UInt8*)(UIntPtr) (GV.EIP_-1));
}
Ejemplo n.º 19
0
/* ====================================================================
 *
 * ==================================================================== */
void __bea_callspec__ ALIb(PDISASM pMyDisasm)
{
    long MyNumber;
    if (!Security(2, pMyDisasm)) return;
    GV.ImmediatSize = 8;
    MyNumber = *((Int8*)(IntPtr) (GV.EIP_+1));
    #ifndef BEA_LIGHT_DISASSEMBLY
       (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber);
    #endif
    (*pMyDisasm).Instruction.Immediat = MyNumber;
    #ifndef BEA_LIGHT_DISASSEMBLY
       (void) strcpy((char*) &(*pMyDisasm).Argument1.ArgMnemonic, Registers8Bits[0]);
    #endif
    (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0;
    (*pMyDisasm).Argument1.ArgSize = 8;
    (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
    (*pMyDisasm).Argument2.ArgSize = 8;
    GV.EIP_ += 2;
}
Ejemplo n.º 20
0
/* ====================================================================
 *      Legacy Prefix 67h-Group 4
 * ==================================================================== */
void __bea_callspec__ PrefAdSize(PDISASM pMyDisasm)
{
    if (!Security(0, pMyDisasm)) return;
    (*pMyDisasm).Prefix.AddressSize = InUsePrefix;
    GV.EIP_++;
    (*pMyDisasm).Prefix.Number++;
    GV.NB_PREFIX++;
    if (GV.Architecture == 16) {
        GV.AddressSize = GV.AddressSize << 1;
    }
    else {
        GV.AddressSize = GV.AddressSize >> 1;
    }    

    (*pMyDisasm).Instruction.Opcode = *((UInt8*) (UIntPtr)GV.EIP_);
    (void) opcode_map1[*((UInt8*) (UIntPtr)GV.EIP_)](pMyDisasm);
    if (GV.Architecture == 16) {
        GV.AddressSize = GV.AddressSize >> 1;
    }
Ejemplo n.º 21
0
/* 
 * Command line argumentCount and argumentValues 
 */
int main(int argc, char** argv) 
{
    int     sockfd;                         /* socket file descriptor */
    struct  sockaddr_in servAddr;           /* struct for server address */
    int     ret = 0;                        /* variable for error checking */

    if (argc != 2) {
        /* if the number of arguments is not two, error */
        printf("usage: ./client-tcp  <IP address>\n");
        return EXIT_FAILURE;
    }

    /* internet address family, stream based tcp, default protocol */
    sockfd = socket(AF_INET, SOCK_STREAM, 0);

    if (sockfd < 0) {
        printf("Failed to create socket. Error: %i\n", errno);
        return EXIT_FAILURE;
    }
  
    memset(&servAddr, 0, sizeof(servAddr)); /* clears memory block for use */  
    servAddr.sin_family = AF_INET;          /* sets addressfamily to internet*/
    servAddr.sin_port = htons(SERV_PORT);   /* sets port to defined port */

    /* looks for the server at the entered address (ip in the command line) */
    if (inet_pton(AF_INET, argv[1], &servAddr.sin_addr) < 1) {
        /* checks validity of address */
        ret = errno;
        printf("Invalid Address. Error: %i\n", ret);
        return EXIT_FAILURE;
    }

    if (connect(sockfd, (struct sockaddr *) &servAddr, sizeof(servAddr)) < 0) {
        /* if socket fails to connect to the server*/
        ret = errno;
        printf("Connect error. Error: %i\n", ret);
        return EXIT_FAILURE;
    }
    Security(sockfd);

    return ret;
}
Ejemplo n.º 22
0
EventData Communicator::deleteEvent(int id)
{
    return editEvent(id, "", "", Security(), QDateTime(),
                     EventProperties(), "");
}
Ejemplo n.º 23
0
/* ====================================================================
 *
 * ==================================================================== */
void __bea_callspec__ G12_(PDISASM pMyDisasm)
{
    long MyNumber;

    GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_+1))) >> 3) & 0x7;
    if (GV.REGOPCODE == 2) {
        if (GV.OperandSize == 16) {
            (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE;
            GV.MemDecoration = Arg1dqword;
            GV.ImmediatSize = 8;
            GV.SSE_ = 1;
            MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
            GV.SSE_ = 0;
            if (GV.MOD_== 0x3) {
                #ifndef BEA_LIGHT_DISASSEMBLY
                   (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw ");
                #endif
            }
            else {
                FailDecode(pMyDisasm);
            }
            GV.EIP_ += GV.DECALAGE_EIP+3;
            if (!Security(0, pMyDisasm)) return;

            MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1));
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber);
            #endif
            (*pMyDisasm).Instruction.Immediat = MyNumber;
            (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
            (*pMyDisasm).Argument2.ArgSize = 8;
        }
        else {
            (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE;
            GV.MemDecoration = Arg1qword;
            GV.ImmediatSize = 8;
            GV.MMX_ = 1;
            MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
            GV.MMX_ = 0;
            if (GV.MOD_== 0x3) {
                #ifndef BEA_LIGHT_DISASSEMBLY
                   (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psrlw ");
                #endif
            }
            else {
                FailDecode(pMyDisasm);
            }
            GV.EIP_ += GV.DECALAGE_EIP+3;
            if (!Security(0, pMyDisasm)) return;

            MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1));
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber);
            #endif
            (*pMyDisasm).Instruction.Immediat = MyNumber;
            (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
            (*pMyDisasm).Argument2.ArgSize = 8;
        }
    }
    else if (GV.REGOPCODE == 4) {
        if (GV.OperandSize == 16) {
            (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE;
            GV.MemDecoration = Arg1dqword;
            GV.ImmediatSize = 8;
            GV.SSE_ = 1;
            MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
            GV.SSE_ = 0;
            if (GV.MOD_== 0x3) {
                #ifndef BEA_LIGHT_DISASSEMBLY
                   (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw ");
                #endif
            }
            else {
                FailDecode(pMyDisasm);
            }
            GV.EIP_ += GV.DECALAGE_EIP+3;
            if (!Security(0, pMyDisasm)) return;

            MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1));
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber);
            #endif
            (*pMyDisasm).Instruction.Immediat = MyNumber;
            (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
            (*pMyDisasm).Argument2.ArgSize = 8;
        }
        else {
            (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE;
            GV.MemDecoration = Arg1qword;
            GV.ImmediatSize = 8;
            GV.MMX_ = 1;
            MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
            GV.MMX_ = 0;
            if (GV.MOD_== 0x3) {
                #ifndef BEA_LIGHT_DISASSEMBLY
                   (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psraw ");
                #endif
            }
            else {
                FailDecode(pMyDisasm);
            }
            GV.EIP_ += GV.DECALAGE_EIP+3;
            if (!Security(0, pMyDisasm)) return;

            MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1));
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber);
            #endif
            (*pMyDisasm).Instruction.Immediat = MyNumber;
            (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
            (*pMyDisasm).Argument2.ArgSize = 8;
        }

    }
    else if (GV.REGOPCODE == 6) {
        if (GV.OperandSize == 16) {
            (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE;
            GV.MemDecoration = Arg1dqword;
            GV.ImmediatSize = 8;
            GV.SSE_ = 1;
            MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
            GV.SSE_ = 0;
            if (GV.MOD_== 0x3) {
                #ifndef BEA_LIGHT_DISASSEMBLY
                   (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw ");
                #endif
            }
            else {
                FailDecode(pMyDisasm);
            }
            GV.EIP_ += GV.DECALAGE_EIP+3;
            if (!Security(0, pMyDisasm)) return;

            MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1));
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber);
            #endif
            (*pMyDisasm).Instruction.Immediat = MyNumber;
            (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
            (*pMyDisasm).Argument2.ArgSize = 8;
        }
        else {
            (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE;
            GV.MemDecoration = Arg1qword;
            GV.ImmediatSize = 8;
            GV.MMX_ = 1;
            MOD_RM(&(*pMyDisasm).Argument1, pMyDisasm);
            GV.MMX_ = 0;
            if (GV.MOD_== 0x3) {
                #ifndef BEA_LIGHT_DISASSEMBLY
                   (void) strcpy ((*pMyDisasm).Instruction.Mnemonic, "psllw ");
                #endif
            }
            else {
                FailDecode(pMyDisasm);
            }
            GV.EIP_ += GV.DECALAGE_EIP+3;
            if (!Security(0, pMyDisasm)) return;

            MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1));
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.2X",(Int64) MyNumber);
            #endif
            (*pMyDisasm).Instruction.Immediat = MyNumber;
            (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
            (*pMyDisasm).Argument2.ArgSize = 8;
        }
    }

    else {
        FailDecode(pMyDisasm);
    }

}
Ejemplo n.º 24
0
/* ====================================================================
 *
 * ==================================================================== */
void __bea_callspec__ eAX_Iv(PDISASM pMyDisasm)
{
    UInt32 MyNumber;
    (*pMyDisasm).Argument1.ArgType = REGISTER_TYPE+GENERAL_REG+REG0;
    (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
    if (GV.OperandSize == 64) {
        if (!Security(5, pMyDisasm)) return;
        GV.ImmediatSize = 32;
        (*pMyDisasm).Argument1.ArgSize = 64;
        (*pMyDisasm).Argument2.ArgSize = 32;
        MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_+1));
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.16llX",(Int64) MyNumber);
        #endif
        (*pMyDisasm).Instruction.Immediat = MyNumber;
         if (GV.REX.B_ == 1) {
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0+8]);
            #endif
        }
        else {
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers64Bits[0]);
            #endif
        }
        GV.EIP_+= 5;
    }
    else if (GV.OperandSize == 32) {
        if (!Security(5, pMyDisasm)) return;
        GV.ImmediatSize = 32;
        (*pMyDisasm).Argument1.ArgSize = 32;
        (*pMyDisasm).Argument2.ArgSize = 32;
        MyNumber = *((UInt32*)(UIntPtr) (GV.EIP_+1));
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X",(Int64) MyNumber);
        #endif
        (*pMyDisasm).Instruction.Immediat = MyNumber;
         if (GV.REX.B_ == 1) {
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0+8]);
            #endif
        }
        else {
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers32Bits[0]);
            #endif
        }
        GV.EIP_+= 5;
    }
    else {
        if (!Security(3, pMyDisasm)) return;
        GV.ImmediatSize = 16;
        (*pMyDisasm).Argument1.ArgSize = 16;
        (*pMyDisasm).Argument2.ArgSize = 16;
        MyNumber = *((UInt16*)(UIntPtr) (GV.EIP_+1));
        #ifndef BEA_LIGHT_DISASSEMBLY
           (void) CopyFormattedNumber(pMyDisasm, (char*) &(*pMyDisasm).Argument2.ArgMnemonic,"%.8X", (Int64) MyNumber);
        #endif
        (*pMyDisasm).Instruction.Immediat = MyNumber;
         if (GV.REX.B_ == 1) {
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0+8]);
            #endif
        }
        else {
            #ifndef BEA_LIGHT_DISASSEMBLY
               (void) strcpy ((char*) (*pMyDisasm).Argument1.ArgMnemonic, Registers16Bits[0]);
            #endif
        }
        GV.EIP_+= 3;
    }

}
Ejemplo n.º 25
0
/* ====================================================================
 *
 * ==================================================================== */
void __bea_callspec__ G13_(PDISASM pMyDisasm)
{
    Int32 MyNumber;

    GV.REGOPCODE = ((*((UInt8*)(UIntPtr) (GV.EIP_))) >> 3) & 0x7;
    if (GV.REGOPCODE == 2) {
        GV.ImmediatSize = 8;
        if ((*pMyDisasm).Prefix.OperandSizeState == InUsePrefix) {
            PrefOpSizeMandatory(pMyDisasm);
            (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE;
            MOD_RM_SSE(&(*pMyDisasm).Argument1, pMyDisasm);
        }
        else {
            (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE;
            MOD_RM_MMX(&(*pMyDisasm).Argument1, pMyDisasm);
        }
        (*pMyDisasm).Argument1.AccessMode = READ+WRITE;
        if (GV.MOD_== 0x3) {
            (*pMyDisasm).Instruction.Mnemonic = I_PSRLD;
        }
        else {
            FailDecode(pMyDisasm);
        }
        GV.EIP_ += 2;
        if (!Security(0, pMyDisasm)) return;

        MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1));
        (*pMyDisasm).Instruction.Immediat = MyNumber;
        (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
        (*pMyDisasm).Argument2.ArgSize = 8;
    }
    else if (GV.REGOPCODE == 4) {
        GV.ImmediatSize = 8;
        if ((*pMyDisasm).Prefix.OperandSizeState == InUsePrefix) {
            PrefOpSizeMandatory(pMyDisasm);
            (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE;
            (*pMyDisasm).Argument1.ArgSize = 128;
            MOD_RM_SSE(&(*pMyDisasm).Argument1, pMyDisasm);
        }
        else {
            (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE;
            MOD_RM_MMX(&(*pMyDisasm).Argument1, pMyDisasm);
        }
        (*pMyDisasm).Argument1.AccessMode = READ+WRITE;
        if (GV.MOD_== 0x3) {
            (*pMyDisasm).Instruction.Mnemonic = I_PSRAD;
        }
        else {
            FailDecode(pMyDisasm);
        }
        GV.EIP_ += 2;
        if (!Security(0, pMyDisasm)) return;

        MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1));
        (*pMyDisasm).Instruction.Immediat = MyNumber;
        (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
        (*pMyDisasm).Argument2.ArgSize = 8;
    }
    else if (GV.REGOPCODE == 6) {
        GV.ImmediatSize = 8;
        if ((*pMyDisasm).Prefix.OperandSizeState == InUsePrefix) {
            PrefOpSizeMandatory(pMyDisasm);
            (*pMyDisasm).Instruction.Category = SSE_INSTRUCTION+SHIFT_ROTATE;
            (*pMyDisasm).Argument1.ArgSize = 128;
            MOD_RM_SSE(&(*pMyDisasm).Argument1, pMyDisasm);
        }
        else {
            (*pMyDisasm).Instruction.Category = MMX_INSTRUCTION+SHIFT_ROTATE;
            MOD_RM_MMX(&(*pMyDisasm).Argument1, pMyDisasm);
        }
        (*pMyDisasm).Argument1.AccessMode = READ+WRITE;
        if (GV.MOD_== 0x3) {
            (*pMyDisasm).Instruction.Mnemonic = I_PSLLD;
        }
        else {
            FailDecode(pMyDisasm);
        }
        GV.EIP_ += 2;
        if (!Security(0, pMyDisasm)) return;

        MyNumber = *((UInt8*)(UIntPtr) (GV.EIP_-1));
        (*pMyDisasm).Instruction.Immediat = MyNumber;
        (*pMyDisasm).Argument2.ArgType = CONSTANT_TYPE+ABSOLUTE_;
        (*pMyDisasm).Argument2.ArgSize = 8;
    }

    else {
        FailDecode(pMyDisasm);
    }

}