Add .gitignore file
[s390-tools.git] / vmconvert / register_content.cpp
blob1119d0f66a17ac1d9775091ff1710d44d2764323
1 /*
2 * register_content.cpp
3 * register content classes
4 *
5 * Copyright IBM Corp. 2004, 2006.
6 *
7 * Author(s): Michael Holzheu
8 */
10 #include <string.h>
11 #include "register_content.h"
12 #include "dump.h"
14 RegisterContent32::RegisterContent32(void)
15 : regSets(), nrCpus(0)
19 RegisterContent32::RegisterContent32(const RegisterContent32& r)
21 nrCpus = r.nrCpus;
22 memcpy(&regSets,&r.regSets,sizeof(regSets));
25 void
26 RegisterContent32::addRegisterSet(const RegisterSet32& rs)
28 if(nrCpus < MAX_CPUS){
29 regSets[nrCpus++] = rs;
30 } else {
31 throw(DumpException("RegisterContent32::addRegisterSet - "\
32 "No more register sets available"));
36 RegisterSet32
37 RegisterContent32::getRegisterSet(int cpu){
38 if(cpu <= nrCpus){
39 return regSets[cpu];
40 } else {
41 throw(DumpException("RegisterContent32::getRegisterSet - "\
42 "No register set for cpu"));
46 RegisterContent64::RegisterContent64(void)
47 : regSets(), nrCpus(0)
51 RegisterContent64::RegisterContent64(const RegisterContent64& r)
53 nrCpus = r.nrCpus;
54 memcpy(&regSets,&r.regSets,sizeof(regSets));
57 void
58 RegisterContent64::addRegisterSet(const RegisterSet64& rs)
60 if(nrCpus < MAX_CPUS){
61 regSets[nrCpus++] = rs;
62 } else {
63 throw(DumpException("RegisterContent64::addRegisterSet - "\
64 "No more register sets available"));
68 RegisterSet64
69 RegisterContent64::getRegisterSet(int cpu)
71 if(cpu <= nrCpus){
72 return regSets[cpu];
73 } else {
74 throw(DumpException("RegisterContent64::getRegisterSet - "\
75 "No register set for cpu"));