duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

GetRelInfo.inc (2096B)


      1 const ZydisEncoderRelInfo *ZydisGetRelInfo(ZydisMnemonic mnemonic)
      2 {
      3     static const ZydisEncoderRelInfo info_lookup[9] =
      4     {
      5         { { { 0, 3, 6 }, { 0, 4, 5 }, { 0, 0, 5 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
      6         { { { 2, 4, 7 }, { 2, 5, 6 }, { 2, 0, 6 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_TRUE },
      7         { { { 2, 0, 0 }, { 3, 0, 0 }, { 0, 0, 0 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
      8         { { { 3, 0, 0 }, { 2, 0, 0 }, { 3, 0, 0 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
      9         { { { 0, 0, 0 }, { 0, 0, 0 }, { 5, 0, 7 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
     10         { { { 2, 3, 6 }, { 2, 4, 5 }, { 2, 0, 5 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
     11         { { { 0, 0, 0 }, { 0, 0, 0 }, { 2, 0, 0 } }, ZYDIS_SIZE_HINT_NONE, ZYAN_FALSE },
     12         { { { 2, 0, 0 }, { 2, 0, 0 }, { 2, 0, 0 } }, ZYDIS_SIZE_HINT_ASZ, ZYAN_FALSE },
     13         { { { 0, 4, 7 }, { 0, 5, 6 }, { 0, 5, 6 } }, ZYDIS_SIZE_HINT_OSZ, ZYAN_FALSE },
     14     };
     15 
     16     switch (mnemonic)
     17     {
     18     case ZYDIS_MNEMONIC_CALL:
     19         return &info_lookup[0];
     20     case ZYDIS_MNEMONIC_JB:
     21     case ZYDIS_MNEMONIC_JBE:
     22     case ZYDIS_MNEMONIC_JL:
     23     case ZYDIS_MNEMONIC_JLE:
     24     case ZYDIS_MNEMONIC_JNB:
     25     case ZYDIS_MNEMONIC_JNBE:
     26     case ZYDIS_MNEMONIC_JNL:
     27     case ZYDIS_MNEMONIC_JNLE:
     28     case ZYDIS_MNEMONIC_JNO:
     29     case ZYDIS_MNEMONIC_JNP:
     30     case ZYDIS_MNEMONIC_JNS:
     31     case ZYDIS_MNEMONIC_JNZ:
     32     case ZYDIS_MNEMONIC_JO:
     33     case ZYDIS_MNEMONIC_JP:
     34     case ZYDIS_MNEMONIC_JS:
     35     case ZYDIS_MNEMONIC_JZ:
     36         return &info_lookup[1];
     37     case ZYDIS_MNEMONIC_JCXZ:
     38         return &info_lookup[2];
     39     case ZYDIS_MNEMONIC_JECXZ:
     40         return &info_lookup[3];
     41     case ZYDIS_MNEMONIC_JKNZD:
     42     case ZYDIS_MNEMONIC_JKZD:
     43         return &info_lookup[4];
     44     case ZYDIS_MNEMONIC_JMP:
     45         return &info_lookup[5];
     46     case ZYDIS_MNEMONIC_JRCXZ:
     47         return &info_lookup[6];
     48     case ZYDIS_MNEMONIC_LOOP:
     49     case ZYDIS_MNEMONIC_LOOPE:
     50     case ZYDIS_MNEMONIC_LOOPNE:
     51         return &info_lookup[7];
     52     case ZYDIS_MNEMONIC_XBEGIN:
     53         return &info_lookup[8];
     54     default:
     55         return ZYAN_NULL;
     56     }
     57 }
     58