4b83f7489ff803fb4643397491da73c9fed37a19
[deliverable/binutils-gdb.git] / gdb / spu-tdep.h
1 /* SPU target-dependent code for GDB, the GNU debugger.
2 Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19 #ifndef SPU_TDEP_H
20 #define SPU_TDEP_H
21
22 /* Number of registers. */
23 #define SPU_NUM_REGS 130
24 #define SPU_NUM_PSEUDO_REGS 6
25 #define SPU_NUM_GPRS 128
26
27 /* Register numbers of various important registers. */
28 enum spu_regnum
29 {
30 /* SPU calling convention. */
31 SPU_LR_REGNUM = 0, /* Link register. */
32 SPU_RAW_SP_REGNUM = 1, /* Stack pointer (full register). */
33 SPU_ARG1_REGNUM = 3, /* First argument register. */
34 SPU_ARGN_REGNUM = 74, /* Last argument register. */
35 SPU_SAVED1_REGNUM = 80, /* First call-saved register. */
36 SPU_SAVEDN_REGNUM = 127, /* Last call-saved register. */
37 SPU_FP_REGNUM = 127, /* Frame pointer. */
38
39 /* Special registers. */
40 SPU_ID_REGNUM = 128, /* SPU ID register. */
41 SPU_PC_REGNUM = 129, /* Next program counter. */
42 SPU_SP_REGNUM = 130, /* Stack pointer (preferred slot). */
43 SPU_FPSCR_REGNUM = 131, /* Floating point status/control register. */
44 SPU_SRR0_REGNUM = 132, /* SRR0 register. */
45 SPU_LSLR_REGNUM = 133, /* Local store limit register. */
46 SPU_DECR_REGNUM = 134, /* Decrementer value. */
47 SPU_DECR_STATUS_REGNUM = 135 /* Decrementer status. */
48 };
49
50 /* Local store. */
51 #define SPU_LS_SIZE 0x40000
52
53 /* Address conversions.
54
55 In a combined PPU/SPU debugging session, we have to consider multiple
56 address spaces: the PPU 32- or 64-bit address space, and the 32-bit
57 local store address space for each SPU context. As it is currently
58 not yet possible to use the program_space / address_space mechanism
59 to represent this, we encode all those addresses into one single
60 64-bit address for the whole process. For SPU programs using overlays,
61 this address space must also include separate ranges reserved for the
62 LMA of overlay sections.
63
64
65 The following combinations are supported for combined debugging:
66
67 PPU address (this relies on the fact that PPC 64-bit user space
68 addresses can never have the highest-most bit set):
69
70 +-+---------------------------------+
71 |0| ADDR [63] |
72 +-+---------------------------------+
73
74 SPU address for SPU context with id SPU (this assumes that SPU
75 IDs, which are file descriptors, are never larger than 2^30):
76
77 +-+-+--------------+----------------+
78 |1|0| SPU [30] | ADDR [32] |
79 +-+-+--------------+----------------+
80
81 SPU overlay section LMA for SPU context with id SPU:
82
83 +-+-+--------------+----------------+
84 |1|1| SPU [30] | ADDR [32] |
85 +-+-+--------------+----------------+
86
87
88 In SPU stand-alone debugging mode (using spu-linux-nat.c),
89 the following combinations are supported:
90
91 SPU address:
92
93 +-+-+--------------+----------------+
94 |0|0| 0 | ADDR [32] |
95 +-+-+--------------+----------------+
96
97 SPU overlay section LMA:
98
99 +-+-+--------------+----------------+
100 |0|1| 0 | ADDR [32] |
101 +-+-+--------------+----------------+
102
103
104 The following macros allow manipulation of addresses in the
105 above formats. */
106
107 #define SPUADDR(spu, addr) \
108 ((spu) != -1? (ULONGEST)1 << 63 | (ULONGEST)(spu) << 32 | (addr) : (addr))
109
110 #define SPUADDR_SPU(addr) \
111 (((addr) & (ULONGEST)1 << 63) \
112 ? (int) ((ULONGEST)(addr) >> 32 & 0x3fffffff) \
113 : -1)
114
115 #define SPUADDR_ADDR(addr) \
116 (((addr) & (ULONGEST)1 << 63)? (ULONGEST)(addr) & 0xffffffff : (addr))
117
118 #define SPU_OVERLAY_LMA ((ULONGEST)1 << 62)
119
120 #endif
This page took 0.042892 seconds and 4 git commands to generate.