Home | History | Annotate | Download | only in backends
      1 /* PowerPC specific core note handling.
      2    Copyright (C) 2007 Red Hat, Inc.
      3    This file is part of Red Hat elfutils.
      4 
      5    Red Hat elfutils is free software; you can redistribute it and/or modify
      6    it under the terms of the GNU General Public License as published by the
      7    Free Software Foundation; version 2 of the License.
      8 
      9    Red Hat elfutils is distributed in the hope that it will be useful, but
     10    WITHOUT ANY WARRANTY; without even the implied warranty of
     11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12    General Public License for more details.
     13 
     14    You should have received a copy of the GNU General Public License along
     15    with Red Hat elfutils; if not, write to the Free Software Foundation,
     16    Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
     17 
     18    Red Hat elfutils is an included package of the Open Invention Network.
     19    An included package of the Open Invention Network is a package for which
     20    Open Invention Network licensees cross-license their patents.  No patent
     21    license is granted, either expressly or impliedly, by designation as an
     22    included package.  Should you wish to participate in the Open Invention
     23    Network licensing program, please visit www.openinventionnetwork.com
     24    <http://www.openinventionnetwork.com>.  */
     25 
     26 #ifdef HAVE_CONFIG_H
     27 # include <config.h>
     28 #endif
     29 
     30 #include <elf.h>
     31 #include <inttypes.h>
     32 #include <stddef.h>
     33 #include <stdio.h>
     34 #include <sys/time.h>
     35 
     36 #ifndef BITS
     37 # define BITS 		32
     38 # define BACKEND	sparc_
     39 #else
     40 # define BITS 		64
     41 # define BACKEND	sparc64_
     42 #endif
     43 #include "libebl_CPU.h"
     44 
     45 #define GR(at, n, dwreg)						\
     46     { .offset = at * BITS/8, .regno = dwreg, .count = n, .bits = BITS }
     47 
     48 static const Ebl_Register_Location prstatus_regs[] =
     49   {
     50     GR (0, 32, 0),		/* %g0-%g7, %o0-%o7, %i0-%i7 */
     51 #if BITS == 32
     52     GR (32, 1, 65),		/* %psr */
     53     GR (33, 2, 68),		/* %pc, %npc */
     54     GR (35, 1, 64),		/* %y */
     55     GR (36, 1, 66),		/* %wim, %tbr */
     56 #else
     57     GR (32, 1, 82),		/* %state */
     58     GR (33, 2, 80),		/* %pc, %npc */
     59     GR (35, 1, 85),		/* %y */
     60 #endif
     61   };
     62 #define PRSTATUS_REGS_SIZE	(BITS / 8 * (32 + (BITS == 32 ? 6 : 4)))
     63 
     64 static const Ebl_Register_Location fpregset_regs[] =
     65   {
     66 #if BITS == 32
     67     GR (0, 32, 32),		/* %f0-%f31 */
     68     /* 				   padding word */
     69     GR (33, 1, 70),		/* %fsr */
     70     /* 	       			   qcnt, q_entrysize, en, q, padding */
     71 # define FPREGSET_SIZE		(34 * 4 + 4 + 64 * 4 + 4)
     72 #else
     73     GR (0, 32, 32),		/* %f0-%f31 */
     74     GR (32, 1, 83),		/* %fsr */
     75     /*  33, 1, 			   %gsr */
     76     GR (34, 1, 84),		/* %fprs */
     77 # define FPREGSET_SIZE		(35 * 8)
     78 #endif
     79   };
     80 
     81 #if BITS == 32
     82 # define ULONG			uint32_t
     83 # define ALIGN_ULONG		4
     84 # define TYPE_ULONG		ELF_T_WORD
     85 # define TYPE_LONG		ELF_T_SWORD
     86 # define UID_T			uint16_t
     87 # define GID_T			uint16_t
     88 # define ALIGN_UID_T		2
     89 # define ALIGN_GID_T		2
     90 # define TYPE_UID_T		ELF_T_HALF
     91 # define TYPE_GID_T		ELF_T_HALF
     92 #else
     93 # define ULONG			uint64_t
     94 # define ALIGN_ULONG		8
     95 # define TYPE_ULONG		ELF_T_XWORD
     96 # define TYPE_LONG		ELF_T_SXWORD
     97 # define UID_T			uint32_t
     98 # define GID_T			uint32_t
     99 # define ALIGN_UID_T		4
    100 # define ALIGN_GID_T		4
    101 # define TYPE_UID_T		ELF_T_WORD
    102 # define TYPE_GID_T		ELF_T_WORD
    103 # define SUSECONDS_HALF		1
    104 #endif
    105 #define PID_T			int32_t
    106 #define ALIGN_PID_T		4
    107 #define TYPE_PID_T		ELF_T_SWORD
    108 
    109 #include "linux-core-note.c"
    110