patches/glibc/2.3.2/glibc-2.3.2-mips-user.patch
changeset 1 eeea35fbf182
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/glibc/2.3.2/glibc-2.3.2-mips-user.patch	Sat Feb 24 11:00:05 2007 +0000
     1.3 @@ -0,0 +1,588 @@
     1.4 +Retrieved from
     1.5 +http://sources.redhat.com/cgi-bin/get-raw-msg?listname=libc-alpha&date=2003-04&msgid=orfzoof4j0.fsf%40free.redhat.lsd.ic.unicamp.br
     1.6 +paths adjusted, and rediffed against glibc-2.3.2
     1.7 +(i.e. to compensate for fact that
     1.8 +http://sources.redhat.com/ml/glibc-cvs/2003-q1/msg01155.html
     1.9 +is not present)
    1.10 +
    1.11 +Should fix
    1.12 +
    1.13 +In file included from ../sysdeps/unix/sysv/linux/mips/sys/procfs.h:29,
    1.14 +                 from ../linuxthreads_db/proc_service.h:20,
    1.15 +                 from ../linuxthreads_db/thread_dbP.h:7,
    1.16 +                 from ../linuxthreads/descr.h:43,
    1.17 +                 from ../linuxthreads/internals.h:29,
    1.18 +                 from ../linuxthreads/sysdeps/pthread/bits/libc-lock.h:27,
    1.19 +                 from ../sysdeps/generic/ldsodefs.h:38,
    1.20 +                 from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
    1.21 +                 from ../sysdeps/mips/elf/ldsodefs.h:25,
    1.22 +                 from ../sysdeps/unix/sysv/linux/init-first.c:30:
    1.23 +../sysdeps/unix/sysv/linux/mips/sys/user.h:26:21: asm/reg.h: No such file or directory
    1.24 +In file included from ../sysdeps/unix/sysv/linux/mips/sys/procfs.h:29,
    1.25 +                 from ../linuxthreads_db/proc_service.h:20,
    1.26 +                 from ../linuxthreads_db/thread_dbP.h:7,
    1.27 +                 from ../linuxthreads/descr.h:43,
    1.28 +                 from ../linuxthreads/internals.h:29,
    1.29 +                 from ../linuxthreads/sysdeps/pthread/bits/libc-lock.h:27,
    1.30 +                 from ../sysdeps/generic/ldsodefs.h:38,
    1.31 +                 from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
    1.32 +                 from ../sysdeps/mips/elf/ldsodefs.h:25,
    1.33 +                 from ../sysdeps/unix/sysv/linux/init-first.c:30:
    1.34 +../sysdeps/unix/sysv/linux/mips/sys/user.h:30: error: `EF_SIZE' undeclared here (not in a function)
    1.35 +make[2]: *** [mipsel-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/csu/init-first.o] Error 1
    1.36 +make[2]: Leaving directory `mipsel-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/glibc-2.3.2/csu'
    1.37 +make[1]: *** [csu/subdir_lib] Error 2
    1.38 +make[1]: Leaving directory `mipsel-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/glibc-2.3.2'
    1.39 +make: *** [all] Error 2
    1.40 +
    1.41 +From libc-alpha-return-12105-listarch-libc-alpha=sources dot redhat dot com at sources dot redhat dot com Sat Apr 12 09:28:56 2003
    1.42 +Return-Path: <libc-alpha-return-12105-listarch-libc-alpha=sources dot redhat dot com at sources dot redhat dot com>
    1.43 +Delivered-To: listarch-libc-alpha at sources dot redhat dot com
    1.44 +Received: (qmail 2802 invoked by alias); 12 Apr 2003 09:28:56 -0000
    1.45 +Mailing-List: contact libc-alpha-help at sources dot redhat dot com; run by ezmlm
    1.46 +Precedence: bulk
    1.47 +List-Subscribe: <mailto:libc-alpha-subscribe at sources dot redhat dot com>
    1.48 +List-Archive: <http://sources.redhat.com/ml/libc-alpha/>
    1.49 +List-Post: <mailto:libc-alpha at sources dot redhat dot com>
    1.50 +List-Help: <mailto:libc-alpha-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs>
    1.51 +Sender: libc-alpha-owner at sources dot redhat dot com
    1.52 +Delivered-To: mailing list libc-alpha at sources dot redhat dot com
    1.53 +Received: (qmail 2795 invoked from network); 12 Apr 2003 09:28:55 -0000
    1.54 +Received: from unknown (HELO lacrosse.corp.redhat.com) (66.187.233.200)
    1.55 +  by sources dot redhat dot com with SMTP; 12 Apr 2003 09:28:55 -0000
    1.56 +Received: from free.redhat.lsd.ic.unicamp.br (aoliva.cipe.redhat.com [10.0.1.10])
    1.57 +	by lacrosse dot corp dot redhat dot com (8 dot 11 dot 6/8 dot 9 dot 3) with ESMTP id h3C9SqV01131
    1.58 +	for <libc-alpha at sources dot redhat dot com>; Sat, 12 Apr 2003 05:28:52 -0400
    1.59 +Received: from free.redhat.lsd.ic.unicamp.br (free.redhat.lsd.ic.unicamp.br [127.0.0.1])
    1.60 +	by free dot redhat dot lsd dot ic dot unicamp dot br (8 dot 12 dot 8/8 dot 12 dot 8) with ESMTP id h3C9SpVT028734
    1.61 +	for <libc-alpha at sources dot redhat dot com>; Sat, 12 Apr 2003 06:28:51 -0300
    1.62 +Received: (from aoliva@localhost)
    1.63 +	by free dot redhat dot lsd dot ic dot unicamp dot br (8 dot 12 dot 8/8 dot 12 dot 8/Submit) id h3C9SpFb028730;
    1.64 +	Sat, 12 Apr 2003 06:28:51 -0300
    1.65 +To: libc-alpha at sources dot redhat dot com
    1.66 +Subject: signal-handling tweaks for mips/mips64
    1.67 +From: Alexandre Oliva <aoliva at redhat dot com>
    1.68 +Organization: GCC Team, Red Hat
    1.69 +Date: 12 Apr 2003 06:28:51 -0300
    1.70 +Message-ID: <orfzoof4j0.fsf@free.redhat.lsd.ic.unicamp.br>
    1.71 +Lines: 49
    1.72 +User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2
    1.73 +MIME-Version: 1.0
    1.74 +Content-Type: multipart/mixed; boundary="=-=-="
    1.75 +
    1.76 +--=-=-=
    1.77 +
    1.78 +It was reported to me that ucontext is utterly broken, even in o32
    1.79 +with a stable 32-bit mips kernel.  Indeed, it doesn't match the
    1.80 +ucontext structure defined by the kernel at all.  This means that
    1.81 +programs taking real-time signals in o32 won't be able to extract
    1.82 +correct information from the mcontext_t, since the kernel puts data in
    1.83 +there that's in an entirely different format.
    1.84 +
    1.85 +I've looked for any ways in which the current data structures could
    1.86 +possibly be useful, and didn't find any.  gdb and rda thought they
    1.87 +were using the register arrays, but it turned out they were using the
    1.88 +arrays in procps instead.  makecontext(), [sg]etcontext() et al aren't
    1.89 +implemented on mips, so any uses thereof will just return ENOSYS,
    1.90 +without messing with the given data structure.  So, I believe it is
    1.91 +not too late for us to fix it such that it matches the kernel data
    1.92 +structures.
    1.93 +
    1.94 +While at that, I fixed a number of incompatibilities introduced by
    1.95 +either differences between kernel headers that we used to include,
    1.96 +whose contents are different depending on whether asm points to
    1.97 +asm-mips or asm-mips64.
    1.98 +
    1.99 +With this patch, after some pending kernel patches are checked in, one
   1.100 +will be able to obtain the correct information from signal handlers in
   1.101 +all mips ABIs.  With n64, this is already true.  With o32, it works
   1.102 +with the 32-bit mips kernel, but the mips64 kernel needs a patch to
   1.103 +implement the proper sigcontext ABI.  n32 still a patch to be
   1.104 +developed for it to be possible for ucontext to be POSIX-compliant.
   1.105 +Currently, the kernel uses the same ucontext for n32 and n64, but this
   1.106 +doesn't work in n32 because uc_link must be a pointer and stack_t must
   1.107 +contain a pointer and a size_t, whose sizes differ between n32 and
   1.108 +n64.  I believe Ralf is working on a patch for the kernel to generate
   1.109 +n32-compliant ucontext when invoking signal handlers in n32 processes.
   1.110 +The only uncertainty is whether uc_flags will be a 32- or 64-bit value
   1.111 +in n32; I left it as the latter, just because I already had that in
   1.112 +place; if it changes, a (simplifying) follow-up patch will be posted.
   1.113 +However, I wanted to circulate the idea of fixing ucontext_t for o32
   1.114 +as soon as possible, so I didn't wait for a decision on the exact n32
   1.115 +ABI.
   1.116 +
   1.117 +Ok to install?
   1.118 +
   1.119 +
   1.120 +--=-=-=
   1.121 +Content-Type: text/x-patch
   1.122 +Content-Disposition: inline; filename=mips-sigstuff.patch
   1.123 +
   1.124 +Index: ChangeLog
   1.125 +from  Alexandre Oliva  <aoliva@redhat.com>
   1.126 +
   1.127 +	* sysdeps/unix/sysv/linux/mips/profil-counter: New.
   1.128 +	* sysdeps/unix/sysv/linux/mips/sigcontextinfo.h: Port to n32/n64.
   1.129 +	* sysdeps/unix/sysv/linux/mips/bits/sigcontext.h: New.
   1.130 +	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Port to n32/n64.
   1.131 +	(mcontext_t): Make it match the 32-bit mips kernel in o32.
   1.132 +	* sysdeps/unix/sysv/linux/mips/sys/user.h: Bring in constants from
   1.133 +	the mips and mips64 headers.
   1.134 +	(struct user): Port to n32/n64.
   1.135 +
   1.136 +Index: sysdeps/unix/sysv/linux/mips/profil-counter.h
   1.137 +===================================================================
   1.138 +RCS file: sysdeps/unix/sysv/linux/mips/profil-counter.h
   1.139 +diff -N sysdeps/unix/sysv/linux/mips/profil-counter.h
   1.140 +--- /dev/null	1 Jan 1970 00:00:00 -0000
   1.141 ++++ libc/sysdeps/unix/sysv/linux/mips/profil-counter.h 12 Apr 2003 09:13:13 -0000
   1.142 +@@ -0,0 +1,2 @@
   1.143 ++/* We can use the ix86 version.  */
   1.144 ++#include <sysdeps/unix/sysv/linux/i386/profil-counter.h>
   1.145 +Index: sysdeps/unix/sysv/linux/mips/sigcontextinfo.h
   1.146 +===================================================================
   1.147 +RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h,v
   1.148 +retrieving revision 1.6
   1.149 +diff -u -p -r1.6 sigcontextinfo.h
   1.150 +--- libc/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h 6 Jul 2001 04:56:18 -0000 1.6
   1.151 ++++ libc/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h 12 Apr 2003 09:13:13 -0000
   1.152 +@@ -1,4 +1,4 @@
   1.153 +-/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
   1.154 ++/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
   1.155 +    This file is part of the GNU C Library.
   1.156 +    Contributed by Andreas Jaeger <aj@suse.de>, 2000.
   1.157 + 
   1.158 +@@ -18,6 +18,8 @@
   1.159 +    02111-1307 USA.  */
   1.160 + 
   1.161 + 
   1.162 ++#if _MIPS_SIM == _MIPS_SIM_ABI32
   1.163 ++
   1.164 + #define SIGCONTEXT unsigned long _code, struct sigcontext *
   1.165 + #define SIGCONTEXT_EXTRA_ARGS _code,
   1.166 + #define GET_PC(ctx)	((void *) ctx->sc_pc)
   1.167 +@@ -25,3 +27,15 @@
   1.168 + #define GET_STACK(ctx)	((void *) ctx->sc_regs[29])
   1.169 + #define CALL_SIGHANDLER(handler, signo, ctx) \
   1.170 +   (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
   1.171 ++
   1.172 ++#else
   1.173 ++
   1.174 ++#define SIGCONTEXT unsigned long _code, ucontext_t *
   1.175 ++#define SIGCONTEXT_EXTRA_ARGS _code,
   1.176 ++#define GET_PC(ctx)	((void *) ctx->uc_mcontext.pc)
   1.177 ++#define GET_FRAME(ctx)	((void *) ctx->uc_mcontext.gregs[30])
   1.178 ++#define GET_STACK(ctx)	((void *) ctx->uc_mcontext.gregs[29])
   1.179 ++#define CALL_SIGHANDLER(handler, signo, ctx) \
   1.180 ++  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
   1.181 ++
   1.182 ++#endif
   1.183 +Index: sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
   1.184 +===================================================================
   1.185 +RCS file: sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
   1.186 +diff -N sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
   1.187 +--- /dev/null	1 Jan 1970 00:00:00 -0000
   1.188 ++++ libc/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h 12 Apr 2003 09:13:13 -0000
   1.189 +@@ -0,0 +1,103 @@
   1.190 ++/* Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc.
   1.191 ++   This file is part of the GNU C Library.
   1.192 ++
   1.193 ++   The GNU C Library is free software; you can redistribute it and/or
   1.194 ++   modify it under the terms of the GNU Lesser General Public
   1.195 ++   License as published by the Free Software Foundation; either
   1.196 ++   version 2.1 of the License, or (at your option) any later version.
   1.197 ++
   1.198 ++   The GNU C Library is distributed in the hope that it will be useful,
   1.199 ++   but WITHOUT ANY WARRANTY; without even the implied warranty of
   1.200 ++   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   1.201 ++   Lesser General Public License for more details.
   1.202 ++
   1.203 ++   You should have received a copy of the GNU Lesser General Public
   1.204 ++   License along with the GNU C Library; if not, write to the Free
   1.205 ++   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   1.206 ++   02111-1307 USA.  */
   1.207 ++
   1.208 ++#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
   1.209 ++# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
   1.210 ++#endif
   1.211 ++
   1.212 ++#ifndef sigcontext_struct
   1.213 ++/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
   1.214 ++   we need sigcontext.  */
   1.215 ++# define sigcontext_struct sigcontext
   1.216 ++
   1.217 ++/* # include <asm/sigcontext.h> */
   1.218 ++/* Instead of including the kernel header, that will vary depending on
   1.219 ++   whether the 32- or the 64-bit kernel is installed, we paste the
   1.220 ++   contents here.  In case you're wondering about the different
   1.221 ++   licenses, the fact that the file is pasted, instead of included,
   1.222 ++   doesn't really make any difference for the program that includes
   1.223 ++   this header.  */
   1.224 ++#if _MIPS_SIM == _MIPS_SIM_ABI32
   1.225 ++/*
   1.226 ++ * This file is subject to the terms and conditions of the GNU General Public
   1.227 ++ * License.  See the file "COPYING" in the main directory of this archive
   1.228 ++ * for more details.
   1.229 ++ *
   1.230 ++ * Copyright (C) 1996, 1997, 2000 by Ralf Baechle
   1.231 ++ */
   1.232 ++#ifndef _ASM_SIGCONTEXT_H
   1.233 ++#define _ASM_SIGCONTEXT_H
   1.234 ++
   1.235 ++/*
   1.236 ++ * Keep this struct definition in sync with the sigcontext fragment
   1.237 ++ * in arch/mips/tools/offset.c
   1.238 ++ */
   1.239 ++struct sigcontext {
   1.240 ++	unsigned int       sc_regmask;		/* Unused */
   1.241 ++	unsigned int       sc_status;
   1.242 ++	unsigned long long sc_pc;
   1.243 ++	unsigned long long sc_regs[32];
   1.244 ++	unsigned long long sc_fpregs[32];
   1.245 ++	unsigned int       sc_ownedfp;		/* Unused */
   1.246 ++	unsigned int       sc_fpc_csr;
   1.247 ++	unsigned int       sc_fpc_eir;		/* Unused */
   1.248 ++	unsigned int       sc_used_math;
   1.249 ++	unsigned int       sc_ssflags;		/* Unused */
   1.250 ++	unsigned long long sc_mdhi;
   1.251 ++	unsigned long long sc_mdlo;
   1.252 ++
   1.253 ++	unsigned int       sc_cause;		/* Unused */
   1.254 ++	unsigned int       sc_badvaddr;		/* Unused */
   1.255 ++
   1.256 ++	unsigned long      sc_sigset[4];	/* kernel's sigset_t */
   1.257 ++};
   1.258 ++
   1.259 ++#endif /* _ASM_SIGCONTEXT_H */
   1.260 ++#else /* _MIPS_SIM != _MIPS_SIM_ABI32 */
   1.261 ++/*
   1.262 ++ * This file is subject to the terms and conditions of the GNU General Public
   1.263 ++ * License.  See the file "COPYING" in the main directory of this archive
   1.264 ++ * for more details.
   1.265 ++ *
   1.266 ++ * Copyright (C) 1996, 1997, 1999 by Ralf Baechle
   1.267 ++ * Copyright (C) 1999 Silicon Graphics, Inc.
   1.268 ++ */
   1.269 ++#ifndef _ASM_SIGCONTEXT_H
   1.270 ++#define _ASM_SIGCONTEXT_H
   1.271 ++
   1.272 ++/*
   1.273 ++ * Keep this struct definition in sync with the sigcontext fragment
   1.274 ++ * in arch/mips/tools/offset.c
   1.275 ++ */
   1.276 ++struct sigcontext {
   1.277 ++	unsigned long long sc_regs[32];
   1.278 ++	unsigned long long sc_fpregs[32];
   1.279 ++	unsigned long long sc_mdhi;
   1.280 ++	unsigned long long sc_mdlo;
   1.281 ++	unsigned long long sc_pc;
   1.282 ++	unsigned int       sc_status;
   1.283 ++	unsigned int       sc_fpc_csr;
   1.284 ++	unsigned int       sc_fpc_eir;
   1.285 ++	unsigned int       sc_used_math;
   1.286 ++	unsigned int       sc_cause;
   1.287 ++	unsigned int       sc_badvaddr;
   1.288 ++};
   1.289 ++
   1.290 ++#endif /* _ASM_SIGCONTEXT_H */
   1.291 ++#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */
   1.292 ++#endif
   1.293 +[hunk deleted, see below]
   1.294 +Index: sysdeps/unix/sysv/linux/mips/sys/user.h
   1.295 +===================================================================
   1.296 +RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/sys/user.h,v
   1.297 +retrieving revision 1.1
   1.298 +diff -u -p -r1.1 user.h
   1.299 +--- libc/sysdeps/unix/sysv/linux/mips/sys/user.h 8 Feb 2002 16:21:00 -0000 1.1
   1.300 ++++ libc/sysdeps/unix/sysv/linux/mips/sys/user.h 12 Apr 2003 09:13:13 -0000
   1.301 +@@ -1,4 +1,4 @@
   1.302 +-/* Copyright (C) 2002 Free Software Foundation, Inc.
   1.303 ++/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
   1.304 +    This file is part of the GNU C Library.
   1.305 + 
   1.306 +    The GNU C Library is free software; you can redistribute it and/or
   1.307 +@@ -23,7 +23,154 @@
   1.308 +    too much into it.  Don't use it for anything other than GDB unless
   1.309 +    you know what you are doing.  */
   1.310 + 
   1.311 +-#include <asm/reg.h>
   1.312 ++/* #include <asm/reg.h> */
   1.313 ++/* Instead of including the kernel header, that will vary depending on
   1.314 ++   whether the 32- or the 64-bit kernel is installed, we paste its
   1.315 ++   contents here.  Note that the fact that the file is inline here,
   1.316 ++   instead of included separately, doesn't change in any way the
   1.317 ++   licensing status of a program that includes user.h.  Since this is
   1.318 ++   for gdb alone, and gdb is GPLed, no surprises here.  */
   1.319 ++#if _MIPS_SIM == _MIPS_SIM_ABI32
   1.320 ++/*
   1.321 ++ * Various register offset definitions for debuggers, core file
   1.322 ++ * examiners and whatnot.
   1.323 ++ *
   1.324 ++ * This file is subject to the terms and conditions of the GNU General Public
   1.325 ++ * License.  See the file "COPYING" in the main directory of this archive
   1.326 ++ * for more details.
   1.327 ++ *
   1.328 ++ * Copyright (C) 1995, 1999 by Ralf Baechle
   1.329 ++ */
   1.330 ++#ifndef __ASM_MIPS_REG_H
   1.331 ++#define __ASM_MIPS_REG_H
   1.332 ++
   1.333 ++/*
   1.334 ++ * This defines/structures correspond to the register layout on stack -
   1.335 ++ * if the order here is changed, it needs to be updated in
   1.336 ++ * include/asm-mips/stackframe.h
   1.337 ++ */
   1.338 ++#define EF_REG0			6
   1.339 ++#define EF_REG1			7
   1.340 ++#define EF_REG2			8
   1.341 ++#define EF_REG3			9
   1.342 ++#define EF_REG4			10
   1.343 ++#define EF_REG5			11
   1.344 ++#define EF_REG6			12
   1.345 ++#define EF_REG7			13
   1.346 ++#define EF_REG8			14
   1.347 ++#define EF_REG9			15
   1.348 ++#define EF_REG10		16
   1.349 ++#define EF_REG11		17
   1.350 ++#define EF_REG12		18
   1.351 ++#define EF_REG13		19
   1.352 ++#define EF_REG14		20
   1.353 ++#define EF_REG15		21
   1.354 ++#define EF_REG16		22
   1.355 ++#define EF_REG17		23
   1.356 ++#define EF_REG18		24
   1.357 ++#define EF_REG19		25
   1.358 ++#define EF_REG20		26
   1.359 ++#define EF_REG21		27
   1.360 ++#define EF_REG22		28
   1.361 ++#define EF_REG23		29
   1.362 ++#define EF_REG24		30
   1.363 ++#define EF_REG25		31
   1.364 ++/*
   1.365 ++ * k0/k1 unsaved
   1.366 ++ */
   1.367 ++#define EF_REG28		34
   1.368 ++#define EF_REG29		35
   1.369 ++#define EF_REG30		36
   1.370 ++#define EF_REG31		37
   1.371 ++
   1.372 ++/*
   1.373 ++ * Saved special registers
   1.374 ++ */
   1.375 ++#define EF_LO			38
   1.376 ++#define EF_HI			39
   1.377 ++
   1.378 ++#define EF_CP0_EPC		40
   1.379 ++#define EF_CP0_BADVADDR		41
   1.380 ++#define EF_CP0_STATUS		42
   1.381 ++#define EF_CP0_CAUSE		43
   1.382 ++
   1.383 ++#define EF_SIZE			180	/* size in bytes */
   1.384 ++
   1.385 ++#endif /* __ASM_MIPS_REG_H */
   1.386 ++
   1.387 ++#else /* _MIPS_SIM != _MIPS_SIM_ABI32 */
   1.388 ++
   1.389 ++/*
   1.390 ++ * Various register offset definitions for debuggers, core file
   1.391 ++ * examiners and whatnot.
   1.392 ++ *
   1.393 ++ * This file is subject to the terms and conditions of the GNU General Public
   1.394 ++ * License.  See the file "COPYING" in the main directory of this archive
   1.395 ++ * for more details.
   1.396 ++ *
   1.397 ++ * Copyright (C) 1995, 1999 Ralf Baechle
   1.398 ++ * Copyright (C) 1995, 1999 Silicon Graphics
   1.399 ++ */
   1.400 ++#ifndef _ASM_REG_H
   1.401 ++#define _ASM_REG_H
   1.402 ++
   1.403 ++/*
   1.404 ++ * This defines/structures correspond to the register layout on stack -
   1.405 ++ * if the order here is changed, it needs to be updated in
   1.406 ++ * include/asm-mips/stackframe.h
   1.407 ++ */
   1.408 ++#define EF_REG0			 0
   1.409 ++#define EF_REG1			 1
   1.410 ++#define EF_REG2			 2
   1.411 ++#define EF_REG3			 3
   1.412 ++#define EF_REG4			 4
   1.413 ++#define EF_REG5			 5
   1.414 ++#define EF_REG6			 6
   1.415 ++#define EF_REG7			 7
   1.416 ++#define EF_REG8			 8
   1.417 ++#define EF_REG9			 9
   1.418 ++#define EF_REG10		10
   1.419 ++#define EF_REG11		11
   1.420 ++#define EF_REG12		12
   1.421 ++#define EF_REG13		13
   1.422 ++#define EF_REG14		14
   1.423 ++#define EF_REG15		15
   1.424 ++#define EF_REG16		16
   1.425 ++#define EF_REG17		17
   1.426 ++#define EF_REG18		18
   1.427 ++#define EF_REG19		19
   1.428 ++#define EF_REG20		20
   1.429 ++#define EF_REG21		21
   1.430 ++#define EF_REG22		22
   1.431 ++#define EF_REG23		23
   1.432 ++#define EF_REG24		24
   1.433 ++#define EF_REG25		25
   1.434 ++/*
   1.435 ++ * k0/k1 unsaved
   1.436 ++ */
   1.437 ++#define EF_REG28		28
   1.438 ++#define EF_REG29		29
   1.439 ++#define EF_REG30		30
   1.440 ++#define EF_REG31		31
   1.441 ++
   1.442 ++/*
   1.443 ++ * Saved special registers
   1.444 ++ */
   1.445 ++#define EF_LO			32
   1.446 ++#define EF_HI			33
   1.447 ++
   1.448 ++#define EF_CP0_EPC		34
   1.449 ++#define EF_CP0_BADVADDR		35
   1.450 ++#define EF_CP0_STATUS		36
   1.451 ++#define EF_CP0_CAUSE		37
   1.452 ++
   1.453 ++#define EF_SIZE			304	/* size in bytes */
   1.454 ++
   1.455 ++#endif /* _ASM_REG_H */
   1.456 ++
   1.457 ++#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */
   1.458 ++
   1.459 ++#if _MIPS_SIM == _MIPS_SIM_ABI32
   1.460 + 
   1.461 + struct user
   1.462 + {
   1.463 +@@ -39,6 +186,24 @@ struct user
   1.464 +   unsigned long	magic;			/* identifies a core file */
   1.465 +   char		u_comm[32];		/* user command name */
   1.466 + };
   1.467 ++
   1.468 ++#else
   1.469 ++
   1.470 ++struct user {
   1.471 ++  __extension__ unsigned long	regs[EF_SIZE/8+64]; /* integer and fp regs */
   1.472 ++  __extension__ unsigned long	u_tsize;	/* text size (pages) */
   1.473 ++  __extension__ unsigned long	u_dsize;	/* data size (pages) */
   1.474 ++  __extension__ unsigned long	u_ssize;	/* stack size (pages) */
   1.475 ++  __extension__ unsigned long long start_code;	/* text starting address */
   1.476 ++  __extension__ unsigned long long start_data;	/* data starting address */
   1.477 ++  __extension__ unsigned long long start_stack;	/* stack starting address */
   1.478 ++  __extension__ long long	signal;		/* signal causing core dump */
   1.479 ++  __extension__ unsigned long long u_ar0;	/* help gdb find registers */
   1.480 ++  __extension__ unsigned long long magic;	/* identifies a core file */
   1.481 ++  char		u_comm[32];		/* user command name */
   1.482 ++};
   1.483 ++
   1.484 ++#endif
   1.485 + 
   1.486 + #define PAGE_SHIFT		12
   1.487 + #define PAGE_SIZE		(1UL << PAGE_SHIFT)
   1.488 +
   1.489 +--=-=-=
   1.490 +
   1.491 +
   1.492 +-- 
   1.493 +Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
   1.494 +Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
   1.495 +CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
   1.496 +Free Software Evangelist                Professional serial bug killer
   1.497 +
   1.498 +--=-=-=--
   1.499 +
   1.500 +And the rediffed hunk:
   1.501 +
   1.502 +--- glibc-2.3.2/sysdeps/unix/sysv/linux/mips/sys/ucontext.h.old	2004-05-30 07:23:32.000000000 -0700
   1.503 ++++ glibc-2.3.2/sysdeps/unix/sysv/linux/mips/sys/ucontext.h	2004-05-30 07:22:56.000000000 -0700
   1.504 +@@ -29,43 +29,72 @@
   1.505 + #include <bits/sigcontext.h>
   1.506 + 
   1.507 + 
   1.508 +-/* Type for general register.  */
   1.509 +-typedef unsigned long int greg_t;
   1.510 ++/* Type for general register.  Even in o32 we assume 64-bit registers,
   1.511 ++   like the kernel.  */
   1.512 ++__extension__ typedef unsigned long long int greg_t;
   1.513 + 
   1.514 + /* Number of general registers.  */
   1.515 +-#define NGREG	37
   1.516 +-#define NFPREG	33
   1.517 ++#define NGREG	32
   1.518 ++#define NFPREG	32
   1.519 + 
   1.520 + /* Container for all general registers.  */
   1.521 +-/* gregset_t must be an array.  The below declared array corresponds to:
   1.522 +-typedef struct gregset {
   1.523 +-	greg_t	g_regs[32];
   1.524 +-	greg_t	g_hi;
   1.525 +-	greg_t	g_lo;
   1.526 +-	greg_t	g_pad[3];
   1.527 +-} gregset_t;  */
   1.528 + typedef greg_t gregset_t[NGREG];
   1.529 + 
   1.530 + /* Container for all FPU registers.  */
   1.531 + typedef struct fpregset {
   1.532 + 	union {
   1.533 +-		double	fp_dregs[32];
   1.534 ++		double	fp_dregs[NFPREG];
   1.535 + 		struct {
   1.536 + 			float		_fp_fregs;
   1.537 + 			unsigned int	_fp_pad;
   1.538 +-		} fp_fregs[32];
   1.539 ++		} fp_fregs[NFPREG];
   1.540 + 	} fp_r;
   1.541 +-	unsigned int	fp_csr;
   1.542 +-	unsigned int	fp_pad;
   1.543 + } fpregset_t;
   1.544 + 
   1.545 + 
   1.546 + /* Context to describe whole processor state.  */
   1.547 ++#if _MIPS_SIM == _MIPS_SIM_ABI32
   1.548 ++/* Earlier versions of glibc for mips had an entirely different
   1.549 ++   definition of mcontext_t, that didn't even resemble the
   1.550 ++   corresponding kernel data structure.  Since all legitimate uses of
   1.551 ++   ucontext_t in glibc mustn't have accessed anything beyond
   1.552 ++   uc_mcontext and, even then, taking a pointer to it, casting it to
   1.553 ++   sigcontext_t, and accessing it as such, which is what it has always
   1.554 ++   been, this can still be rectified.  Fortunately, makecontext,
   1.555 ++   [gs]etcontext et all have never been implemented.  */
   1.556 + typedef struct
   1.557 +   {
   1.558 ++    unsigned int regmask;
   1.559 ++    unsigned int status;
   1.560 ++    greg_t pc;
   1.561 +     gregset_t gregs;
   1.562 +     fpregset_t fpregs;
   1.563 ++    unsigned int fp_owned;
   1.564 ++    unsigned int fpc_csr;
   1.565 ++    unsigned int fpc_eir;
   1.566 ++    unsigned int used_math;
   1.567 ++    unsigned int ssflags;
   1.568 ++    greg_t mdhi;
   1.569 ++    greg_t mdlo;
   1.570 ++    unsigned int cause;
   1.571 ++    unsigned int badvaddr;
   1.572 +   } mcontext_t;
   1.573 ++#else
   1.574 ++typedef struct
   1.575 ++  {
   1.576 ++    gregset_t gregs;
   1.577 ++    fpregset_t fpregs;
   1.578 ++    greg_t mdhi;
   1.579 ++    greg_t mdlo;
   1.580 ++    greg_t pc;
   1.581 ++    unsigned int status;
   1.582 ++    unsigned int fpc_csr;
   1.583 ++    unsigned int fpc_eir;
   1.584 ++    unsigned int used_math;
   1.585 ++    unsigned int cause;
   1.586 ++    unsigned int badvaddr;
   1.587 ++  } mcontext_t;
   1.588 ++#endif
   1.589 + 
   1.590 + /* Userlevel context.  */
   1.591 + typedef struct ucontext