The Pedigree Project  0.1
arm_926e/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 *ARM926EInterruptStateRegisterName[17] = {
23  "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", "r8",
24  "r9", "r10", "bp", "r12", "sp", "r14", "pc", "cpsr"};
25 
27  : m_r0(), m_r1(), m_r2(), m_r3(), m_r4(), m_r5(), m_r6(), m_r7(), m_r8(),
28  m_r9(), m_r10(), m_Fp(), m_r12(), m_Sp(), m_Lnk(), m_Pc(), m_Cpsr()
29 {
30 }
31 
33  : m_r0(is.m_r0), m_r1(is.m_r1), m_r2(is.m_r2), m_r3(is.m_r3), m_r4(is.m_r4),
34  m_r5(is.m_r5), m_r6(is.m_r6), m_r7(is.m_r7), m_r8(is.m_r8), m_r9(is.m_r9),
35  m_r10(is.m_r10), m_Fp(is.m_Fp), m_r12(is.m_r12), m_Sp(is.m_Sp),
36  m_Lnk(is.m_Lnk), m_Pc(is.m_Pc), m_Cpsr(is.m_Cpsr)
37 {
38 }
39 
42 {
43  m_r0 = is.m_r0;
44  m_r1 = is.m_r1;
45  m_r2 = is.m_r2;
46  m_r3 = is.m_r3;
47  m_r4 = is.m_r4;
48  m_r5 = is.m_r5;
49  m_r6 = is.m_r6;
50  m_r7 = is.m_r7;
51  m_r8 = is.m_r8;
52  m_r9 = is.m_r9;
53  m_r10 = is.m_r10;
54  m_Fp = is.m_Fp;
55  m_r12 = is.m_r12;
56  m_Sp = is.m_Sp;
57  m_Lnk = is.m_Lnk;
58  m_Pc = is.m_Pc;
59  m_Cpsr = is.m_Cpsr;
60  return *this;
61 }
62 
64 {
65  return 17;
66 }
67 processor_register_t ARM926EInterruptState::getRegister(size_t index) const
68 {
69  switch (index)
70  {
71  case 0:
72  return m_r0;
73  case 1:
74  return m_r1;
75  case 2:
76  return m_r2;
77  case 3:
78  return m_r3;
79  case 4:
80  return m_r4;
81  case 5:
82  return m_r5;
83  case 6:
84  return m_r6;
85  case 7:
86  return m_r7;
87  case 8:
88  return m_r8;
89  case 9:
90  return m_r9;
91  case 10:
92  return m_r10;
93  case 11:
94  return m_Fp;
95  case 12:
96  return m_r12;
97  case 13:
98  return m_Sp;
99  case 14:
100  return m_Lnk;
101  case 15:
102  return m_Pc;
103  case 16:
104  return m_Cpsr;
105  default:
106  return 0;
107  }
108 }
109 const char *ARM926EInterruptState::getRegisterName(size_t index) const
110 {
111  return ARM926EInterruptStateRegisterName[index];
112 }
processor_register_t getRegister(size_t index) const
size_t getRegisterCount() const
const char * getRegisterName(size_t index) const
ARM926EInterruptState & operator=(const ARM926EInterruptState &)