From 0a74246fb9d618ca851122f4f63135fc490f22cd Mon Sep 17 00:00:00 2001 From: Korey Sewell Date: Wed, 23 Feb 2011 16:35:18 -0500 Subject: [PATCH] inorder: InstSeqNum bug Because int and not InstSeqNum was used in a couple of places, you can overflow the int type and thus get wierd bugs when the sequence number is negative (or some wierd value) --- src/cpu/inorder/resources/agen_unit.cc | 2 +- src/cpu/inorder/resources/branch_predictor.cc | 2 +- src/cpu/inorder/resources/execution_unit.cc | 2 +- src/cpu/inorder/resources/fetch_seq_unit.cc | 2 +- src/cpu/inorder/resources/tlb_unit.cc | 2 +- src/cpu/inorder/resources/use_def.cc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cpu/inorder/resources/agen_unit.cc b/src/cpu/inorder/resources/agen_unit.cc index 764cd9446..3e26c4da3 100644 --- a/src/cpu/inorder/resources/agen_unit.cc +++ b/src/cpu/inorder/resources/agen_unit.cc @@ -55,7 +55,7 @@ AGENUnit::execute(int slot_num) #if TRACING_ON ThreadID tid = inst->readTid(); #endif - int seq_num = inst->seqNum; + InstSeqNum seq_num = inst->seqNum; switch (agen_req->cmd) { diff --git a/src/cpu/inorder/resources/branch_predictor.cc b/src/cpu/inorder/resources/branch_predictor.cc index 5a22e40eb..4b8205070 100644 --- a/src/cpu/inorder/resources/branch_predictor.cc +++ b/src/cpu/inorder/resources/branch_predictor.cc @@ -69,7 +69,7 @@ BranchPredictor::execute(int slot_num) ResourceRequest* bpred_req = reqs[slot_num]; DynInstPtr inst = bpred_req->inst; ThreadID tid = inst->readTid(); - int seq_num = inst->seqNum; + InstSeqNum seq_num = inst->seqNum; switch (bpred_req->cmd) { diff --git a/src/cpu/inorder/resources/execution_unit.cc b/src/cpu/inorder/resources/execution_unit.cc index b2540cff8..311add9f8 100644 --- a/src/cpu/inorder/resources/execution_unit.cc +++ b/src/cpu/inorder/resources/execution_unit.cc @@ -85,7 +85,7 @@ ExecutionUnit::execute(int slot_num) ResourceRequest* exec_req = reqs[slot_num]; DynInstPtr inst = reqs[slot_num]->inst; Fault fault = NoFault; - int seq_num = inst->seqNum; + InstSeqNum seq_num = inst->seqNum; Tick cur_tick = curTick(); if (cur_tick == serializeTick) { diff --git a/src/cpu/inorder/resources/fetch_seq_unit.cc b/src/cpu/inorder/resources/fetch_seq_unit.cc index d23ea0a82..8d9187c7a 100644 --- a/src/cpu/inorder/resources/fetch_seq_unit.cc +++ b/src/cpu/inorder/resources/fetch_seq_unit.cc @@ -76,7 +76,7 @@ FetchSeqUnit::execute(int slot_num) DynInstPtr inst = fs_req->inst; ThreadID tid = inst->readTid(); int stage_num = fs_req->getStageNum(); - int seq_num = inst->seqNum; + InstSeqNum seq_num = inst->seqNum; DPRINTF(InOrderFetchSeq, "[tid:%i]: Current PC is %s\n", tid, pc[tid]); diff --git a/src/cpu/inorder/resources/tlb_unit.cc b/src/cpu/inorder/resources/tlb_unit.cc index 37aec2209..9a0c9fe32 100644 --- a/src/cpu/inorder/resources/tlb_unit.cc +++ b/src/cpu/inorder/resources/tlb_unit.cc @@ -109,7 +109,7 @@ TLBUnit::execute(int slot_idx) DynInstPtr inst = tlb_req->inst; ThreadID tid = inst->readTid(); - int seq_num = inst->seqNum; + InstSeqNum seq_num = inst->seqNum; int stage_num = tlb_req->getStageNum(); tlb_req->fault = NoFault; diff --git a/src/cpu/inorder/resources/use_def.cc b/src/cpu/inorder/resources/use_def.cc index 19246a30b..c687024ce 100644 --- a/src/cpu/inorder/resources/use_def.cc +++ b/src/cpu/inorder/resources/use_def.cc @@ -145,7 +145,7 @@ UseDefUnit::execute(int slot_idx) DynInstPtr inst = ud_req->inst; ThreadID tid = inst->readTid(); - int seq_num = inst->seqNum; + InstSeqNum seq_num = inst->seqNum; int ud_idx = ud_req->useDefIdx; // If there is a non-speculative instruction -- 2.30.2