Home | History | Annotate | Download | only in sidestep
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 // Table of relevant information about how to decode the ModR/M byte.
      6 // Based on information in the IA-32 Intel Architecture
      7 // Software Developer's Manual Volume 2: Instruction Set Reference.
      8 
      9 #include "sandbox/win/src/sidestep/mini_disassembler.h"
     10 #include "sandbox/win/src/sidestep/mini_disassembler_types.h"
     11 
     12 namespace sidestep {
     13 
     14 const ModrmEntry MiniDisassembler::s_ia16_modrm_map_[] = {
     15 // mod == 00
     16   /* r/m == 000 */ { false, false, OS_ZERO },
     17   /* r/m == 001 */ { false, false, OS_ZERO },
     18   /* r/m == 010 */ { false, false, OS_ZERO },
     19   /* r/m == 011 */ { false, false, OS_ZERO },
     20   /* r/m == 100 */ { false, false, OS_ZERO },
     21   /* r/m == 101 */ { false, false, OS_ZERO },
     22   /* r/m == 110 */ { true, false, OS_WORD },
     23   /* r/m == 111 */ { false, false, OS_ZERO },
     24 // mod == 01
     25   /* r/m == 000 */ { true, false, OS_BYTE },
     26   /* r/m == 001 */ { true, false, OS_BYTE },
     27   /* r/m == 010 */ { true, false, OS_BYTE },
     28   /* r/m == 011 */ { true, false, OS_BYTE },
     29   /* r/m == 100 */ { true, false, OS_BYTE },
     30   /* r/m == 101 */ { true, false, OS_BYTE },
     31   /* r/m == 110 */ { true, false, OS_BYTE },
     32   /* r/m == 111 */ { true, false, OS_BYTE },
     33 // mod == 10
     34   /* r/m == 000 */ { true, false, OS_WORD },
     35   /* r/m == 001 */ { true, false, OS_WORD },
     36   /* r/m == 010 */ { true, false, OS_WORD },
     37   /* r/m == 011 */ { true, false, OS_WORD },
     38   /* r/m == 100 */ { true, false, OS_WORD },
     39   /* r/m == 101 */ { true, false, OS_WORD },
     40   /* r/m == 110 */ { true, false, OS_WORD },
     41   /* r/m == 111 */ { true, false, OS_WORD },
     42 // mod == 11
     43   /* r/m == 000 */ { false, false, OS_ZERO },
     44   /* r/m == 001 */ { false, false, OS_ZERO },
     45   /* r/m == 010 */ { false, false, OS_ZERO },
     46   /* r/m == 011 */ { false, false, OS_ZERO },
     47   /* r/m == 100 */ { false, false, OS_ZERO },
     48   /* r/m == 101 */ { false, false, OS_ZERO },
     49   /* r/m == 110 */ { false, false, OS_ZERO },
     50   /* r/m == 111 */ { false, false, OS_ZERO }
     51 };
     52 
     53 const ModrmEntry MiniDisassembler::s_ia32_modrm_map_[] = {
     54 // mod == 00
     55   /* r/m == 000 */ { false, false, OS_ZERO },
     56   /* r/m == 001 */ { false, false, OS_ZERO },
     57   /* r/m == 010 */ { false, false, OS_ZERO },
     58   /* r/m == 011 */ { false, false, OS_ZERO },
     59   /* r/m == 100 */ { false, true, OS_ZERO },
     60   /* r/m == 101 */ { true, false, OS_DOUBLE_WORD },
     61   /* r/m == 110 */ { false, false, OS_ZERO },
     62   /* r/m == 111 */ { false, false, OS_ZERO },
     63 // mod == 01
     64   /* r/m == 000 */ { true, false, OS_BYTE },
     65   /* r/m == 001 */ { true, false, OS_BYTE },
     66   /* r/m == 010 */ { true, false, OS_BYTE },
     67   /* r/m == 011 */ { true, false, OS_BYTE },
     68   /* r/m == 100 */ { true, true, OS_BYTE },
     69   /* r/m == 101 */ { true, false, OS_BYTE },
     70   /* r/m == 110 */ { true, false, OS_BYTE },
     71   /* r/m == 111 */ { true, false, OS_BYTE },
     72 // mod == 10
     73   /* r/m == 000 */ { true, false, OS_DOUBLE_WORD },
     74   /* r/m == 001 */ { true, false, OS_DOUBLE_WORD },
     75   /* r/m == 010 */ { true, false, OS_DOUBLE_WORD },
     76   /* r/m == 011 */ { true, false, OS_DOUBLE_WORD },
     77   /* r/m == 100 */ { true, true, OS_DOUBLE_WORD },
     78   /* r/m == 101 */ { true, false, OS_DOUBLE_WORD },
     79   /* r/m == 110 */ { true, false, OS_DOUBLE_WORD },
     80   /* r/m == 111 */ { true, false, OS_DOUBLE_WORD },
     81 // mod == 11
     82   /* r/m == 000 */ { false, false, OS_ZERO },
     83   /* r/m == 001 */ { false, false, OS_ZERO },
     84   /* r/m == 010 */ { false, false, OS_ZERO },
     85   /* r/m == 011 */ { false, false, OS_ZERO },
     86   /* r/m == 100 */ { false, false, OS_ZERO },
     87   /* r/m == 101 */ { false, false, OS_ZERO },
     88   /* r/m == 110 */ { false, false, OS_ZERO },
     89   /* r/m == 111 */ { false, false, OS_ZERO },
     90 };
     91 
     92 };  // namespace sidestep
     93