yann@1: Retrieved from yann@1: http://sources.redhat.com/cgi-bin/get-raw-msg?listname=libc-alpha&date=2003-04&msgid=orfzoof4j0.fsf%40free.redhat.lsd.ic.unicamp.br yann@1: paths adjusted, and rediffed against glibc-2.3.2 yann@1: (i.e. to compensate for fact that yann@1: http://sources.redhat.com/ml/glibc-cvs/2003-q1/msg01155.html yann@1: is not present) yann@1: yann@1: Should fix yann@1: yann@1: In file included from ../sysdeps/unix/sysv/linux/mips/sys/procfs.h:29, yann@1: from ../linuxthreads_db/proc_service.h:20, yann@1: from ../linuxthreads_db/thread_dbP.h:7, yann@1: from ../linuxthreads/descr.h:43, yann@1: from ../linuxthreads/internals.h:29, yann@1: from ../linuxthreads/sysdeps/pthread/bits/libc-lock.h:27, yann@1: from ../sysdeps/generic/ldsodefs.h:38, yann@1: from ../sysdeps/unix/sysv/linux/ldsodefs.h:25, yann@1: from ../sysdeps/mips/elf/ldsodefs.h:25, yann@1: from ../sysdeps/unix/sysv/linux/init-first.c:30: yann@1: ../sysdeps/unix/sysv/linux/mips/sys/user.h:26:21: asm/reg.h: No such file or directory yann@1: In file included from ../sysdeps/unix/sysv/linux/mips/sys/procfs.h:29, yann@1: from ../linuxthreads_db/proc_service.h:20, yann@1: from ../linuxthreads_db/thread_dbP.h:7, yann@1: from ../linuxthreads/descr.h:43, yann@1: from ../linuxthreads/internals.h:29, yann@1: from ../linuxthreads/sysdeps/pthread/bits/libc-lock.h:27, yann@1: from ../sysdeps/generic/ldsodefs.h:38, yann@1: from ../sysdeps/unix/sysv/linux/ldsodefs.h:25, yann@1: from ../sysdeps/mips/elf/ldsodefs.h:25, yann@1: from ../sysdeps/unix/sysv/linux/init-first.c:30: yann@1: ../sysdeps/unix/sysv/linux/mips/sys/user.h:30: error: `EF_SIZE' undeclared here (not in a function) yann@1: make[2]: *** [mipsel-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/build-glibc/csu/init-first.o] Error 1 yann@1: make[2]: Leaving directory `mipsel-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/glibc-2.3.2/csu' yann@1: make[1]: *** [csu/subdir_lib] Error 2 yann@1: make[1]: Leaving directory `mipsel-unknown-linux-gnu/gcc-3.4.0-glibc-2.3.2/glibc-2.3.2' yann@1: make: *** [all] Error 2 yann@1: yann@1: 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 yann@1: Return-Path: yann@1: Delivered-To: listarch-libc-alpha at sources dot redhat dot com yann@1: Received: (qmail 2802 invoked by alias); 12 Apr 2003 09:28:56 -0000 yann@1: Mailing-List: contact libc-alpha-help at sources dot redhat dot com; run by ezmlm yann@1: Precedence: bulk yann@1: List-Subscribe: yann@1: List-Archive: yann@1: List-Post: yann@1: List-Help: , yann@1: Sender: libc-alpha-owner at sources dot redhat dot com yann@1: Delivered-To: mailing list libc-alpha at sources dot redhat dot com yann@1: Received: (qmail 2795 invoked from network); 12 Apr 2003 09:28:55 -0000 yann@1: Received: from unknown (HELO lacrosse.corp.redhat.com) (66.187.233.200) yann@1: by sources dot redhat dot com with SMTP; 12 Apr 2003 09:28:55 -0000 yann@1: Received: from free.redhat.lsd.ic.unicamp.br (aoliva.cipe.redhat.com [10.0.1.10]) yann@1: by lacrosse dot corp dot redhat dot com (8 dot 11 dot 6/8 dot 9 dot 3) with ESMTP id h3C9SqV01131 yann@1: for ; Sat, 12 Apr 2003 05:28:52 -0400 yann@1: Received: from free.redhat.lsd.ic.unicamp.br (free.redhat.lsd.ic.unicamp.br [127.0.0.1]) yann@1: 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 yann@1: for ; Sat, 12 Apr 2003 06:28:51 -0300 yann@1: Received: (from aoliva@localhost) yann@1: 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; yann@1: Sat, 12 Apr 2003 06:28:51 -0300 yann@1: To: libc-alpha at sources dot redhat dot com yann@1: Subject: signal-handling tweaks for mips/mips64 yann@1: From: Alexandre Oliva yann@1: Organization: GCC Team, Red Hat yann@1: Date: 12 Apr 2003 06:28:51 -0300 yann@1: Message-ID: yann@1: Lines: 49 yann@1: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 yann@1: MIME-Version: 1.0 yann@1: Content-Type: multipart/mixed; boundary="=-=-=" yann@1: yann@1: --=-=-= yann@1: yann@1: It was reported to me that ucontext is utterly broken, even in o32 yann@1: with a stable 32-bit mips kernel. Indeed, it doesn't match the yann@1: ucontext structure defined by the kernel at all. This means that yann@1: programs taking real-time signals in o32 won't be able to extract yann@1: correct information from the mcontext_t, since the kernel puts data in yann@1: there that's in an entirely different format. yann@1: yann@1: I've looked for any ways in which the current data structures could yann@1: possibly be useful, and didn't find any. gdb and rda thought they yann@1: were using the register arrays, but it turned out they were using the yann@1: arrays in procps instead. makecontext(), [sg]etcontext() et al aren't yann@1: implemented on mips, so any uses thereof will just return ENOSYS, yann@1: without messing with the given data structure. So, I believe it is yann@1: not too late for us to fix it such that it matches the kernel data yann@1: structures. yann@1: yann@1: While at that, I fixed a number of incompatibilities introduced by yann@1: either differences between kernel headers that we used to include, yann@1: whose contents are different depending on whether asm points to yann@1: asm-mips or asm-mips64. yann@1: yann@1: With this patch, after some pending kernel patches are checked in, one yann@1: will be able to obtain the correct information from signal handlers in yann@1: all mips ABIs. With n64, this is already true. With o32, it works yann@1: with the 32-bit mips kernel, but the mips64 kernel needs a patch to yann@1: implement the proper sigcontext ABI. n32 still a patch to be yann@1: developed for it to be possible for ucontext to be POSIX-compliant. yann@1: Currently, the kernel uses the same ucontext for n32 and n64, but this yann@1: doesn't work in n32 because uc_link must be a pointer and stack_t must yann@1: contain a pointer and a size_t, whose sizes differ between n32 and yann@1: n64. I believe Ralf is working on a patch for the kernel to generate yann@1: n32-compliant ucontext when invoking signal handlers in n32 processes. yann@1: The only uncertainty is whether uc_flags will be a 32- or 64-bit value yann@1: in n32; I left it as the latter, just because I already had that in yann@1: place; if it changes, a (simplifying) follow-up patch will be posted. yann@1: However, I wanted to circulate the idea of fixing ucontext_t for o32 yann@1: as soon as possible, so I didn't wait for a decision on the exact n32 yann@1: ABI. yann@1: yann@1: Ok to install? yann@1: yann@1: yann@1: --=-=-= yann@1: Content-Type: text/x-patch yann@1: Content-Disposition: inline; filename=mips-sigstuff.patch yann@1: yann@1: Index: ChangeLog yann@1: from Alexandre Oliva yann@1: yann@1: * sysdeps/unix/sysv/linux/mips/profil-counter: New. yann@1: * sysdeps/unix/sysv/linux/mips/sigcontextinfo.h: Port to n32/n64. yann@1: * sysdeps/unix/sysv/linux/mips/bits/sigcontext.h: New. yann@1: * sysdeps/unix/sysv/linux/mips/sys/ucontext.h: Port to n32/n64. yann@1: (mcontext_t): Make it match the 32-bit mips kernel in o32. yann@1: * sysdeps/unix/sysv/linux/mips/sys/user.h: Bring in constants from yann@1: the mips and mips64 headers. yann@1: (struct user): Port to n32/n64. yann@1: yann@1: Index: sysdeps/unix/sysv/linux/mips/profil-counter.h yann@1: =================================================================== yann@1: RCS file: sysdeps/unix/sysv/linux/mips/profil-counter.h yann@1: diff -N sysdeps/unix/sysv/linux/mips/profil-counter.h yann@1: --- /dev/null 1 Jan 1970 00:00:00 -0000 yann@1: +++ libc/sysdeps/unix/sysv/linux/mips/profil-counter.h 12 Apr 2003 09:13:13 -0000 yann@1: @@ -0,0 +1,2 @@ yann@1: +/* We can use the ix86 version. */ yann@1: +#include yann@1: Index: sysdeps/unix/sysv/linux/mips/sigcontextinfo.h yann@1: =================================================================== yann@1: RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h,v yann@1: retrieving revision 1.6 yann@1: diff -u -p -r1.6 sigcontextinfo.h yann@1: --- libc/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h 6 Jul 2001 04:56:18 -0000 1.6 yann@1: +++ libc/sysdeps/unix/sysv/linux/mips/sigcontextinfo.h 12 Apr 2003 09:13:13 -0000 yann@1: @@ -1,4 +1,4 @@ yann@1: -/* Copyright (C) 2000, 2001 Free Software Foundation, Inc. yann@1: +/* Copyright (C) 2000, 2001, 2003 Free Software Foundation, Inc. yann@1: This file is part of the GNU C Library. yann@1: Contributed by Andreas Jaeger , 2000. yann@1: yann@1: @@ -18,6 +18,8 @@ yann@1: 02111-1307 USA. */ yann@1: yann@1: yann@1: +#if _MIPS_SIM == _MIPS_SIM_ABI32 yann@1: + yann@1: #define SIGCONTEXT unsigned long _code, struct sigcontext * yann@1: #define SIGCONTEXT_EXTRA_ARGS _code, yann@1: #define GET_PC(ctx) ((void *) ctx->sc_pc) yann@1: @@ -25,3 +27,15 @@ yann@1: #define GET_STACK(ctx) ((void *) ctx->sc_regs[29]) yann@1: #define CALL_SIGHANDLER(handler, signo, ctx) \ yann@1: (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) yann@1: + yann@1: +#else yann@1: + yann@1: +#define SIGCONTEXT unsigned long _code, ucontext_t * yann@1: +#define SIGCONTEXT_EXTRA_ARGS _code, yann@1: +#define GET_PC(ctx) ((void *) ctx->uc_mcontext.pc) yann@1: +#define GET_FRAME(ctx) ((void *) ctx->uc_mcontext.gregs[30]) yann@1: +#define GET_STACK(ctx) ((void *) ctx->uc_mcontext.gregs[29]) yann@1: +#define CALL_SIGHANDLER(handler, signo, ctx) \ yann@1: + (handler)((signo), SIGCONTEXT_EXTRA_ARGS (ctx)) yann@1: + yann@1: +#endif yann@1: Index: sysdeps/unix/sysv/linux/mips/bits/sigcontext.h yann@1: =================================================================== yann@1: RCS file: sysdeps/unix/sysv/linux/mips/bits/sigcontext.h yann@1: diff -N sysdeps/unix/sysv/linux/mips/bits/sigcontext.h yann@1: --- /dev/null 1 Jan 1970 00:00:00 -0000 yann@1: +++ libc/sysdeps/unix/sysv/linux/mips/bits/sigcontext.h 12 Apr 2003 09:13:13 -0000 yann@1: @@ -0,0 +1,103 @@ yann@1: +/* Copyright (C) 1996, 1997, 1998, 2003 Free Software Foundation, Inc. yann@1: + This file is part of the GNU C Library. yann@1: + yann@1: + The GNU C Library is free software; you can redistribute it and/or yann@1: + modify it under the terms of the GNU Lesser General Public yann@1: + License as published by the Free Software Foundation; either yann@1: + version 2.1 of the License, or (at your option) any later version. yann@1: + yann@1: + The GNU C Library is distributed in the hope that it will be useful, yann@1: + but WITHOUT ANY WARRANTY; without even the implied warranty of yann@1: + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU yann@1: + Lesser General Public License for more details. yann@1: + yann@1: + You should have received a copy of the GNU Lesser General Public yann@1: + License along with the GNU C Library; if not, write to the Free yann@1: + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA yann@1: + 02111-1307 USA. */ yann@1: + yann@1: +#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H yann@1: +# error "Never use directly; include instead." yann@1: +#endif yann@1: + yann@1: +#ifndef sigcontext_struct yann@1: +/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but yann@1: + we need sigcontext. */ yann@1: +# define sigcontext_struct sigcontext yann@1: + yann@1: +/* # include */ yann@1: +/* Instead of including the kernel header, that will vary depending on yann@1: + whether the 32- or the 64-bit kernel is installed, we paste the yann@1: + contents here. In case you're wondering about the different yann@1: + licenses, the fact that the file is pasted, instead of included, yann@1: + doesn't really make any difference for the program that includes yann@1: + this header. */ yann@1: +#if _MIPS_SIM == _MIPS_SIM_ABI32 yann@1: +/* yann@1: + * This file is subject to the terms and conditions of the GNU General Public yann@1: + * License. See the file "COPYING" in the main directory of this archive yann@1: + * for more details. yann@1: + * yann@1: + * Copyright (C) 1996, 1997, 2000 by Ralf Baechle yann@1: + */ yann@1: +#ifndef _ASM_SIGCONTEXT_H yann@1: +#define _ASM_SIGCONTEXT_H yann@1: + yann@1: +/* yann@1: + * Keep this struct definition in sync with the sigcontext fragment yann@1: + * in arch/mips/tools/offset.c yann@1: + */ yann@1: +struct sigcontext { yann@1: + unsigned int sc_regmask; /* Unused */ yann@1: + unsigned int sc_status; yann@1: + unsigned long long sc_pc; yann@1: + unsigned long long sc_regs[32]; yann@1: + unsigned long long sc_fpregs[32]; yann@1: + unsigned int sc_ownedfp; /* Unused */ yann@1: + unsigned int sc_fpc_csr; yann@1: + unsigned int sc_fpc_eir; /* Unused */ yann@1: + unsigned int sc_used_math; yann@1: + unsigned int sc_ssflags; /* Unused */ yann@1: + unsigned long long sc_mdhi; yann@1: + unsigned long long sc_mdlo; yann@1: + yann@1: + unsigned int sc_cause; /* Unused */ yann@1: + unsigned int sc_badvaddr; /* Unused */ yann@1: + yann@1: + unsigned long sc_sigset[4]; /* kernel's sigset_t */ yann@1: +}; yann@1: + yann@1: +#endif /* _ASM_SIGCONTEXT_H */ yann@1: +#else /* _MIPS_SIM != _MIPS_SIM_ABI32 */ yann@1: +/* yann@1: + * This file is subject to the terms and conditions of the GNU General Public yann@1: + * License. See the file "COPYING" in the main directory of this archive yann@1: + * for more details. yann@1: + * yann@1: + * Copyright (C) 1996, 1997, 1999 by Ralf Baechle yann@1: + * Copyright (C) 1999 Silicon Graphics, Inc. yann@1: + */ yann@1: +#ifndef _ASM_SIGCONTEXT_H yann@1: +#define _ASM_SIGCONTEXT_H yann@1: + yann@1: +/* yann@1: + * Keep this struct definition in sync with the sigcontext fragment yann@1: + * in arch/mips/tools/offset.c yann@1: + */ yann@1: +struct sigcontext { yann@1: + unsigned long long sc_regs[32]; yann@1: + unsigned long long sc_fpregs[32]; yann@1: + unsigned long long sc_mdhi; yann@1: + unsigned long long sc_mdlo; yann@1: + unsigned long long sc_pc; yann@1: + unsigned int sc_status; yann@1: + unsigned int sc_fpc_csr; yann@1: + unsigned int sc_fpc_eir; yann@1: + unsigned int sc_used_math; yann@1: + unsigned int sc_cause; yann@1: + unsigned int sc_badvaddr; yann@1: +}; yann@1: + yann@1: +#endif /* _ASM_SIGCONTEXT_H */ yann@1: +#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */ yann@1: +#endif yann@1: [hunk deleted, see below] yann@1: Index: sysdeps/unix/sysv/linux/mips/sys/user.h yann@1: =================================================================== yann@1: RCS file: /cvs/glibc/libc/sysdeps/unix/sysv/linux/mips/sys/user.h,v yann@1: retrieving revision 1.1 yann@1: diff -u -p -r1.1 user.h yann@1: --- libc/sysdeps/unix/sysv/linux/mips/sys/user.h 8 Feb 2002 16:21:00 -0000 1.1 yann@1: +++ libc/sysdeps/unix/sysv/linux/mips/sys/user.h 12 Apr 2003 09:13:13 -0000 yann@1: @@ -1,4 +1,4 @@ yann@1: -/* Copyright (C) 2002 Free Software Foundation, Inc. yann@1: +/* Copyright (C) 2002, 2003 Free Software Foundation, Inc. yann@1: This file is part of the GNU C Library. yann@1: yann@1: The GNU C Library is free software; you can redistribute it and/or yann@1: @@ -23,7 +23,154 @@ yann@1: too much into it. Don't use it for anything other than GDB unless yann@1: you know what you are doing. */ yann@1: yann@1: -#include yann@1: +/* #include */ yann@1: +/* Instead of including the kernel header, that will vary depending on yann@1: + whether the 32- or the 64-bit kernel is installed, we paste its yann@1: + contents here. Note that the fact that the file is inline here, yann@1: + instead of included separately, doesn't change in any way the yann@1: + licensing status of a program that includes user.h. Since this is yann@1: + for gdb alone, and gdb is GPLed, no surprises here. */ yann@1: +#if _MIPS_SIM == _MIPS_SIM_ABI32 yann@1: +/* yann@1: + * Various register offset definitions for debuggers, core file yann@1: + * examiners and whatnot. yann@1: + * yann@1: + * This file is subject to the terms and conditions of the GNU General Public yann@1: + * License. See the file "COPYING" in the main directory of this archive yann@1: + * for more details. yann@1: + * yann@1: + * Copyright (C) 1995, 1999 by Ralf Baechle yann@1: + */ yann@1: +#ifndef __ASM_MIPS_REG_H yann@1: +#define __ASM_MIPS_REG_H yann@1: + yann@1: +/* yann@1: + * This defines/structures correspond to the register layout on stack - yann@1: + * if the order here is changed, it needs to be updated in yann@1: + * include/asm-mips/stackframe.h yann@1: + */ yann@1: +#define EF_REG0 6 yann@1: +#define EF_REG1 7 yann@1: +#define EF_REG2 8 yann@1: +#define EF_REG3 9 yann@1: +#define EF_REG4 10 yann@1: +#define EF_REG5 11 yann@1: +#define EF_REG6 12 yann@1: +#define EF_REG7 13 yann@1: +#define EF_REG8 14 yann@1: +#define EF_REG9 15 yann@1: +#define EF_REG10 16 yann@1: +#define EF_REG11 17 yann@1: +#define EF_REG12 18 yann@1: +#define EF_REG13 19 yann@1: +#define EF_REG14 20 yann@1: +#define EF_REG15 21 yann@1: +#define EF_REG16 22 yann@1: +#define EF_REG17 23 yann@1: +#define EF_REG18 24 yann@1: +#define EF_REG19 25 yann@1: +#define EF_REG20 26 yann@1: +#define EF_REG21 27 yann@1: +#define EF_REG22 28 yann@1: +#define EF_REG23 29 yann@1: +#define EF_REG24 30 yann@1: +#define EF_REG25 31 yann@1: +/* yann@1: + * k0/k1 unsaved yann@1: + */ yann@1: +#define EF_REG28 34 yann@1: +#define EF_REG29 35 yann@1: +#define EF_REG30 36 yann@1: +#define EF_REG31 37 yann@1: + yann@1: +/* yann@1: + * Saved special registers yann@1: + */ yann@1: +#define EF_LO 38 yann@1: +#define EF_HI 39 yann@1: + yann@1: +#define EF_CP0_EPC 40 yann@1: +#define EF_CP0_BADVADDR 41 yann@1: +#define EF_CP0_STATUS 42 yann@1: +#define EF_CP0_CAUSE 43 yann@1: + yann@1: +#define EF_SIZE 180 /* size in bytes */ yann@1: + yann@1: +#endif /* __ASM_MIPS_REG_H */ yann@1: + yann@1: +#else /* _MIPS_SIM != _MIPS_SIM_ABI32 */ yann@1: + yann@1: +/* yann@1: + * Various register offset definitions for debuggers, core file yann@1: + * examiners and whatnot. yann@1: + * yann@1: + * This file is subject to the terms and conditions of the GNU General Public yann@1: + * License. See the file "COPYING" in the main directory of this archive yann@1: + * for more details. yann@1: + * yann@1: + * Copyright (C) 1995, 1999 Ralf Baechle yann@1: + * Copyright (C) 1995, 1999 Silicon Graphics yann@1: + */ yann@1: +#ifndef _ASM_REG_H yann@1: +#define _ASM_REG_H yann@1: + yann@1: +/* yann@1: + * This defines/structures correspond to the register layout on stack - yann@1: + * if the order here is changed, it needs to be updated in yann@1: + * include/asm-mips/stackframe.h yann@1: + */ yann@1: +#define EF_REG0 0 yann@1: +#define EF_REG1 1 yann@1: +#define EF_REG2 2 yann@1: +#define EF_REG3 3 yann@1: +#define EF_REG4 4 yann@1: +#define EF_REG5 5 yann@1: +#define EF_REG6 6 yann@1: +#define EF_REG7 7 yann@1: +#define EF_REG8 8 yann@1: +#define EF_REG9 9 yann@1: +#define EF_REG10 10 yann@1: +#define EF_REG11 11 yann@1: +#define EF_REG12 12 yann@1: +#define EF_REG13 13 yann@1: +#define EF_REG14 14 yann@1: +#define EF_REG15 15 yann@1: +#define EF_REG16 16 yann@1: +#define EF_REG17 17 yann@1: +#define EF_REG18 18 yann@1: +#define EF_REG19 19 yann@1: +#define EF_REG20 20 yann@1: +#define EF_REG21 21 yann@1: +#define EF_REG22 22 yann@1: +#define EF_REG23 23 yann@1: +#define EF_REG24 24 yann@1: +#define EF_REG25 25 yann@1: +/* yann@1: + * k0/k1 unsaved yann@1: + */ yann@1: +#define EF_REG28 28 yann@1: +#define EF_REG29 29 yann@1: +#define EF_REG30 30 yann@1: +#define EF_REG31 31 yann@1: + yann@1: +/* yann@1: + * Saved special registers yann@1: + */ yann@1: +#define EF_LO 32 yann@1: +#define EF_HI 33 yann@1: + yann@1: +#define EF_CP0_EPC 34 yann@1: +#define EF_CP0_BADVADDR 35 yann@1: +#define EF_CP0_STATUS 36 yann@1: +#define EF_CP0_CAUSE 37 yann@1: + yann@1: +#define EF_SIZE 304 /* size in bytes */ yann@1: + yann@1: +#endif /* _ASM_REG_H */ yann@1: + yann@1: +#endif /* _MIPS_SIM != _MIPS_SIM_ABI32 */ yann@1: + yann@1: +#if _MIPS_SIM == _MIPS_SIM_ABI32 yann@1: yann@1: struct user yann@1: { yann@1: @@ -39,6 +186,24 @@ struct user yann@1: unsigned long magic; /* identifies a core file */ yann@1: char u_comm[32]; /* user command name */ yann@1: }; yann@1: + yann@1: +#else yann@1: + yann@1: +struct user { yann@1: + __extension__ unsigned long regs[EF_SIZE/8+64]; /* integer and fp regs */ yann@1: + __extension__ unsigned long u_tsize; /* text size (pages) */ yann@1: + __extension__ unsigned long u_dsize; /* data size (pages) */ yann@1: + __extension__ unsigned long u_ssize; /* stack size (pages) */ yann@1: + __extension__ unsigned long long start_code; /* text starting address */ yann@1: + __extension__ unsigned long long start_data; /* data starting address */ yann@1: + __extension__ unsigned long long start_stack; /* stack starting address */ yann@1: + __extension__ long long signal; /* signal causing core dump */ yann@1: + __extension__ unsigned long long u_ar0; /* help gdb find registers */ yann@1: + __extension__ unsigned long long magic; /* identifies a core file */ yann@1: + char u_comm[32]; /* user command name */ yann@1: +}; yann@1: + yann@1: +#endif yann@1: yann@1: #define PAGE_SHIFT 12 yann@1: #define PAGE_SIZE (1UL << PAGE_SHIFT) yann@1: yann@1: --=-=-= yann@1: yann@1: yann@1: -- yann@1: Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/ yann@1: Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org} yann@1: CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org} yann@1: Free Software Evangelist Professional serial bug killer yann@1: yann@1: --=-=-=-- yann@1: yann@1: And the rediffed hunk: yann@1: yann@1: --- glibc-2.3.2/sysdeps/unix/sysv/linux/mips/sys/ucontext.h.old 2004-05-30 07:23:32.000000000 -0700 yann@1: +++ glibc-2.3.2/sysdeps/unix/sysv/linux/mips/sys/ucontext.h 2004-05-30 07:22:56.000000000 -0700 yann@1: @@ -29,43 +29,72 @@ yann@1: #include yann@1: yann@1: yann@1: -/* Type for general register. */ yann@1: -typedef unsigned long int greg_t; yann@1: +/* Type for general register. Even in o32 we assume 64-bit registers, yann@1: + like the kernel. */ yann@1: +__extension__ typedef unsigned long long int greg_t; yann@1: yann@1: /* Number of general registers. */ yann@1: -#define NGREG 37 yann@1: -#define NFPREG 33 yann@1: +#define NGREG 32 yann@1: +#define NFPREG 32 yann@1: yann@1: /* Container for all general registers. */ yann@1: -/* gregset_t must be an array. The below declared array corresponds to: yann@1: -typedef struct gregset { yann@1: - greg_t g_regs[32]; yann@1: - greg_t g_hi; yann@1: - greg_t g_lo; yann@1: - greg_t g_pad[3]; yann@1: -} gregset_t; */ yann@1: typedef greg_t gregset_t[NGREG]; yann@1: yann@1: /* Container for all FPU registers. */ yann@1: typedef struct fpregset { yann@1: union { yann@1: - double fp_dregs[32]; yann@1: + double fp_dregs[NFPREG]; yann@1: struct { yann@1: float _fp_fregs; yann@1: unsigned int _fp_pad; yann@1: - } fp_fregs[32]; yann@1: + } fp_fregs[NFPREG]; yann@1: } fp_r; yann@1: - unsigned int fp_csr; yann@1: - unsigned int fp_pad; yann@1: } fpregset_t; yann@1: yann@1: yann@1: /* Context to describe whole processor state. */ yann@1: +#if _MIPS_SIM == _MIPS_SIM_ABI32 yann@1: +/* Earlier versions of glibc for mips had an entirely different yann@1: + definition of mcontext_t, that didn't even resemble the yann@1: + corresponding kernel data structure. Since all legitimate uses of yann@1: + ucontext_t in glibc mustn't have accessed anything beyond yann@1: + uc_mcontext and, even then, taking a pointer to it, casting it to yann@1: + sigcontext_t, and accessing it as such, which is what it has always yann@1: + been, this can still be rectified. Fortunately, makecontext, yann@1: + [gs]etcontext et all have never been implemented. */ yann@1: typedef struct yann@1: { yann@1: + unsigned int regmask; yann@1: + unsigned int status; yann@1: + greg_t pc; yann@1: gregset_t gregs; yann@1: fpregset_t fpregs; yann@1: + unsigned int fp_owned; yann@1: + unsigned int fpc_csr; yann@1: + unsigned int fpc_eir; yann@1: + unsigned int used_math; yann@1: + unsigned int ssflags; yann@1: + greg_t mdhi; yann@1: + greg_t mdlo; yann@1: + unsigned int cause; yann@1: + unsigned int badvaddr; yann@1: } mcontext_t; yann@1: +#else yann@1: +typedef struct yann@1: + { yann@1: + gregset_t gregs; yann@1: + fpregset_t fpregs; yann@1: + greg_t mdhi; yann@1: + greg_t mdlo; yann@1: + greg_t pc; yann@1: + unsigned int status; yann@1: + unsigned int fpc_csr; yann@1: + unsigned int fpc_eir; yann@1: + unsigned int used_math; yann@1: + unsigned int cause; yann@1: + unsigned int badvaddr; yann@1: + } mcontext_t; yann@1: +#endif yann@1: yann@1: /* Userlevel context. */ yann@1: typedef struct ucontext