Fixed immediate byte accounting bug.
--HG-- extra : convert_revision : ee5275da14a2923b9a525ae5b5c582c15df4608a
This commit is contained in:
parent
bff4f765f5
commit
47b0242618
2 changed files with 14 additions and 9 deletions
|
@ -72,7 +72,6 @@ namespace X86ISA
|
||||||
|
|
||||||
immediateCollected = 0;
|
immediateCollected = 0;
|
||||||
emi.immediate = 0;
|
emi.immediate = 0;
|
||||||
displacementCollected = 0;
|
|
||||||
emi.displacement = 0;
|
emi.displacement = 0;
|
||||||
|
|
||||||
emi.modRM = 0;
|
emi.modRM = 0;
|
||||||
|
@ -359,14 +358,16 @@ namespace X86ISA
|
||||||
{
|
{
|
||||||
State nextState = ErrorState;
|
State nextState = ErrorState;
|
||||||
|
|
||||||
getImmediate(displacementCollected,
|
getImmediate(immediateCollected,
|
||||||
emi.displacement,
|
emi.displacement,
|
||||||
displacementSize);
|
displacementSize);
|
||||||
|
|
||||||
DPRINTF(Predecoder, "Collecting %d byte displacement, got %d bytes.\n",
|
DPRINTF(Predecoder, "Collecting %d byte displacement, got %d bytes.\n",
|
||||||
displacementSize, displacementCollected);
|
displacementSize, immediateCollected);
|
||||||
|
|
||||||
if(displacementSize == displacementCollected) {
|
if(displacementSize == immediateCollected) {
|
||||||
|
//Reset this for other immediates.
|
||||||
|
immediateCollected = 0;
|
||||||
//Sign extend the displacement
|
//Sign extend the displacement
|
||||||
switch(displacementSize)
|
switch(displacementSize)
|
||||||
{
|
{
|
||||||
|
@ -411,6 +412,9 @@ namespace X86ISA
|
||||||
|
|
||||||
if(immediateSize == immediateCollected)
|
if(immediateSize == immediateCollected)
|
||||||
{
|
{
|
||||||
|
//Reset this for other immediates.
|
||||||
|
immediateCollected = 0;
|
||||||
|
|
||||||
//XXX Warning! The following is an observed pattern and might
|
//XXX Warning! The following is an observed pattern and might
|
||||||
//not always be true!
|
//not always be true!
|
||||||
|
|
||||||
|
|
|
@ -106,13 +106,13 @@ namespace X86ISA
|
||||||
toGet = toGet > remaining ? remaining : toGet;
|
toGet = toGet > remaining ? remaining : toGet;
|
||||||
|
|
||||||
//Shift the bytes we want to be all the way to the right
|
//Shift the bytes we want to be all the way to the right
|
||||||
uint64_t partialDisp = fetchChunk >> (offset * 8);
|
uint64_t partialImm = fetchChunk >> (offset * 8);
|
||||||
//Mask off what we don't want
|
//Mask off what we don't want
|
||||||
partialDisp &= mask(toGet * 8);
|
partialImm &= mask(toGet * 8);
|
||||||
//Shift it over to overlay with our displacement.
|
//Shift it over to overlay with our displacement.
|
||||||
partialDisp <<= (displacementCollected * 8);
|
partialImm <<= (immediateCollected * 8);
|
||||||
//Put it into our displacement
|
//Put it into our displacement
|
||||||
current |= partialDisp;
|
current |= partialImm;
|
||||||
//Update how many bytes we've collected.
|
//Update how many bytes we've collected.
|
||||||
collected += toGet;
|
collected += toGet;
|
||||||
consumeBytes(toGet);
|
consumeBytes(toGet);
|
||||||
|
@ -144,9 +144,10 @@ namespace X86ISA
|
||||||
bool emiIsReady;
|
bool emiIsReady;
|
||||||
//The size of the displacement value
|
//The size of the displacement value
|
||||||
int displacementSize;
|
int displacementSize;
|
||||||
int displacementCollected;
|
|
||||||
//The size of the immediate value
|
//The size of the immediate value
|
||||||
int immediateSize;
|
int immediateSize;
|
||||||
|
//This is how much of any immediate value we've gotten. This is used
|
||||||
|
//for both the actual immediate and the displacement.
|
||||||
int immediateCollected;
|
int immediateCollected;
|
||||||
|
|
||||||
enum State {
|
enum State {
|
||||||
|
|
Loading…
Reference in a new issue