LCOV - code coverage report
Current view: directory - src/trusted/validator/x86 - x86_insts.c (source / functions) Found Hit Coverage
Test: coverage.lcov Lines: 27 6 22.2 %
Date: 2014-09-25 Functions: 0 0 -

       1                 : /*
       2                 :  * Copyright (c) 2011 The Native Client Authors. All rights reserved.
       3                 :  * Use of this source code is governed by a BSD-style license that can be
       4                 :  * found in the LICENSE file.
       5                 :  */
       6                 : 
       7                 : #include "native_client/src/trusted/validator/x86/x86_insts.h"
       8                 : 
       9                 : #include "native_client/src/trusted/validator/x86/x86_insts_inl.c"
      10                 : 
      11                 : /* Defines the range of possible (initial) opcodes for x87 instructions. */
      12                 : const uint8_t kFirstX87Opcode = 0xd8;
      13                 : const uint8_t kLastX87Opcode = 0xdf;
      14                 : 
      15                 : /* Defines the opcode for the WAIT instruction.
      16                 :  * Note: WAIT is an x87 instruction but not in the coproc opcode space.
      17                 :  */
      18                 : const uint8_t kWAITOp = 0x9b;
      19                 : 
      20                 : const uint8_t kTwoByteOpcodeByte1 = 0x0f;
      21                 : const uint8_t k3DNowOpcodeByte2 = 0x0f;
      22                 : const int kMaxPrefixBytes = 4;
      23                 : 
      24                 : /* Accessors for the ModRm byte. */
      25               0 : uint8_t modrm_mod(uint8_t modrm) {
      26               0 :   return modrm_modInline(modrm);
      27               0 : }
      28                 : 
      29               0 : uint8_t modrm_rm(uint8_t modrm) {
      30               0 :   return modrm_rmInline(modrm);
      31               0 : }
      32                 : 
      33               0 : uint8_t modrm_reg(uint8_t modrm) {
      34               0 :   return modrm_regInline(modrm);
      35               0 : }
      36                 : 
      37               0 : uint8_t modrm_opcode(uint8_t modrm) {
      38               0 :   return modrm_opcodeInline(modrm);
      39               0 : }
      40                 : 
      41                 : /* Accessors for the Sib byte. */
      42               2 : uint8_t sib_ss(uint8_t sib) { return ((sib >> 6) & 0x03); }
      43               2 : uint8_t sib_index(uint8_t sib) { return ((sib >> 3) & 0x07); }
      44               2 : uint8_t sib_base(uint8_t sib) { return (sib & 0x07); }
      45                 : 
      46                 : /* Defines the corresponding mask for the bits of the the Rex prefix. */
      47                 : #define NaClRexWMask 0x8
      48                 : #define NaClRexRMask 0x4
      49                 : #define NaClRexXMask 0x2
      50                 : #define NaClRexBMask 0x1
      51                 : 
      52                 : /* Defines the range of rex prefix values. */
      53                 : const uint8_t NaClRexMin = 0x40;
      54                 : const uint8_t NaClRexMax = 0x4F;
      55                 : 
      56               1 : uint8_t NaClRexW(uint8_t prefix) {
      57               1 :   return NaClHasBit(prefix, NaClRexWMask);
      58               1 : }
      59                 : 
      60               0 : uint8_t NaClRexR(uint8_t prefix) {
      61               0 :   return NaClHasBit(prefix, NaClRexRMask);
      62               0 : }
      63                 : 
      64               0 : uint8_t NaClRexX(uint8_t prefix) {
      65               0 :   return NaClHasBit(prefix, NaClRexXMask);
      66               0 : }
      67                 : 
      68               0 : uint8_t NaClRexB(uint8_t prefix) {
      69               0 :   return NaClHasBit(prefix, NaClRexBMask);
      70               0 : }

Generated by: LCOV version 1.7