1 |
24 |
jeremybenn |
/* Register test program.
|
2 |
|
|
|
3 |
|
|
Copyright 2007, 2008 Free Software Foundation, Inc.
|
4 |
|
|
|
5 |
|
|
This file is part of GDB.
|
6 |
|
|
|
7 |
|
|
This program is free software; you can redistribute it and/or modify
|
8 |
|
|
it under the terms of the GNU General Public License as published by
|
9 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
10 |
|
|
(at your option) any later version.
|
11 |
|
|
|
12 |
|
|
This program is distributed in the hope that it will be useful,
|
13 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
|
|
GNU General Public License for more details.
|
16 |
|
|
|
17 |
|
|
You should have received a copy of the GNU General Public License
|
18 |
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
19 |
|
|
|
20 |
|
|
void
|
21 |
|
|
read_regs (unsigned long long regs[16], unsigned long control_regs[6])
|
22 |
|
|
{
|
23 |
|
|
asm volatile ("wstrd wR0, %0" : "=m" (regs[0]));
|
24 |
|
|
asm volatile ("wstrd wR1, %0" : "=m" (regs[1]));
|
25 |
|
|
asm volatile ("wstrd wR2, %0" : "=m" (regs[2]));
|
26 |
|
|
asm volatile ("wstrd wR3, %0" : "=m" (regs[3]));
|
27 |
|
|
asm volatile ("wstrd wR4, %0" : "=m" (regs[4]));
|
28 |
|
|
asm volatile ("wstrd wR5, %0" : "=m" (regs[5]));
|
29 |
|
|
asm volatile ("wstrd wR6, %0" : "=m" (regs[6]));
|
30 |
|
|
asm volatile ("wstrd wR7, %0" : "=m" (regs[7]));
|
31 |
|
|
asm volatile ("wstrd wR8, %0" : "=m" (regs[8]));
|
32 |
|
|
asm volatile ("wstrd wR9, %0" : "=m" (regs[9]));
|
33 |
|
|
asm volatile ("wstrd wR10, %0" : "=m" (regs[10]));
|
34 |
|
|
asm volatile ("wstrd wR11, %0" : "=m" (regs[11]));
|
35 |
|
|
asm volatile ("wstrd wR12, %0" : "=m" (regs[12]));
|
36 |
|
|
asm volatile ("wstrd wR13, %0" : "=m" (regs[13]));
|
37 |
|
|
asm volatile ("wstrd wR14, %0" : "=m" (regs[14]));
|
38 |
|
|
asm volatile ("wstrd wR15, %0" : "=m" (regs[15]));
|
39 |
|
|
|
40 |
|
|
asm volatile ("wstrw wCSSF, %0" : "=m" (control_regs[0]));
|
41 |
|
|
asm volatile ("wstrw wCASF, %0" : "=m" (control_regs[1]));
|
42 |
|
|
asm volatile ("wstrw wCGR0, %0" : "=m" (control_regs[2]));
|
43 |
|
|
asm volatile ("wstrw wCGR1, %0" : "=m" (control_regs[3]));
|
44 |
|
|
asm volatile ("wstrw wCGR2, %0" : "=m" (control_regs[4]));
|
45 |
|
|
asm volatile ("wstrw wCGR3, %0" : "=m" (control_regs[5]));
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
void
|
49 |
|
|
write_regs (unsigned long long regs[16], unsigned long control_regs[6])
|
50 |
|
|
{
|
51 |
|
|
asm volatile ("wldrd wR0, %0" : : "m" (regs[0]));
|
52 |
|
|
asm volatile ("wldrd wR1, %0" : : "m" (regs[1]));
|
53 |
|
|
asm volatile ("wldrd wR2, %0" : : "m" (regs[2]));
|
54 |
|
|
asm volatile ("wldrd wR3, %0" : : "m" (regs[3]));
|
55 |
|
|
asm volatile ("wldrd wR4, %0" : : "m" (regs[4]));
|
56 |
|
|
asm volatile ("wldrd wR5, %0" : : "m" (regs[5]));
|
57 |
|
|
asm volatile ("wldrd wR6, %0" : : "m" (regs[6]));
|
58 |
|
|
asm volatile ("wldrd wR7, %0" : : "m" (regs[7]));
|
59 |
|
|
asm volatile ("wldrd wR8, %0" : : "m" (regs[8]));
|
60 |
|
|
asm volatile ("wldrd wR9, %0" : : "m" (regs[9]));
|
61 |
|
|
asm volatile ("wldrd wR10, %0" : : "m" (regs[10]));
|
62 |
|
|
asm volatile ("wldrd wR11, %0" : : "m" (regs[11]));
|
63 |
|
|
asm volatile ("wldrd wR12, %0" : : "m" (regs[12]));
|
64 |
|
|
asm volatile ("wldrd wR13, %0" : : "m" (regs[13]));
|
65 |
|
|
asm volatile ("wldrd wR14, %0" : : "m" (regs[14]));
|
66 |
|
|
asm volatile ("wldrd wR15, %0" : : "m" (regs[15]));
|
67 |
|
|
|
68 |
|
|
asm volatile ("wldrw wCSSF, %0" : : "m" (control_regs[0]));
|
69 |
|
|
asm volatile ("wldrw wCASF, %0" : : "m" (control_regs[1]));
|
70 |
|
|
asm volatile ("wldrw wCGR0, %0" : : "m" (control_regs[2]));
|
71 |
|
|
asm volatile ("wldrw wCGR1, %0" : : "m" (control_regs[3]));
|
72 |
|
|
asm volatile ("wldrw wCGR2, %0" : : "m" (control_regs[4]));
|
73 |
|
|
asm volatile ("wldrw wCGR3, %0" : : "m" (control_regs[5]));
|
74 |
|
|
}
|
75 |
|
|
|
76 |
|
|
int
|
77 |
|
|
main ()
|
78 |
|
|
{
|
79 |
|
|
unsigned long long regs[16];
|
80 |
|
|
unsigned long control_regs[6];
|
81 |
|
|
|
82 |
|
|
read_regs (regs, control_regs);
|
83 |
|
|
write_regs (regs, control_regs);
|
84 |
|
|
|
85 |
|
|
return 0;
|
86 |
|
|
}
|