summaryrefslogtreecommitdiff
path: root/cpu/beta_cpu/ras.hh
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2005-03-10 15:53:27 -0500
committerKevin Lim <ktlim@umich.edu>2005-03-10 15:53:27 -0500
commitc12a665c3120b61ed4e09da5d8a52c57406763d5 (patch)
treeb5176be0d526ea24cafcd6f615058651f2b34dfb /cpu/beta_cpu/ras.hh
parentaa8c9db159422a313f6dfc9a76fd827515b32126 (diff)
parent51108a8c0a3a42702f49a945f8a4dac776a8d189 (diff)
downloadgem5-c12a665c3120b61ed4e09da5d8a52c57406763d5.tar.xz
Merge ktlim@zizzer.eecs.umich.edu:/bk/m5
into zamp.eecs.umich.edu:/z/ktlim2/m5 --HG-- extra : convert_revision : a58535776cf5a3d17f8d9f65144cdf8db54289aa
Diffstat (limited to 'cpu/beta_cpu/ras.hh')
-rw-r--r--cpu/beta_cpu/ras.hh40
1 files changed, 40 insertions, 0 deletions
diff --git a/cpu/beta_cpu/ras.hh b/cpu/beta_cpu/ras.hh
new file mode 100644
index 000000000..7666f825f
--- /dev/null
+++ b/cpu/beta_cpu/ras.hh
@@ -0,0 +1,40 @@
+#ifndef __RAS_HH__
+#define __RAS_HH__
+
+// For Addr type.
+#include "arch/alpha/isa_traits.hh"
+
+class ReturnAddrStack
+{
+ public:
+ ReturnAddrStack(unsigned numEntries);
+
+ Addr top()
+ { return addrStack[tos]; }
+
+ unsigned topIdx()
+ { return tos; }
+
+ void push(const Addr &return_addr);
+
+ void pop();
+
+ void restore(unsigned top_entry_idx, const Addr &restored_target);
+
+ private:
+ inline void incrTos()
+ { tos = (tos + 1) % numEntries; }
+
+ inline void decrTos()
+ { tos = (tos == 0 ? numEntries - 1 : tos - 1); }
+
+ Addr *addrStack;
+
+ unsigned numEntries;
+
+ unsigned usedEntries;
+
+ unsigned tos;
+};
+
+#endif // __RAS_HH__