patches/glibc/2.3.2/glibc-2.3.2-mips-user.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
     1 Retrieved from
     2 http://sources.redhat.com/cgi-bin/get-raw-msg?listname=libc-alpha&date=2003-04&msgid=orfzoof4j0.fsf%40free.redhat.lsd.ic.unicamp.br
     3 paths adjusted, and rediffed against glibc-2.3.2
     4 (i.e. to compensate for fact that
     5 http://sources.redhat.com/ml/glibc-cvs/2003-q1/msg01155.html
     6 is not present)
     7 
     8 Should fix
     9 
    10 In file included from ../sysdeps/unix/sysv/linux/mips/sys/procfs.h:29,
    11                  from ../linuxthreads_db/proc_service.h:20,
    12                  from ../linuxthreads_db/thread_dbP.h:7,
    13                  from ../linuxthreads/descr.h:43,
    14                  from ../linuxthreads/internals.h:29,
    15                  from ../linuxthreads/sysdeps/pthread/bits/libc-lock.h:27,
    16                  from ../sysdeps/generic/ldsodefs.h:38,
    17                  from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
    18                  from ../sysdeps/mips/elf/ldsodefs.h:25,
    19                  from ../sysdeps/unix/sysv/linux/init-first.c:30:
    20 ../sysdeps/unix/sysv/linux/mips/sys/user.h:26:21: asm/reg.h: No such file or directory
    21 In file included from ../sysdeps/unix/sysv/linux/mips/sys/procfs.h:29,
    22                  from ../linuxthreads_db/proc_service.h:20,
    23                  from ../linuxthreads_db/thread_dbP.h:7,
    24                  from ../linuxthreads/descr.h:43,
    25                  from ../linuxthreads/internals.h:29,
    26                  from ../linuxthreads/sysdeps/pthread/bits/libc-lock.h:27,
    27                  from ../sysdeps/generic/ldsodefs.h:38,
    28                  from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
    29                  from ../sysdeps/mips/elf/ldsodefs.h:25,
    30                  from ../sysdeps/unix/sysv/linux/init-first.c:30:
    31 ../sysdeps/unix/sysv/linux/mips/sys/user.h:30: error: `EF_SIZE' undeclared here (not in a function)
    32 make[2]: *** [mipsel-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/csu/init-first.o] Error 1
    33 make[2]: Leaving directory `mipsel-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/glibc-2.3.2/csu'
    34 make[1]: *** [csu/subdir_lib] Error 2
    35 make[1]: Leaving directory `mipsel-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/glibc-2.3.2'
    36 make: *** [all] Error 2
    37 
    38 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
    39 Return-Path: <libc-alpha-return-12105-listarch-libc-alpha=sources dot redhat dot com at sources dot redhat dot com>
    40 Delivered-To: listarch-libc-alpha at sources dot redhat dot com
    41 Received: (qmail 2802 invoked by alias); 12 Apr 2003 09:28:56 -0000
    42 Mailing-List: contact libc-alpha-help at sources dot redhat dot com; run by ezmlm
    43 Precedence: bulk
    44 List-Subscribe: <mailto:libc-alpha-subscribe at sources dot redhat dot com>
    45 List-Archive: <http://sources.redhat.com/ml/libc-alpha/>
    46 List-Post: <mailto:libc-alpha at sources dot redhat dot com>
    47 List-Help: <mailto:libc-alpha-help at sources dot redhat dot com>, <http://sources dot redhat dot com/ml/#faqs>
    48 Sender: libc-alpha-owner at sources dot redhat dot com
    49 Delivered-To: mailing list libc-alpha at sources dot redhat dot com
    50 Received: (qmail 2795 invoked from network); 12 Apr 2003 09:28:55 -0000
    51 Received: from unknown (HELO lacrosse.corp.redhat.com) (66.187.233.200)
    52   by sources dot redhat dot com with SMTP; 12 Apr 2003 09:28:55 -0000
    53 Received: from free.redhat.lsd.ic.unicamp.br (aoliva.cipe.redhat.com [10.0.1.10])
    54 	by lacrosse dot corp dot redhat dot com (8 dot 11 dot 6/8 dot 9 dot 3) with ESMTP id h3C9SqV01131
    55 	for <libc-alpha at sources dot redhat dot com>; Sat, 12 Apr 2003 05:28:52 -0400
    56 Received: from free.redhat.lsd.ic.unicamp.br (free.redhat.lsd.ic.unicamp.br [127.0.0.1])
    57 	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
    58 	for <libc-alpha at sources dot redhat dot com>; Sat, 12 Apr 2003 06:28:51 -0300
    59 Received: (from aoliva@localhost)
    60 	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;
    61 	Sat, 12 Apr 2003 06:28:51 -0300
    62 To: libc-alpha at sources dot redhat dot com
    63 Subject: signal-handling tweaks for mips/mips64
    64 From: Alexandre Oliva <aoliva at redhat dot com>
    65 Organization: GCC Team, Red Hat
    66 Date: 12 Apr 2003 06:28:51 -0300
    67 Message-ID: <orfzoof4j0.fsf@free.redhat.lsd.ic.unicamp.br>
    68 Lines: 49
    69 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2
    70 MIME-Version: 1.0
    71 Content-Type: multipart/mixed; boundary="=-=-="
    72 
    73 --=-=-=
    74 
    75 It was reported to me that ucontext is utterly broken, even in o32
    76 with a stable 32-bit mips kernel.  Indeed, it doesn't match the
    77 ucontext structure defined by the kernel at all.  This means that
    78 programs taking real-time signals in o32 won't be able to extract
    79 correct information from the mcontext_t, since the kernel puts data in
    80 there that's in an entirely different format.
    81 
    82 I've looked for any ways in which the current data structures could
    83 possibly be useful, and didn't find any.  gdb and rda thought they
    84 were using the register arrays, but it turned out they were using the
    85 arrays in procps instead.  makecontext(), [sg]etcontext() et al aren't
    86 implemented on mips, so any uses thereof will just return ENOSYS,
    87 without messing with the given data structure.  So, I believe it is
    88 not too late for us to fix it such that it matches the kernel data
    89 structures.
    90 
    91 While at that, I fixed a number of incompatibilities introduced by
    92 either differences between kernel headers that we used to include,
    93 whose contents are different depending on whether asm points to
    94 asm-mips or asm-mips64.
    95 
    96 With this patch, after some pending kernel patches are checked in, one
    97 will be able to obtain the correct information from signal handlers in
    98 all mips ABIs.  With n64, this is already true.  With o32, it works
    99 with the 32-bit mips kernel, but the mips64 kernel needs a patch to
   100 implement the proper sigcontext ABI.  n32 still a patch to be
   101 developed for it to be possible for ucontext to be POSIX-compliant.
   102 Currently, the kernel uses the same ucontext for n32 and n64, but this
   103 doesn't work in n32 because uc_link must be a pointer and stack_t must
   104 contain a pointer and a size_t, whose sizes differ between n32 and
   105 n64.  I believe Ralf is working on a patch for the kernel to generate
   106 n32-compliant ucontext when invoking signal handlers in n32 processes.
   107 The only uncertainty is whether uc_flags will be a 32- or 64-bit value
   108 in n32; I left it as the latter, just because I already had that in
   109 place; if it changes, a (simplifying) follow-up patch will be posted.
   110 However, I wanted to circulate the idea of fixing ucontext_t for o32
   111 as soon as possible, so I didn't wait for a decision on the exact n32
   112 ABI.
   113 
   114 Ok to install?
   115 
   116 
   117 --=-=-=
   118 Content-Type: text/x-patch
   119 Content-Disposition: inline; filename=mips-sigstuff.patch
   120 
   121 Index: ChangeLog
   122 from  Alexandre Oliva  <aoliva@redhat.com>
   123 
   124 	* sysdeps/unix/sysv/linux/mips/profil-counter: New.
   125 	* sysdeps/unix/sysv/linux/mips/sigcontextinfo.h: Port to n32/n64.
   126 	* sysdeps/unix/sysv/linux/mips/bits/sigcontext.h: New.
   127 	* sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Port to n32/n64.
   128 	(mcontext_t): Make it match the 32-bit mips kernel in o32.
   129 	* sysdeps/unix/sysv/linux/mips/sys/user.h: Bring in constants from
   130 	the mips and mips64 headers.
   131 	(struct user): Port to n32/n64.
   132 
   133 Index: sysdeps/unix/sysv/linux/mips/profil-counter.h
   134 ===================================================================
   135 RCS file: sysdeps/unix/sysv/linux/mips/profil-counter.h
   136 diff -N sysdeps/unix/sysv/linux/mips/profil-counter.h
   137 --- /dev/null	1 Jan 1970 00:00:00 -0000
   138 +++ libc/sysdeps/unix/sysv/linux/mips/profil-counter.h 12 Apr 2003 09:13:13 -0000
   139 @@ -0,0 +1,2 @@
   140 +/* We can use the ix86 version.  */
   141 +#include <sysdeps/unix/sysv/linux/i386/profil-counter.h>
   142 Index: sysdeps/unix/sysv/linux/mips/sigcontextinfo.h
   143 ===================================================================
   144 RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h,v
   145 retrieving revision 1.6
   146 diff -u -p -r1.6 sigcontextinfo.h
   147 --- libc/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h 6 Jul 2001 04:56:18 -0000 1.6
   148 +++ libc/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h 12 Apr 2003 09:13:13 -0000
   149 @@ -1,4 +1,4 @@
   150 -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc.
   151 +/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc.
   152     This file is part of the GNU C Library.
   153     Contributed by Andreas Jaeger <aj@suse.de>, 2000.
   154  
   155 @@ -18,6 +18,8 @@
   156     02111-1307 USA.  */
   157  
   158  
   159 +#if _MIPS_SIM == _MIPS_SIM_ABI32
   160 +
   161  #define SIGCONTEXT unsigned long _code, struct sigcontext *
   162  #define SIGCONTEXT_EXTRA_ARGS _code,
   163  #define GET_PC(ctx)	((void *) ctx->sc_pc)
   164 @@ -25,3 +27,15 @@
   165  #define GET_STACK(ctx)	((void *) ctx->sc_regs[29])
   166  #define CALL_SIGHANDLER(handler, signo, ctx) \
   167    (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
   168 +
   169 +#else
   170 +
   171 +#define SIGCONTEXT unsigned long _code, ucontext_t *
   172 +#define SIGCONTEXT_EXTRA_ARGS _code,
   173 +#define GET_PC(ctx)	((void *) ctx->uc_mcontext.pc)
   174 +#define GET_FRAME(ctx)	((void *) ctx->uc_mcontext.gregs[30])
   175 +#define GET_STACK(ctx)	((void *) ctx->uc_mcontext.gregs[29])
   176 +#define CALL_SIGHANDLER(handler, signo, ctx) \
   177 +  (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx))
   178 +
   179 +#endif
   180 Index: sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
   181 ===================================================================
   182 RCS file: sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
   183 diff -N sysdeps/unix/sysv/linux/mips/bits/sigcontext.h
   184 --- /dev/null	1 Jan 1970 00:00:00 -0000
   185 +++ libc/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h 12 Apr 2003 09:13:13 -0000
   186 @@ -0,0 +1,103 @@
   187 +/* Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc.
   188 +   This file is part of the GNU C Library.
   189 +
   190 +   The GNU C Library is free software; you can redistribute it and/or
   191 +   modify it under the terms of the GNU Lesser General Public
   192 +   License as published by the Free Software Foundation; either
   193 +   version 2.1 of the License, or (at your option) any later version.
   194 +
   195 +   The GNU C Library is distributed in the hope that it will be useful,
   196 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
   197 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   198 +   Lesser General Public License for more details.
   199 +
   200 +   You should have received a copy of the GNU Lesser General Public
   201 +   License along with the GNU C Library; if not, write to the Free
   202 +   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   203 +   02111-1307 USA.  */
   204 +
   205 +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
   206 +# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
   207 +#endif
   208 +
   209 +#ifndef sigcontext_struct
   210 +/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
   211 +   we need sigcontext.  */
   212 +# define sigcontext_struct sigcontext
   213 +
   214 +/* # include <asm/sigcontext.h> */
   215 +/* Instead of including the kernel header, that will vary depending on
   216 +   whether the 32- or the 64-bit kernel is installed, we paste the
   217 +   contents here.  In case you're wondering about the different
   218 +   licenses, the fact that the file is pasted, instead of included,
   219 +   doesn't really make any difference for the program that includes
   220 +   this header.  */
   221 +#if _MIPS_SIM == _MIPS_SIM_ABI32
   222 +/*
   223 + * This file is subject to the terms and conditions of the GNU General Public
   224 + * License.  See the file "COPYING" in the main directory of this archive
   225 + * for more details.
   226 + *
   227 + * Copyright (C) 1996, 1997, 2000 by Ralf Baechle
   228 + */
   229 +#ifndef _ASM_SIGCONTEXT_H
   230 +#define _ASM_SIGCONTEXT_H
   231 +
   232 +/*
   233 + * Keep this struct definition in sync with the sigcontext fragment
   234 + * in arch/mips/tools/offset.c
   235 + */
   236 +struct sigcontext {
   237 +	unsigned int       sc_regmask;		/* Unused */
   238 +	unsigned int       sc_status;
   239 +	unsigned long long sc_pc;
   240 +	unsigned long long sc_regs[32];
   241 +	unsigned long long sc_fpregs[32];
   242 +	unsigned int       sc_ownedfp;		/* Unused */
   243 +	unsigned int       sc_fpc_csr;
   244 +	unsigned int       sc_fpc_eir;		/* Unused */
   245 +	unsigned int       sc_used_math;
   246 +	unsigned int       sc_ssflags;		/* Unused */
   247 +	unsigned long long sc_mdhi;
   248 +	unsigned long long sc_mdlo;
   249 +
   250 +	unsigned int       sc_cause;		/* Unused */
   251 +	unsigned int       sc_badvaddr;		/* Unused */
   252 +
   253 +	unsigned long      sc_sigset[4];	/* kernel's sigset_t */
   254 +};
   255 +
   256 +#endif /* _ASM_SIGCONTEXT_H */
   257 +#else /* _MIPS_SIM != _MIPS_SIM_ABI32 */
   258 +/*
   259 + * This file is subject to the terms and conditions of the GNU General Public
   260 + * License.  See the file "COPYING" in the main directory of this archive
   261 + * for more details.
   262 + *
   263 + * Copyright (C) 1996, 1997, 1999 by Ralf Baechle
   264 + * Copyright (C) 1999 Silicon Graphics, Inc.
   265 + */
   266 +#ifndef _ASM_SIGCONTEXT_H
   267 +#define _ASM_SIGCONTEXT_H
   268 +
   269 +/*
   270 + * Keep this struct definition in sync with the sigcontext fragment
   271 + * in arch/mips/tools/offset.c
   272 + */
   273 +struct sigcontext {
   274 +	unsigned long long sc_regs[32];
   275 +	unsigned long long sc_fpregs[32];
   276 +	unsigned long long sc_mdhi;
   277 +	unsigned long long sc_mdlo;
   278 +	unsigned long long sc_pc;
   279 +	unsigned int       sc_status;
   280 +	unsigned int       sc_fpc_csr;
   281 +	unsigned int       sc_fpc_eir;
   282 +	unsigned int       sc_used_math;
   283 +	unsigned int       sc_cause;
   284 +	unsigned int       sc_badvaddr;
   285 +};
   286 +
   287 +#endif /* _ASM_SIGCONTEXT_H */
   288 +#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */
   289 +#endif
   290 [hunk deleted, see below]
   291 Index: sysdeps/unix/sysv/linux/mips/sys/user.h
   292 ===================================================================
   293 RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/sys/user.h,v
   294 retrieving revision 1.1
   295 diff -u -p -r1.1 user.h
   296 --- libc/sysdeps/unix/sysv/linux/mips/sys/user.h 8 Feb 2002 16:21:00 -0000 1.1
   297 +++ libc/sysdeps/unix/sysv/linux/mips/sys/user.h 12 Apr 2003 09:13:13 -0000
   298 @@ -1,4 +1,4 @@
   299 -/* Copyright (C) 2002 Free Software Foundation, Inc.
   300 +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
   301     This file is part of the GNU C Library.
   302  
   303     The GNU C Library is free software; you can redistribute it and/or
   304 @@ -23,7 +23,154 @@
   305     too much into it.  Don't use it for anything other than GDB unless
   306     you know what you are doing.  */
   307  
   308 -#include <asm/reg.h>
   309 +/* #include <asm/reg.h> */
   310 +/* Instead of including the kernel header, that will vary depending on
   311 +   whether the 32- or the 64-bit kernel is installed, we paste its
   312 +   contents here.  Note that the fact that the file is inline here,
   313 +   instead of included separately, doesn't change in any way the
   314 +   licensing status of a program that includes user.h.  Since this is
   315 +   for gdb alone, and gdb is GPLed, no surprises here.  */
   316 +#if _MIPS_SIM == _MIPS_SIM_ABI32
   317 +/*
   318 + * Various register offset definitions for debuggers, core file
   319 + * examiners and whatnot.
   320 + *
   321 + * This file is subject to the terms and conditions of the GNU General Public
   322 + * License.  See the file "COPYING" in the main directory of this archive
   323 + * for more details.
   324 + *
   325 + * Copyright (C) 1995, 1999 by Ralf Baechle
   326 + */
   327 +#ifndef __ASM_MIPS_REG_H
   328 +#define __ASM_MIPS_REG_H
   329 +
   330 +/*
   331 + * This defines/structures correspond to the register layout on stack -
   332 + * if the order here is changed, it needs to be updated in
   333 + * include/asm-mips/stackframe.h
   334 + */
   335 +#define EF_REG0			6
   336 +#define EF_REG1			7
   337 +#define EF_REG2			8
   338 +#define EF_REG3			9
   339 +#define EF_REG4			10
   340 +#define EF_REG5			11
   341 +#define EF_REG6			12
   342 +#define EF_REG7			13
   343 +#define EF_REG8			14
   344 +#define EF_REG9			15
   345 +#define EF_REG10		16
   346 +#define EF_REG11		17
   347 +#define EF_REG12		18
   348 +#define EF_REG13		19
   349 +#define EF_REG14		20
   350 +#define EF_REG15		21
   351 +#define EF_REG16		22
   352 +#define EF_REG17		23
   353 +#define EF_REG18		24
   354 +#define EF_REG19		25
   355 +#define EF_REG20		26
   356 +#define EF_REG21		27
   357 +#define EF_REG22		28
   358 +#define EF_REG23		29
   359 +#define EF_REG24		30
   360 +#define EF_REG25		31
   361 +/*
   362 + * k0/k1 unsaved
   363 + */
   364 +#define EF_REG28		34
   365 +#define EF_REG29		35
   366 +#define EF_REG30		36
   367 +#define EF_REG31		37
   368 +
   369 +/*
   370 + * Saved special registers
   371 + */
   372 +#define EF_LO			38
   373 +#define EF_HI			39
   374 +
   375 +#define EF_CP0_EPC		40
   376 +#define EF_CP0_BADVADDR		41
   377 +#define EF_CP0_STATUS		42
   378 +#define EF_CP0_CAUSE		43
   379 +
   380 +#define EF_SIZE			180	/* size in bytes */
   381 +
   382 +#endif /* __ASM_MIPS_REG_H */
   383 +
   384 +#else /* _MIPS_SIM != _MIPS_SIM_ABI32 */
   385 +
   386 +/*
   387 + * Various register offset definitions for debuggers, core file
   388 + * examiners and whatnot.
   389 + *
   390 + * This file is subject to the terms and conditions of the GNU General Public
   391 + * License.  See the file "COPYING" in the main directory of this archive
   392 + * for more details.
   393 + *
   394 + * Copyright (C) 1995, 1999 Ralf Baechle
   395 + * Copyright (C) 1995, 1999 Silicon Graphics
   396 + */
   397 +#ifndef _ASM_REG_H
   398 +#define _ASM_REG_H
   399 +
   400 +/*
   401 + * This defines/structures correspond to the register layout on stack -
   402 + * if the order here is changed, it needs to be updated in
   403 + * include/asm-mips/stackframe.h
   404 + */
   405 +#define EF_REG0			 0
   406 +#define EF_REG1			 1
   407 +#define EF_REG2			 2
   408 +#define EF_REG3			 3
   409 +#define EF_REG4			 4
   410 +#define EF_REG5			 5
   411 +#define EF_REG6			 6
   412 +#define EF_REG7			 7
   413 +#define EF_REG8			 8
   414 +#define EF_REG9			 9
   415 +#define EF_REG10		10
   416 +#define EF_REG11		11
   417 +#define EF_REG12		12
   418 +#define EF_REG13		13
   419 +#define EF_REG14		14
   420 +#define EF_REG15		15
   421 +#define EF_REG16		16
   422 +#define EF_REG17		17
   423 +#define EF_REG18		18
   424 +#define EF_REG19		19
   425 +#define EF_REG20		20
   426 +#define EF_REG21		21
   427 +#define EF_REG22		22
   428 +#define EF_REG23		23
   429 +#define EF_REG24		24
   430 +#define EF_REG25		25
   431 +/*
   432 + * k0/k1 unsaved
   433 + */
   434 +#define EF_REG28		28
   435 +#define EF_REG29		29
   436 +#define EF_REG30		30
   437 +#define EF_REG31		31
   438 +
   439 +/*
   440 + * Saved special registers
   441 + */
   442 +#define EF_LO			32
   443 +#define EF_HI			33
   444 +
   445 +#define EF_CP0_EPC		34
   446 +#define EF_CP0_BADVADDR		35
   447 +#define EF_CP0_STATUS		36
   448 +#define EF_CP0_CAUSE		37
   449 +
   450 +#define EF_SIZE			304	/* size in bytes */
   451 +
   452 +#endif /* _ASM_REG_H */
   453 +
   454 +#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */
   455 +
   456 +#if _MIPS_SIM == _MIPS_SIM_ABI32
   457  
   458  struct user
   459  {
   460 @@ -39,6 +186,24 @@ struct user
   461    unsigned long	magic;			/* identifies a core file */
   462    char		u_comm[32];		/* user command name */
   463  };
   464 +
   465 +#else
   466 +
   467 +struct user {
   468 +  __extension__ unsigned long	regs[EF_SIZE/8+64]; /* integer and fp regs */
   469 +  __extension__ unsigned long	u_tsize;	/* text size (pages) */
   470 +  __extension__ unsigned long	u_dsize;	/* data size (pages) */
   471 +  __extension__ unsigned long	u_ssize;	/* stack size (pages) */
   472 +  __extension__ unsigned long long start_code;	/* text starting address */
   473 +  __extension__ unsigned long long start_data;	/* data starting address */
   474 +  __extension__ unsigned long long start_stack;	/* stack starting address */
   475 +  __extension__ long long	signal;		/* signal causing core dump */
   476 +  __extension__ unsigned long long u_ar0;	/* help gdb find registers */
   477 +  __extension__ unsigned long long magic;	/* identifies a core file */
   478 +  char		u_comm[32];		/* user command name */
   479 +};
   480 +
   481 +#endif
   482  
   483  #define PAGE_SHIFT		12
   484  #define PAGE_SIZE		(1UL << PAGE_SHIFT)
   485 
   486 --=-=-=
   487 
   488 
   489 -- 
   490 Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
   491 Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
   492 CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
   493 Free Software Evangelist                Professional serial bug killer
   494 
   495 --=-=-=--
   496 
   497 And the rediffed hunk:
   498 
   499 --- glibc-2.3.2/sysdeps/unix/sysv/linux/mips/sys/ucontext.h.old	2004-05-30 07:23:32.000000000 -0700
   500 +++ glibc-2.3.2/sysdeps/unix/sysv/linux/mips/sys/ucontext.h	2004-05-30 07:22:56.000000000 -0700
   501 @@ -29,43 +29,72 @@
   502  #include <bits/sigcontext.h>
   503  
   504  
   505 -/* Type for general register.  */
   506 -typedef unsigned long int greg_t;
   507 +/* Type for general register.  Even in o32 we assume 64-bit registers,
   508 +   like the kernel.  */
   509 +__extension__ typedef unsigned long long int greg_t;
   510  
   511  /* Number of general registers.  */
   512 -#define NGREG	37
   513 -#define NFPREG	33
   514 +#define NGREG	32
   515 +#define NFPREG	32
   516  
   517  /* Container for all general registers.  */
   518 -/* gregset_t must be an array.  The below declared array corresponds to:
   519 -typedef struct gregset {
   520 -	greg_t	g_regs[32];
   521 -	greg_t	g_hi;
   522 -	greg_t	g_lo;
   523 -	greg_t	g_pad[3];
   524 -} gregset_t;  */
   525  typedef greg_t gregset_t[NGREG];
   526  
   527  /* Container for all FPU registers.  */
   528  typedef struct fpregset {
   529  	union {
   530 -		double	fp_dregs[32];
   531 +		double	fp_dregs[NFPREG];
   532  		struct {
   533  			float		_fp_fregs;
   534  			unsigned int	_fp_pad;
   535 -		} fp_fregs[32];
   536 +		} fp_fregs[NFPREG];
   537  	} fp_r;
   538 -	unsigned int	fp_csr;
   539 -	unsigned int	fp_pad;
   540  } fpregset_t;
   541  
   542  
   543  /* Context to describe whole processor state.  */
   544 +#if _MIPS_SIM == _MIPS_SIM_ABI32
   545 +/* Earlier versions of glibc for mips had an entirely different
   546 +   definition of mcontext_t, that didn't even resemble the
   547 +   corresponding kernel data structure.  Since all legitimate uses of
   548 +   ucontext_t in glibc mustn't have accessed anything beyond
   549 +   uc_mcontext and, even then, taking a pointer to it, casting it to
   550 +   sigcontext_t, and accessing it as such, which is what it has always
   551 +   been, this can still be rectified.  Fortunately, makecontext,
   552 +   [gs]etcontext et all have never been implemented.  */
   553  typedef struct
   554    {
   555 +    unsigned int regmask;
   556 +    unsigned int status;
   557 +    greg_t pc;
   558      gregset_t gregs;
   559      fpregset_t fpregs;
   560 +    unsigned int fp_owned;
   561 +    unsigned int fpc_csr;
   562 +    unsigned int fpc_eir;
   563 +    unsigned int used_math;
   564 +    unsigned int ssflags;
   565 +    greg_t mdhi;
   566 +    greg_t mdlo;
   567 +    unsigned int cause;
   568 +    unsigned int badvaddr;
   569    } mcontext_t;
   570 +#else
   571 +typedef struct
   572 +  {
   573 +    gregset_t gregs;
   574 +    fpregset_t fpregs;
   575 +    greg_t mdhi;
   576 +    greg_t mdlo;
   577 +    greg_t pc;
   578 +    unsigned int status;
   579 +    unsigned int fpc_csr;
   580 +    unsigned int fpc_eir;
   581 +    unsigned int used_math;
   582 +    unsigned int cause;
   583 +    unsigned int badvaddr;
   584 +  } mcontext_t;
   585 +#endif
   586  
   587  /* Userlevel context.  */
   588  typedef struct ucontext