Fix Bug: Struct was not being changed because it wasn't a ptr, w/ T
This commit is contained in:
parent
5bb7d86156
commit
14fbb7e4fc
18
src/decode.c
18
src/decode.c
@ -104,26 +104,26 @@ a64inst_instruction *decode(word wrd) {
|
||||
inst->data.DPRegisterData.src2 = getBits(wrd, DP_REG_SRC2_LSB, DP_REG_SRC2_MSB);
|
||||
inst->data.DPRegisterData.DPROpType = getBits(wrd, DP_REG_OPTYPE_LSB, DP_REG_OPTYPE_MSB);
|
||||
|
||||
a64inst_DPRegister_ArithmLogicData arithmLogicData = inst->data.DPRegisterData.processOpData.arithmLogicData;
|
||||
a64inst_DPRegister_ArithmLogicData *arithmLogicData = &inst->data.DPRegisterData.processOpData.arithmLogicData;
|
||||
|
||||
arithmLogicData.type = getBits(wrd, DP_REG_ARITHMLOGIC_ARITHMFLAG_LSB, DP_REG_ARITHMLOGIC_ARITHMFLAG_MSB);
|
||||
arithmLogicData.shiftType = getBits(wrd, DP_REG_ARITHMLOGIC_SHIFTTYPE_LSB, DP_REG_ARITHMLOGIC_SHIFTTYPE_MSB);
|
||||
arithmLogicData.negShiftedSrc2 = getBits(wrd, DP_REG_ARITHMLOGIC_NEGSRC2FLAG_LSB, DP_REG_ARITHMLOGIC_NEGSRC2FLAG_MSB);
|
||||
arithmLogicData->type = getBits(wrd, DP_REG_ARITHMLOGIC_ARITHMFLAG_LSB, DP_REG_ARITHMLOGIC_ARITHMFLAG_MSB);
|
||||
arithmLogicData->shiftType = getBits(wrd, DP_REG_ARITHMLOGIC_SHIFTTYPE_LSB, DP_REG_ARITHMLOGIC_SHIFTTYPE_MSB);
|
||||
arithmLogicData->negShiftedSrc2 = getBits(wrd, DP_REG_ARITHMLOGIC_NEGSRC2FLAG_LSB, DP_REG_ARITHMLOGIC_NEGSRC2FLAG_MSB);
|
||||
|
||||
switch(inst->data.DPRegisterData.DPROpType) {
|
||||
|
||||
case a64inst_DPR_ARITHMLOGIC:
|
||||
if (arithmLogicData.type == a64inst_DPR_ARITHM && (arithmLogicData.negShiftedSrc2 || arithmLogicData.shiftType == a64inst_ROR)) {
|
||||
if (arithmLogicData->type == a64inst_DPR_ARITHM && (arithmLogicData->negShiftedSrc2 || arithmLogicData->shiftType == a64inst_ROR)) {
|
||||
fprintf(stderr, "Attempting to decode arithmetic DPR instruction with invalid format!\n");
|
||||
}
|
||||
arithmLogicData.shiftAmount = getBits(wrd, DP_REG_ARITHMLOGIC_SHIFTAMOUNT_LSB, DP_REG_ARITHMLOGIC_SHIFTAMOUNT_MSB);
|
||||
arithmLogicData->shiftAmount = getBits(wrd, DP_REG_ARITHMLOGIC_SHIFTAMOUNT_LSB, DP_REG_ARITHMLOGIC_SHIFTAMOUNT_MSB);
|
||||
break;
|
||||
|
||||
case a64inst_DPR_MULTIPLY:;
|
||||
if (!(inst->data.DPRegisterData.processOp == DP_REG_MULTIPLY_PROCESSOP &&
|
||||
arithmLogicData.type == DP_REG_MULTIPLY_ARITHMFLAG &&
|
||||
arithmLogicData.shiftType == DP_REG_MULTIPLY_SHIFTTYPE &&
|
||||
arithmLogicData.negShiftedSrc2 == DP_REG_MULTIPLY_NEGSRC2FLAG)) {
|
||||
arithmLogicData->type == DP_REG_MULTIPLY_ARITHMFLAG &&
|
||||
arithmLogicData->shiftType == DP_REG_MULTIPLY_SHIFTTYPE &&
|
||||
arithmLogicData->negShiftedSrc2 == DP_REG_MULTIPLY_NEGSRC2FLAG)) {
|
||||
fprintf(stderr, "Attempting to decode multiply DPR instruction with invalid format!\n");
|
||||
}
|
||||
inst->data.DPRegisterData.processOpData.multiplydata.summand = getBits(wrd, DP_REG_MULTIPLY_SUMMAND_LSB, DP_REG_MULTIPLY_SUMMAND_MSB);
|
||||
|
||||
@ -200,9 +200,9 @@ static void executeDPRegister(Machine *state, a64inst_instruction *inst) {
|
||||
case a64inst_DPR_ARITHMLOGIC:;
|
||||
|
||||
// Apply shift to value held in second register
|
||||
a64inst_DPRegister_ArithmLogicData arithmLogicData = inst->data.DPRegisterData.processOpData.arithmLogicData;
|
||||
uint8_t shiftAmount = arithmLogicData.shiftAmount;
|
||||
switch(arithmLogicData.shiftType) {
|
||||
a64inst_DPRegister_ArithmLogicData *arithmLogicData = &inst->data.DPRegisterData.processOpData.arithmLogicData;
|
||||
uint8_t shiftAmount = arithmLogicData->shiftAmount;
|
||||
switch(arithmLogicData->shiftType) {
|
||||
|
||||
case a64inst_LSL:
|
||||
src2Val = truncateValue(src2Val << shiftAmount, regType);
|
||||
@ -217,7 +217,7 @@ static void executeDPRegister(Machine *state, a64inst_instruction *inst) {
|
||||
break;
|
||||
|
||||
case a64inst_ROR:
|
||||
if (arithmLogicData.type != a64inst_DPR_LOGIC) {
|
||||
if (arithmLogicData->type != a64inst_DPR_LOGIC) {
|
||||
fprintf(stderr, "Attempting to perform ROR shift on non-logic register data processing instruction!\n");
|
||||
}
|
||||
src2Val = truncateValue(src2Val >> shiftAmount | src2Val << (getMSBPos(regType) - shiftAmount), regType);
|
||||
@ -229,7 +229,7 @@ static void executeDPRegister(Machine *state, a64inst_instruction *inst) {
|
||||
}
|
||||
|
||||
dword result;
|
||||
switch(arithmLogicData.type) {
|
||||
switch(arithmLogicData->type) {
|
||||
|
||||
case a64inst_DPR_ARITHM:
|
||||
switch(inst->data.DPRegisterData.processOp) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user