decoder.hh (9376:270c9a75e91f) decoder.hh (9377:6f294e7a93d1)
1/*
2 * Copyright (c) 2012 Google
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 30 unchanged lines hidden (view full) ---

39#include "base/bitfield.hh"
40#include "base/misc.hh"
41#include "base/trace.hh"
42#include "base/types.hh"
43#include "cpu/decode_cache.hh"
44#include "cpu/static_inst.hh"
45#include "debug/Decoder.hh"
46
1/*
2 * Copyright (c) 2012 Google
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 30 unchanged lines hidden (view full) ---

39#include "base/bitfield.hh"
40#include "base/misc.hh"
41#include "base/trace.hh"
42#include "base/types.hh"
43#include "cpu/decode_cache.hh"
44#include "cpu/static_inst.hh"
45#include "debug/Decoder.hh"
46
47class ThreadContext;
48
49namespace X86ISA
50{
51
52class Decoder
53{
54 private:
55 //These are defined and documented in decoder_tables.cc
56 static const uint8_t Prefixes[256];

--- 10 unchanged lines hidden (view full) ---

67 int lastOffset;
68
69 InstBytes() : lastOffset(0)
70 {}
71 };
72
73 static InstBytes dummy;
74
47namespace X86ISA
48{
49
50class Decoder
51{
52 private:
53 //These are defined and documented in decoder_tables.cc
54 static const uint8_t Prefixes[256];

--- 10 unchanged lines hidden (view full) ---

65 int lastOffset;
66
67 InstBytes() : lastOffset(0)
68 {}
69 };
70
71 static InstBytes dummy;
72
75 ThreadContext * tc;
76 //The bytes to be predecoded
77 MachInst fetchChunk;
78 InstBytes *instBytes;
79 int chunkIdx;
80 //The pc of the start of fetchChunk
81 Addr basePC;
82 //The pc the current instruction started at
83 Addr origPC;

--- 116 unchanged lines hidden (view full) ---

200 typedef m5::hash_map<CacheKey, DecodePages *> AddrCacheMap;
201 AddrCacheMap addrCacheMap;
202
203 DecodeCache::InstMap *instMap;
204 typedef m5::hash_map<CacheKey, DecodeCache::InstMap *> InstCacheMap;
205 static InstCacheMap instCacheMap;
206
207 public:
73 //The bytes to be predecoded
74 MachInst fetchChunk;
75 InstBytes *instBytes;
76 int chunkIdx;
77 //The pc of the start of fetchChunk
78 Addr basePC;
79 //The pc the current instruction started at
80 Addr origPC;

--- 116 unchanged lines hidden (view full) ---

197 typedef m5::hash_map<CacheKey, DecodePages *> AddrCacheMap;
198 AddrCacheMap addrCacheMap;
199
200 DecodeCache::InstMap *instMap;
201 typedef m5::hash_map<CacheKey, DecodeCache::InstMap *> InstCacheMap;
202 static InstCacheMap instCacheMap;
203
204 public:
208 Decoder(ThreadContext * _tc) :
209 tc(_tc), basePC(0), origPC(0), offset(0),
205 Decoder() : basePC(0), origPC(0), offset(0),
210 outOfBytes(true), instDone(false),
211 state(ResetState)
212 {
213 memset(&emi, 0, sizeof(emi));
214 mode = LongMode;
215 submode = SixtyFourBitMode;
216 emi.mode.mode = mode;
217 emi.mode.submode = submode;

--- 36 unchanged lines hidden (view full) ---

254 }
255 }
256
257 void reset()
258 {
259 state = ResetState;
260 }
261
206 outOfBytes(true), instDone(false),
207 state(ResetState)
208 {
209 memset(&emi, 0, sizeof(emi));
210 mode = LongMode;
211 submode = SixtyFourBitMode;
212 emi.mode.mode = mode;
213 emi.mode.submode = submode;

--- 36 unchanged lines hidden (view full) ---

250 }
251 }
252
253 void reset()
254 {
255 state = ResetState;
256 }
257
262 ThreadContext * getTC()
263 {
264 return tc;
265 }
266
267 void setTC(ThreadContext * _tc)
268 {
269 tc = _tc;
270 }
271
272 void process();
273
274 //Use this to give data to the decoder. This should be used
275 //when there is control flow.
276 void moreBytes(const PCState &pc, Addr fetchPC, MachInst data)
277 {
278 DPRINTF(Decoder, "Getting more bytes.\n");
279 basePC = fetchPC;

--- 43 unchanged lines hidden ---
258 void process();
259
260 //Use this to give data to the decoder. This should be used
261 //when there is control flow.
262 void moreBytes(const PCState &pc, Addr fetchPC, MachInst data)
263 {
264 DPRINTF(Decoder, "Getting more bytes.\n");
265 basePC = fetchPC;

--- 43 unchanged lines hidden ---