Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [patch] userspace mcontext_t doesn't match what kernel returns
@ 2002-09-11  3:28 Ryan Murray
  2002-09-15 19:06 ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Ryan Murray @ 2002-09-11  3:28 UTC (permalink / raw)
  To: linux-mips; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 863 bytes --]

Hi,

The definition of mcontext_t in sysdeps/unix/sysv/linux/mips/sys/ucontext.h
does not match what the kernel copies to userspace (struct sigcontext).
alpha, ia64, and hppa have fixed this by typedefing one to the other in
sys/ucontext.h  The following patch accomplishes the same thing for mips.

-- 
Ryan Murray, Debian Developer (rmurray@cyberhqz.com, rmurray@debian.org)
The opinions expressed here are my own.

--- sysdeps/unix/sysv/linux/mips/sys/ucontext.h	2002-09-10 20:16:52.000000000 -0700
+++ sysdeps/unix/sysv/linux/mips/sys/ucontext.h	2002-09-10 20:17:24.000000000 -0700
@@ -61,11 +61,7 @@
 
 
 /* Context to describe whole processor state.  */
-typedef struct
-  {
-    gregset_t gregs;
-    fpregset_t fpregs;
-  } mcontext_t;
+typedef struct sigcontext mcontext_t;
 
 /* Userlevel context.  */
 typedef struct ucontext

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] userspace mcontext_t doesn't match what kernel returns
  2002-09-11  3:28 [patch] userspace mcontext_t doesn't match what kernel returns Ryan Murray
@ 2002-09-15 19:06 ` Ralf Baechle
  2002-09-15 19:16   ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Ralf Baechle @ 2002-09-15 19:06 UTC (permalink / raw)
  To: Ryan Murray; +Cc: linux-mips, libc-alpha

On Tue, Sep 10, 2002 at 08:28:32PM -0700, Ryan Murray wrote:

> The definition of mcontext_t in sysdeps/unix/sysv/linux/mips/sys/ucontext.h
> does not match what the kernel copies to userspace (struct sigcontext).
> alpha, ia64, and hppa have fixed this by typedefing one to the other in
> sys/ucontext.h  The following patch accomplishes the same thing for mips.

I choose to fix the kernel instead which will keep as closer to the MIPS
ABI and also prevent having to recompile zillions of user apps.  Below my
working version of <asm/ucontext.h>.

  Ralf

/*
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Low level exception handling
 *
 * Copyright (C) 1998, 1999 by Ralf Baechle
 */
#ifndef _ASM_UCONTEXT_H
#define _ASM_UCONTEXT_H

typedef struct {
	gregset_t gregs;
	fpregset_t fpregs;
} mcontext_t;

struct ucontext {
	unsigned long	uc_flags;
	struct ucontext	*uc_link;
	stack_t		uc_stack;
	mcontext_t	uc_mcontext;
	sigset_t	uc_sigmask;	/* mask last for extensibility */
};

#endif /* _ASM_UCONTEXT_H */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] userspace mcontext_t doesn't match what kernel returns
  2002-09-15 19:06 ` Ralf Baechle
@ 2002-09-15 19:16   ` Daniel Jacobowitz
  2002-09-15 23:08     ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-09-15 19:16 UTC (permalink / raw)
  To: Ralf Baechle; +Cc: Ryan Murray, linux-mips, libc-alpha

On Sun, Sep 15, 2002 at 09:06:01PM +0200, Ralf Baechle wrote:
> On Tue, Sep 10, 2002 at 08:28:32PM -0700, Ryan Murray wrote:
> 
> > The definition of mcontext_t in sysdeps/unix/sysv/linux/mips/sys/ucontext.h
> > does not match what the kernel copies to userspace (struct sigcontext).
> > alpha, ia64, and hppa have fixed this by typedefing one to the other in
> > sys/ucontext.h  The following patch accomplishes the same thing for mips.
> 
> I choose to fix the kernel instead which will keep as closer to the MIPS
> ABI and also prevent having to recompile zillions of user apps.  Below my
> working version of <asm/ucontext.h>.

What are the gregset_t/fpregset_t types in your working tree?  There
aren't any definitions of them in the only copy of the MIPS code that I
have here, and they've had various bad definitions in glibc until
recently.  They also recently changed...

[Although I think your kernel change is the right way to go, here. 
Just being cautious.]

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch] userspace mcontext_t doesn't match what kernel returns
  2002-09-15 19:16   ` Daniel Jacobowitz
@ 2002-09-15 23:08     ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2002-09-15 23:08 UTC (permalink / raw)
  To: Ryan Murray, linux-mips, libc-alpha

On Sun, Sep 15, 2002 at 03:16:13PM -0400, Daniel Jacobowitz wrote:

> > I choose to fix the kernel instead which will keep as closer to the MIPS
> > ABI and also prevent having to recompile zillions of user apps.  Below my
> > working version of <asm/ucontext.h>.
> 
> What are the gregset_t/fpregset_t types in your working tree?  There
> aren't any definitions of them in the only copy of the MIPS code that I
> have here, and they've had various bad definitions in glibc until
> recently.  They also recently changed...

By the time I sent my previous mail I didn't yet have any.  Below the
changes I've made to libc but the kernel changes are identical.

> [Although I think your kernel change is the right way to go, here. 
> Just being cautious.]

I'm not yet finished.  The libc definitions for gregset_t and fpregset_t
are not what they're expected to be (coincidentally I got a related bug
report just a few days ago, so that issue is also itching a bit ...) and
I'd like to change them to as below.

This is a binary incompatible change but since so far just one person has
complained about the non-matching definitions of struct ucontext, it seems
there are very few users of the affected data type?

/* Type for general register.  */
typedef unsigned long int greg_t;

/* Number of general registers.  */
#define NGREG	36

typedef greg_t gregset_t[NGREG];

/* Container for all FPU registers.  */
typedef struct fpregset {
	union {
		double		fp_dregs[16];
		float		fp_fregs[32];
		unsigned int	fp_regs[32];
	} fp_r;
	unsigned int	fp_csr;
	unsigned int	fp_pad;
} fpregset_t;

/* Context to describe whole processor state.  */
typedef struct
  {
    gregset_t gregs;
    fpregset_t fpregs;
  } mcontext_t;

/* Userlevel context.  */
typedef struct ucontext
  {
    unsigned long int uc_flags;
    struct ucontext *uc_link;
    stack_t uc_stack;
    mcontext_t uc_mcontext;
    __sigset_t uc_sigmask;
  } ucontext_t;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-09-15 23:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-11  3:28 [patch] userspace mcontext_t doesn't match what kernel returns Ryan Murray
2002-09-15 19:06 ` Ralf Baechle
2002-09-15 19:16   ` Daniel Jacobowitz
2002-09-15 23:08     ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox