The Pedigree Project  0.1
armv7/state.cc
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include "pedigree/kernel/processor/state.h"
21 
22 const char *ARMV7InterruptStateRegisterName[17] = {
23  "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
24  "r9", "r10", "r11", "r12", "lr", "pc", "usersp", "userlr",
25 };
26 
28  : m_usersp(), m_userlr(), m_r0(), m_r1(), m_r2(), m_r3(), m_r4(), m_r5(),
29  m_r6(), m_r7(), m_r8(), m_r9(), m_r10(), m_r11(), m_r12(), m_lr(), m_pc(),
30  m_spsr()
31 {
32 }
33 
35  : m_usersp(is.m_usersp), m_userlr(is.m_userlr), m_r0(is.m_r0),
36  m_r1(is.m_r1), m_r2(is.m_r2), m_r3(is.m_r3), m_r4(is.m_r4), m_r5(is.m_r5),
37  m_r6(is.m_r6), m_r7(is.m_r7), m_r8(is.m_r8), m_r9(is.m_r9),
38  m_r10(is.m_r10), m_r11(is.m_r11), m_r12(is.m_r12), m_lr(is.m_lr),
39  m_pc(is.m_pc), m_spsr(is.m_spsr)
40 {
41 }
42 
45 {
46  m_spsr = is.m_spsr;
47  m_r0 = is.m_r0;
48  m_r1 = is.m_r1;
49  m_r2 = is.m_r2;
50  m_r3 = is.m_r3;
51  m_r4 = is.m_r4;
52  m_r5 = is.m_r5;
53  m_r6 = is.m_r6;
54  m_r7 = is.m_r7;
55  m_r8 = is.m_r8;
56  m_r9 = is.m_r9;
57  m_r10 = is.m_r10;
58  m_r11 = is.m_r11;
59  m_r12 = is.m_r12;
60  m_lr = is.m_lr;
61  m_pc = is.m_pc;
62  return *this;
63 }
64 
66 {
67  return 18;
68 }
69 processor_register_t ARMV7InterruptState::getRegister(size_t index) const
70 {
71  switch (index)
72  {
73  case 0:
74  return m_r0;
75  case 1:
76  return m_r1;
77  case 2:
78  return m_r2;
79  case 3:
80  return m_r3;
81  case 4:
82  return m_r4;
83  case 5:
84  return m_r5;
85  case 6:
86  return m_r6;
87  case 7:
88  return m_r7;
89  case 8:
90  return m_r8;
91  case 9:
92  return m_r9;
93  case 10:
94  return m_r10;
95  case 11:
96  return m_r11;
97  case 12:
98  return m_r12;
99  case 13:
100  return m_lr;
101  case 14:
102  return m_pc;
103  case 15:
104  return m_usersp;
105  case 16:
106  return m_userlr;
107  case 17:
108  return m_spsr;
109  default:
110  return 0;
111  }
112 }
113 const char *ARMV7InterruptState::getRegisterName(size_t index) const
114 {
115  return ARMV7InterruptStateRegisterName[index];
116 }
ARMV7InterruptState & operator=(const ARMV7InterruptState &)
Definition: armv7/state.cc:44
const char * getRegisterName(size_t index) const
Definition: armv7/state.cc:113
processor_register_t getRegister(size_t index) const
Definition: armv7/state.cc:69
size_t getRegisterCount() const
Definition: armv7/state.cc:65