41 #ifndef __ARCH_ARM_PCSTATE_HH__
42 #define __ARCH_ARM_PCSTATE_HH__
47 #include "debug/Decoder.hh"
69 class
PCState : public GenericISA::UPCState<4>
78 JazelleBit = (1 << 1),
83 uint8_t nextFlags = 0;
85 uint8_t _nextItstate = 0;
87 bool _illegalExec =
false;
90 bool _debugStep =
false;
91 bool _stepped =
false;
102 flags(other.flags), nextFlags(other.nextFlags),
103 _itstate(other._itstate), _nextItstate(other._nextItstate),
104 _size(other._size), _illegalExec(other._illegalExec),
105 _debugStep(other._debugStep), _stepped(other._stepped)
119 flags = pcstate.flags;
120 nextFlags = pcstate.nextFlags;
121 _itstate = pcstate._itstate;
122 _nextItstate = pcstate._nextItstate;
123 _size = pcstate._size;
124 _illegalExec = pcstate._illegalExec;
125 _debugStep = pcstate._debugStep;
126 _stepped = pcstate._stepped;
136 illegalExec(
bool val)
168 return flags & ThumbBit;
183 return nextFlags & ThumbBit;
190 nextFlags |= ThumbBit;
192 nextFlags &= ~ThumbBit;
195 void size(uint8_t
s) { _size =
s; }
196 uint8_t size()
const {
return _size; }
199 branching()
const override
201 return ((this->
pc() + this->size()) != this->npc());
208 return flags & JazelleBit;
217 flags &= ~JazelleBit;
223 return nextFlags & JazelleBit;
227 nextJazelle(
bool val)
230 nextFlags |= JazelleBit;
232 nextFlags &= ~JazelleBit;
238 return flags & AArch64Bit;
247 flags &= ~AArch64Bit;
253 return nextFlags & AArch64Bit;
257 nextAArch64(
bool val)
260 nextFlags |= AArch64Bit;
262 nextFlags &= ~AArch64Bit;
285 nextItstate(uint8_t value)
287 _nextItstate = value;
298 _itstate = _nextItstate;
300 }
else if (_itstate) {
301 ITSTATE it = _itstate;
302 uint8_t cond_mask = it.mask;
303 uint8_t thumb_cond = it.cond;
305 thumb_cond, cond_mask);
307 uint8_t new_bit =
bits(cond_mask, 4);
308 cond_mask &=
mask(4);
314 thumb_cond, cond_mask);
316 it.cond = thumb_cond;
332 return pc() + (
thumb() ? 4 : 8);
344 npc(
val &~
mask(nextThumb() ? 1 : 2));
357 bool thumbEE = (
thumb() && jazelle());
361 if (
bits(newPC, 0)) {
362 newPC = newPC & ~
mask(1);
367 if (
bits(newPC, 0)) {
369 newPC = newPC & ~
mask(1);
370 }
else if (!
bits(newPC, 1)) {
387 if (!
thumb() && !jazelle())
397 return Base::equals(other) &&
398 flags == opc.flags && nextFlags == opc.nextFlags &&
399 _itstate == opc._itstate &&
400 _nextItstate == opc._nextItstate &&
401 _illegalExec == opc._illegalExec &&
402 _debugStep == opc._debugStep &&
403 _stepped == opc._stepped;