1 /* SPU target-dependent code for GDB, the GNU debugger.
2 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
3 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
23 /* Number of registers. */
24 #define SPU_NUM_REGS 130
25 #define SPU_NUM_PSEUDO_REGS 6
26 #define SPU_NUM_GPRS 128
28 /* Register numbers of various important registers. */
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. */
40 /* Special registers. */
41 SPU_ID_REGNUM = 128, /* SPU ID register. */
42 SPU_PC_REGNUM = 129, /* Next program counter. */
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. */
51 /* Address conversions.
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.
63 The following combinations are supported for combined debugging:
65 PPU address (this relies on the fact that PPC 64-bit user space
66 addresses can never have the highest-most bit set):
68 +-+---------------------------------+
70 +-+---------------------------------+
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):
75 +-+-+--------------+----------------+
76 |1|0| SPU [30] | ADDR [32] |
77 +-+-+--------------+----------------+
79 SPU overlay section LMA for SPU context with id SPU:
81 +-+-+--------------+----------------+
82 |1|1| SPU [30] | ADDR [32] |
83 +-+-+--------------+----------------+
86 In SPU stand-alone debugging mode (using spu-linux-nat.c),
87 the following combinations are supported:
91 +-+-+--------------+----------------+
93 +-+-+--------------+----------------+
95 SPU overlay section LMA:
97 +-+-+--------------+----------------+
99 +-+-+--------------+----------------+
102 The following macros allow manipulation of addresses in the
105 #define SPUADDR(spu, addr) \
106 ((spu) != -1? (ULONGEST)1 << 63 | (ULONGEST)(spu) << 32 | (addr) : (addr))
108 #define SPUADDR_SPU(addr) \
109 (((addr) & (ULONGEST)1 << 63) \
110 ? (int) ((ULONGEST)(addr) >> 32 & 0x3fffffff) \
113 #define SPUADDR_ADDR(addr) \
114 (((addr) & (ULONGEST)1 << 63)? (ULONGEST)(addr) & 0xffffffff : (addr))
116 #define SPU_OVERLAY_LMA ((ULONGEST)1 << 62)