gdb/spu-tdep.h - gdb

Data types defined

Macros defined

Source code

  1. /* SPU target-dependent code for GDB, the GNU debugger.
  2.    Copyright (C) 2006-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #ifndef SPU_TDEP_H
  15. #define SPU_TDEP_H

  16. /* Number of registers.  */
  17. #define SPU_NUM_REGS         130
  18. #define SPU_NUM_PSEUDO_REGS  6
  19. #define SPU_NUM_GPRS             128

  20. /* Register numbers of various important registers.  */
  21. enum spu_regnum
  22. {
  23.   /* SPU calling convention.  */
  24.   SPU_LR_REGNUM = 0,                /* Link register.  */
  25.   SPU_RAW_SP_REGNUM = 1,        /* Stack pointer (full register).  */
  26.   SPU_ARG1_REGNUM = 3,                /* First argument register.  */
  27.   SPU_ARGN_REGNUM = 74,                /* Last argument register.  */
  28.   SPU_SAVED1_REGNUM = 80,        /* First call-saved register.  */
  29.   SPU_SAVEDN_REGNUM = 127,        /* Last call-saved register.  */
  30.   SPU_FP_REGNUM = 127,                /* Frame pointer.  */

  31.   /* Special registers.  */
  32.   SPU_ID_REGNUM = 128,                /* SPU ID register.  */
  33.   SPU_PC_REGNUM = 129,                /* Next program counter.  */
  34.   SPU_SP_REGNUM = 130,                /* Stack pointer (preferred slot).  */
  35.   SPU_FPSCR_REGNUM = 131,        /* Floating point status/control register.  */
  36.   SPU_SRR0_REGNUM = 132,        /* SRR0 register.  */
  37.   SPU_LSLR_REGNUM = 133,        /* Local store limit register.  */
  38.   SPU_DECR_REGNUM = 134,        /* Decrementer value.  */
  39.   SPU_DECR_STATUS_REGNUM = 135        /* Decrementer status.  */
  40. };

  41. /* Address conversions.

  42.    In a combined PPU/SPU debugging session, we have to consider multiple
  43.    address spaces: the PPU 32- or 64-bit address space, and the 32-bit
  44.    local store address space for each SPU context.  As it is currently
  45.    not yet possible to use the program_space / address_space mechanism
  46.    to represent this, we encode all those addresses into one single
  47.    64-bit address for the whole process.  For SPU programs using overlays,
  48.    this address space must also include separate ranges reserved for the
  49.    LMA of overlay sections.


  50.    The following combinations are supported for combined debugging:

  51.    PPU address (this relies on the fact that PPC 64-bit user space
  52.    addresses can never have the highest-most bit set):

  53.       +-+---------------------------------+
  54.       |0|              ADDR [63]          |
  55.       +-+---------------------------------+

  56.    SPU address for SPU context with id SPU (this assumes that SPU
  57.    IDs, which are file descriptors, are never larger than 2^30):

  58.       +-+-+--------------+----------------+
  59.       |1|0|    SPU [30]  |    ADDR [32]   |
  60.       +-+-+--------------+----------------+

  61.    SPU overlay section LMA for SPU context with id SPU:

  62.       +-+-+--------------+----------------+
  63.       |1|1|    SPU [30]  |    ADDR [32]   |
  64.       +-+-+--------------+----------------+


  65.    In SPU stand-alone debugging mode (using spu-linux-nat.c),
  66.    the following combinations are supported:

  67.    SPU address:

  68.       +-+-+--------------+----------------+
  69.       |0|0|     0        |    ADDR [32]   |
  70.       +-+-+--------------+----------------+

  71.    SPU overlay section LMA:

  72.       +-+-+--------------+----------------+
  73.       |0|1|     0        |    ADDR [32]   |
  74.       +-+-+--------------+----------------+


  75.    The following macros allow manipulation of addresses in the
  76.    above formats.  */

  77. #define SPUADDR(spu, addr) \
  78.   ((spu) != -1? (ULONGEST)1 << 63 | (ULONGEST)(spu) << 32 | (addr) : (addr))

  79. #define SPUADDR_SPU(addr) \
  80.   (((addr) & (ULONGEST)1 << 63) \
  81.    ? (int) ((ULONGEST)(addr) >> 32 & 0x3fffffff) \
  82.    : -1)

  83. #define SPUADDR_ADDR(addr) \
  84.   (((addr) & (ULONGEST)1 << 63)? (ULONGEST)(addr) & 0xffffffff : (addr))

  85. #define SPU_OVERLAY_LMA ((ULONGEST)1 << 62)

  86. #endif