source: rtems-tools/tester/covoar/Target_i386.cc @ 3e187ba

5
Last change on this file since 3e187ba was 100f517, checked in by Chris Johns <chrisj@…>, on 05/09/14 at 11:50:37

covoar: Merger the covoar source from rtems-testing.git.

Use waf to build covoar.

  • Property mode set to 100644
File size: 2.8 KB
Line 
1/*! @file Target_i386.cc
2 *  @brief Target_i386 Implementation
3 *
4 *  This file contains the implementation of the base class for
5 *  functions supporting target unique functionallity.
6 */
7
8#include "Target_i386.h"
9#include "qemu-traces.h"
10#include <stdlib.h>
11#include <string.h>
12#include <unistd.h>
13
14namespace Target {
15
16  Target_i386::Target_i386( std::string targetName ):
17    TargetBase( targetName )
18  {
19    branchInstructions.push_back("ja");
20    branchInstructions.push_back("jb");
21    branchInstructions.push_back("jc");
22    branchInstructions.push_back("je");
23    branchInstructions.push_back("jg");
24    branchInstructions.push_back("jl");
25    branchInstructions.push_back("jo");
26    branchInstructions.push_back("jp");
27    branchInstructions.push_back("js");
28    branchInstructions.push_back("jz");
29    branchInstructions.push_back("jae");
30    branchInstructions.push_back("jbe");
31    branchInstructions.push_back("jge");
32    branchInstructions.push_back("jle");
33    branchInstructions.push_back("jne");
34    branchInstructions.push_back("jna");
35    branchInstructions.push_back("jnb");
36    branchInstructions.push_back("jnc");
37    branchInstructions.push_back("jne");
38    branchInstructions.push_back("jng");
39    branchInstructions.push_back("jnl");
40    branchInstructions.push_back("jno");
41    branchInstructions.push_back("jnp");
42    branchInstructions.push_back("jns");
43    branchInstructions.push_back("jnz");
44    branchInstructions.push_back("jpe");
45    branchInstructions.push_back("jpo");
46    branchInstructions.push_back("jnbe");
47    branchInstructions.push_back("jnae");
48    branchInstructions.push_back("jnle");
49    branchInstructions.push_back("jnge");
50
51    branchInstructions.sort();
52
53  }
54
55  Target_i386::~Target_i386()
56  {
57  }
58
59  bool Target_i386::isNopLine(
60    const char* const line,
61    int&              size
62  )
63  {
64    if (!strcmp( &line[strlen(line)-3], "nop")) {
65      size = 1;
66      return true;
67    }
68
69    // i386 has some two and three byte nops
70    if (!strncmp( &line[strlen(line)-14], "xchg   %ax,%ax", 14)) {
71      size = 2;
72      return true;
73    }
74    if (!strncmp( &line[strlen(line)-16], "xor    %eax,%eax", 16)) {
75      size = 2;
76      return true;
77    }
78    if (!strncmp( &line[strlen(line)-16], "xor    %ebx,%ebx", 16)) {
79      size = 2;
80      return true;
81    }
82    if (!strncmp( &line[strlen(line)-16], "xor    %esi,%esi", 16)) {
83      size = 2;
84      return true;
85    }
86    if (!strncmp( &line[strlen(line)-21], "lea    0x0(%esi),%esi", 21)) {
87      size = 3;
88      return true;
89    }
90
91    return false;
92  }
93
94  uint8_t Target_i386::qemuTakenBit(void)
95  {
96    return TRACE_OP_BR1;
97  }
98
99  uint8_t Target_i386::qemuNotTakenBit(void)
100  {
101    return TRACE_OP_BR0;
102  }
103
104  TargetBase *Target_i386_Constructor(
105    std::string          targetName
106  )
107  {
108    return new Target_i386( targetName );
109  }
110
111}
Note: See TracBrowser for help on using the repository browser.