decoder.cc (10037:5cac77888310) | decoder.cc (10610:5fae03bd840a) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2012-2013 ARM Limited | 2 * Copyright (c) 2012-2014 ARM Limited |
3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 35 unchanged lines hidden (view full) --- 46#include "base/trace.hh" 47#include "debug/Decoder.hh" 48 49namespace ArmISA 50{ 51 52GenericISA::BasicDecodeCache Decoder::defaultCache; 53 | 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 35 unchanged lines hidden (view full) --- 46#include "base/trace.hh" 47#include "debug/Decoder.hh" 48 49namespace ArmISA 50{ 51 52GenericISA::BasicDecodeCache Decoder::defaultCache; 53 |
54Decoder::Decoder() 55 : data(0), fpscrLen(0), fpscrStride(0) 56{ 57 reset(); 58} 59 |
|
54void | 60void |
61Decoder::reset() 62{ 63 bigThumb = false; 64 offset = 0; 65 emi = 0; 66 instDone = false; 67 outOfBytes = true; 68 foundIt = false; 69} 70 71void |
|
55Decoder::process() 56{ 57 // emi is typically ready, with some caveats below... 58 instDone = true; 59 60 if (!emi.thumb) { 61 emi.instBits = data; 62 if (!emi.aarch64) { --- 50 unchanged lines hidden (view full) --- 113 "IT detected, cond = %#x, mask = %#x\n", 114 itBits.cond, itBits.mask); 115 } 116 } 117 } 118 } 119} 120 | 72Decoder::process() 73{ 74 // emi is typically ready, with some caveats below... 75 instDone = true; 76 77 if (!emi.thumb) { 78 emi.instBits = data; 79 if (!emi.aarch64) { --- 50 unchanged lines hidden (view full) --- 130 "IT detected, cond = %#x, mask = %#x\n", 131 itBits.cond, itBits.mask); 132 } 133 } 134 } 135 } 136} 137 |
121//Use this to give data to the decoder. This should be used 122//when there is control flow. | |
123void | 138void |
139Decoder::consumeBytes(int numBytes) 140{ 141 offset += numBytes; 142 assert(offset <= sizeof(MachInst)); 143 if (offset == sizeof(MachInst)) 144 outOfBytes = true; 145} 146 147void |
|
124Decoder::moreBytes(const PCState &pc, Addr fetchPC, MachInst inst) 125{ 126 data = inst; 127 offset = (fetchPC >= pc.instAddr()) ? 0 : pc.instAddr() - fetchPC; 128 emi.thumb = pc.thumb(); 129 emi.aarch64 = pc.aarch64(); 130 emi.fpscrLen = fpscrLen; 131 emi.fpscrStride = fpscrStride; 132 133 outOfBytes = false; 134 process(); 135} 136 | 148Decoder::moreBytes(const PCState &pc, Addr fetchPC, MachInst inst) 149{ 150 data = inst; 151 offset = (fetchPC >= pc.instAddr()) ? 0 : pc.instAddr() - fetchPC; 152 emi.thumb = pc.thumb(); 153 emi.aarch64 = pc.aarch64(); 154 emi.fpscrLen = fpscrLen; 155 emi.fpscrStride = fpscrStride; 156 157 outOfBytes = false; 158 process(); 159} 160 |
161StaticInstPtr 162Decoder::decode(ArmISA::PCState &pc) 163{ 164 if (!instDone) 165 return NULL; 166 167 const int inst_size((!emi.thumb || emi.bigThumb) ? 4 : 2); 168 ExtMachInst this_emi(emi); 169 170 pc.npc(pc.pc() + inst_size); 171 if (foundIt) 172 pc.nextItstate(itBits); 173 this_emi.itstate = pc.itstate(); 174 pc.size(inst_size); 175 176 emi = 0; 177 instDone = false; 178 foundIt = false; 179 180 return decode(this_emi, pc.instAddr()); |
|
137} | 181} |
182 183} |
|