registers.h
Go to the documentation of this file.
1 //
2 // Bareflank Unwind Library
3 //
4 // Copyright (C) 2015 Assured Information Security, Inc.
5 // Author: Rian Quinn <quinnr@ainfosec.com>
6 // Author: Brendan Kerrigan <kerriganb@ainfosec.com>
7 //
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 
22 #ifndef REGISTERS_H
23 #define REGISTERS_H
24 
25 #include <stdint.h>
26 
27 #define MAX_NUM_REGISTERS 32
28 
44 {
45 public:
46 
49  register_state() = default;
50 
53  virtual ~register_state() = default;
54 
58 
61  register_state(const register_state &) = default;
62 
66 
69  register_state &operator=(const register_state &) = default;
70 
75  virtual uint64_t get_ip() const
76  { return 0; }
77 
86  virtual register_state &set_ip(uint64_t value)
87  { (void) value; return *this; }
88 
94  virtual uint64_t get(uint64_t index) const
95  { (void) index; return 0; }
96 
106  virtual register_state &set(uint64_t index, uint64_t value)
107  { (void) index; (void) value; return *this; }
108 
113  virtual void commit()
114  { }
115 
123  virtual void commit(uint64_t cfa)
124  { (void) cfa; }
125 
130  virtual void resume()
131  { }
132 
138  virtual uint64_t max_num_registers() const
139  { return 0; }
140 
146  virtual const char *name(uint64_t index) const
147  { (void) index; return "forgot to overload name"; }
148 
154  virtual void dump() const
155  { }
156 };
157 
158 #endif
virtual ~register_state()=default
virtual void resume()
Definition: registers.h:130
register_state & operator=(register_state &&) noexcept=default
virtual register_state & set_ip(uint64_t value)
Definition: registers.h:86
register_state()=default
virtual void dump() const
Definition: registers.h:154
virtual void commit(uint64_t cfa)
Definition: registers.h:123
virtual uint64_t max_num_registers() const
Definition: registers.h:138
void uint64_t uint64_t uint64_t *rdx noexcept
auto index(const T virt, const F from)
virtual void commit()
Definition: registers.h:113
virtual uint64_t get_ip() const
Definition: registers.h:75
virtual const char * name(uint64_t index) const
Definition: registers.h:146