]>
Commit | Line | Data |
---|---|---|
771b4502 | 1 | /* SPU target-dependent code for GDB, the GNU debugger. |
7b6bb8da JB |
2 | Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 |
3 | Free Software Foundation, Inc. | |
771b4502 UW |
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 | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
771b4502 UW |
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 | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
771b4502 UW |
19 | |
20 | #ifndef SPU_TDEP_H | |
21 | #define SPU_TDEP_H | |
22 | ||
23 | /* Number of registers. */ | |
24 | #define SPU_NUM_REGS 130 | |
23d964e7 | 25 | #define SPU_NUM_PSEUDO_REGS 6 |
771b4502 UW |
26 | #define SPU_NUM_GPRS 128 |
27 | ||
28 | /* Register numbers of various important registers. */ | |
29 | enum spu_regnum | |
30 | { | |
31 | /* SPU calling convention. */ | |
32 | SPU_LR_REGNUM = 0, /* Link register. */ | |
33 | SPU_RAW_SP_REGNUM = 1, /* Stack pointer (full register). */ | |
34 | SPU_ARG1_REGNUM = 3, /* First argument register. */ | |
35 | SPU_ARGN_REGNUM = 74, /* Last argument register. */ | |
36 | SPU_SAVED1_REGNUM = 80, /* First call-saved register. */ | |
37 | SPU_SAVEDN_REGNUM = 127, /* Last call-saved register. */ | |
38 | SPU_FP_REGNUM = 127, /* Frame pointer. */ | |
39 | ||
40 | /* Special registers. */ | |
41 | SPU_ID_REGNUM = 128, /* SPU ID register. */ | |
42 | SPU_PC_REGNUM = 129, /* Next program counter. */ | |
23d964e7 UW |
43 | SPU_SP_REGNUM = 130, /* Stack pointer (preferred slot). */ |
44 | SPU_FPSCR_REGNUM = 131, /* Floating point status/control register. */ | |
45 | SPU_SRR0_REGNUM = 132, /* SRR0 register. */ | |
46 | SPU_LSLR_REGNUM = 133, /* Local store limit register. */ | |
47 | SPU_DECR_REGNUM = 134, /* Decrementer value. */ | |
48 | SPU_DECR_STATUS_REGNUM = 135 /* Decrementer status. */ | |
771b4502 UW |
49 | }; |
50 | ||
d2ed6730 UW |
51 | /* Address conversions. |
52 | ||
53 | In a combined PPU/SPU debugging session, we have to consider multiple | |
54 | address spaces: the PPU 32- or 64-bit address space, and the 32-bit | |
55 | local store address space for each SPU context. As it is currently | |
56 | not yet possible to use the program_space / address_space mechanism | |
57 | to represent this, we encode all those addresses into one single | |
58 | 64-bit address for the whole process. For SPU programs using overlays, | |
59 | this address space must also include separate ranges reserved for the | |
60 | LMA of overlay sections. | |
61 | ||
62 | ||
63 | The following combinations are supported for combined debugging: | |
64 | ||
65 | PPU address (this relies on the fact that PPC 64-bit user space | |
66 | addresses can never have the highest-most bit set): | |
67 | ||
68 | +-+---------------------------------+ | |
69 | |0| ADDR [63] | | |
70 | +-+---------------------------------+ | |
71 | ||
72 | SPU address for SPU context with id SPU (this assumes that SPU | |
73 | IDs, which are file descriptors, are never larger than 2^30): | |
74 | ||
75 | +-+-+--------------+----------------+ | |
76 | |1|0| SPU [30] | ADDR [32] | | |
77 | +-+-+--------------+----------------+ | |
78 | ||
79 | SPU overlay section LMA for SPU context with id SPU: | |
80 | ||
81 | +-+-+--------------+----------------+ | |
82 | |1|1| SPU [30] | ADDR [32] | | |
83 | +-+-+--------------+----------------+ | |
84 | ||
85 | ||
86 | In SPU stand-alone debugging mode (using spu-linux-nat.c), | |
87 | the following combinations are supported: | |
88 | ||
89 | SPU address: | |
90 | ||
91 | +-+-+--------------+----------------+ | |
92 | |0|0| 0 | ADDR [32] | | |
93 | +-+-+--------------+----------------+ | |
94 | ||
95 | SPU overlay section LMA: | |
96 | ||
97 | +-+-+--------------+----------------+ | |
98 | |0|1| 0 | ADDR [32] | | |
99 | +-+-+--------------+----------------+ | |
100 | ||
101 | ||
102 | The following macros allow manipulation of addresses in the | |
103 | above formats. */ | |
104 | ||
85e747d2 UW |
105 | #define SPUADDR(spu, addr) \ |
106 | ((spu) != -1? (ULONGEST)1 << 63 | (ULONGEST)(spu) << 32 | (addr) : (addr)) | |
d2ed6730 | 107 | |
85e747d2 | 108 | #define SPUADDR_SPU(addr) \ |
768f0929 | 109 | (((addr) & (ULONGEST)1 << 63) \ |
d2ed6730 | 110 | ? (int) ((ULONGEST)(addr) >> 32 & 0x3fffffff) \ |
768f0929 | 111 | : -1) |
d2ed6730 | 112 | |
85e747d2 UW |
113 | #define SPUADDR_ADDR(addr) \ |
114 | (((addr) & (ULONGEST)1 << 63)? (ULONGEST)(addr) & 0xffffffff : (addr)) | |
115 | ||
d2ed6730 UW |
116 | #define SPU_OVERLAY_LMA ((ULONGEST)1 << 62) |
117 | ||
771b4502 | 118 | #endif |