ras.hh revision 1684
1#ifndef __CPU_BETA_CPU_RAS_HH__
2#define __CPU_BETA_CPU_RAS_HH__
3
4// For Addr type.
5#include "arch/alpha/isa_traits.hh"
6
7class ReturnAddrStack
8{
9  public:
10    ReturnAddrStack(unsigned numEntries);
11
12    Addr top()
13    { return addrStack[tos]; }
14
15    unsigned topIdx()
16    { return tos; }
17
18    void push(const Addr &return_addr);
19
20    void pop();
21
22    void restore(unsigned top_entry_idx, const Addr &restored_target);
23
24  private:
25    inline void incrTos()
26    { if (++tos == numEntries) tos = 0; }
27
28    inline void decrTos()
29    { tos = (tos == 0 ? numEntries - 1 : tos - 1); }
30
31    Addr *addrStack;
32
33    unsigned numEntries;
34
35    unsigned usedEntries;
36
37    unsigned tos;
38};
39
40#endif // __CPU_BETA_CPU_RAS_HH__
41