This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Use x86_64/bits/{sigcontext,siginfo}.h for i386 and x86-64


On Thu, May 31, 2012 at 3:21 PM, Roland McGrath <roland@hack.frob.com> wrote:
> bits/siginfo.h is OK.
>
> For bits/sigcontext.h the linux/ version uses the kernel header while the
> linux/x86_64/ version instead duplicates most of its contents. ?Recent
> kernel headers define some additional structures and macros that something
> might be using, so strictly speaking this regresses the i386 API.
>
> As Joseph pointed out earlier, you should be citing all these differences
> up front rather than us having to look at each file to check for them.
>
> Please examine the x86_64 asm/sigcontext.h for the earliest kernel-headers
> version with which x86_64 glibc is compatible. ?If that version cannot be
> used, then linux/x86_64/bits/sigcontext.h needs to be updated to add all
> the missing bits from today's kernels' arch/x86/include/asm/sigcontext.h
> before we can unify with the i386 version. ?If instead the old x86_64
> kernel header has everything for the i386 case that the same kernel
> version's i386 asm/sigcontext.h has, then we should just drop
> linux/x86_64/bits/sigcontext.h entirely so the linux/ file using the
> kernel header will be used instead.
>

I totally forgot about it.  I have verified that asm/sigcontext.h from
the Linux kernel 3.4 is 100% compatible with i386, x32 and x86-64.
I believe the early kernels are compatible with i386 and x86-64.
OK to install if it passes tests on x32 and x86-64?

Thanks.


-- 
H.J.
---
	* sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h: Removed.

diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h b/sysdeps/unix/sys
v/linux/x86_64/bits/sigcontext.h
deleted file mode 100644
index d9ba716..0000000
--- a/sysdeps/unix/sysv/linux/x86_64/bits/sigcontext.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <http://www.gnu.org/licenses/>.  */
-
-#ifndef _BITS_SIGCONTEXT_H
-#define _BITS_SIGCONTEXT_H  1
-
-#if !defined _SIGNAL_H && !defined _SYS_UCONTEXT_H
-# error "Never use <bits/sigcontext.h> directly; include <signal.h> instead."
-#endif
-
-struct _fpreg
-{
-  unsigned short significand[4];
-  unsigned short exponent;
-};
-
-struct _fpxreg
-{
-  unsigned short significand[4];
-  unsigned short exponent;
-  unsigned short padding[3];
-};
-
-struct _xmmreg
-{
-  __uint32_t	element[4];
-};
-
-
-
-#ifndef __x86_64__
-
-struct _fpstate
-{
-  /* Regular FPU environment.  */
-  __uint32_t	cw;
-  __uint32_t		sw;
-  __uint32_t		tag;
-  __uint32_t		ipoff;
-  __uint32_t		cssel;
-  __uint32_t		dataoff;
-  __uint32_t		datasel;
-  struct _fpreg	_st[8];
-  unsigned short status;
-  unsigned short magic;
-
-  /* FXSR FPU environment.  */
-  __uint32_t		_fxsr_env[6];
-  __uint32_t		mxcsr;
-  __uint32_t		reserved;
-  struct _fpxreg	_fxsr_st[8];
-  struct _xmmreg	_xmm[8];
-  __uint32_t		padding[56];
-};
-
-#ifndef sigcontext_struct
-/* Kernel headers before 2.1.1 define a struct sigcontext_struct, but
-   we need sigcontext.  Some packages have come to rely on
-   sigcontext_struct being defined on 32-bit x86, so define this for
-   their benefit.  */
-# define sigcontext_struct sigcontext
-#endif
-
-struct sigcontext
-{
-  unsigned short gs, __gsh;
-  unsigned short fs, __fsh;
-  unsigned short es, __esh;
-  unsigned short ds, __dsh;
-  unsigned long edi;
-  unsigned long esi;
-  unsigned long ebp;
-  unsigned long esp;
-  unsigned long ebx;
-  unsigned long edx;
-  unsigned long ecx;
-  unsigned long eax;
-  unsigned long trapno;
-  unsigned long err;
-  unsigned long eip;
-  unsigned short cs, __csh;
-  unsigned long eflags;
-  unsigned long esp_at_signal;
-  unsigned short ss, __ssh;
-  struct _fpstate * fpstate;
-  unsigned long oldmask;
-  unsigned long cr2;
-};
-
-#else /* __x86_64__ */
-
-struct _fpstate
-{
-  /* FPU environment matching the 64-bit FXSAVE layout.  */
-  __uint16_t		cwd;
-  __uint16_t		swd;
-  __uint16_t		ftw;
-  __uint16_t		fop;
-  __uint64_t		rip;
-  __uint64_t		rdp;
-  __uint32_t		mxcsr;
-  __uint32_t		mxcr_mask;
-  struct _fpxreg	_st[8];
-  struct _xmmreg	_xmm[16];
-  __uint32_t		padding[24];
-};
-
-struct sigcontext
-{
-  __uint64_t r8;
-  __uint64_t r9;
-  __uint64_t r10;
-  __uint64_t r11;
-  __uint64_t r12;
-  __uint64_t r13;
-  __uint64_t r14;
-  __uint64_t r15;
-  __uint64_t rdi;
-  __uint64_t rsi;
-  __uint64_t rbp;
-  __uint64_t rbx;
-  __uint64_t rdx;
-  __uint64_t rax;
-  __uint64_t rcx;
-  __uint64_t rsp;
-  __uint64_t rip;
-  __uint64_t eflags;
-  unsigned short cs;
-  unsigned short gs;
-  unsigned short fs;
-  unsigned short __pad0;
-  __uint64_t err;
-  __uint64_t trapno;
-  __uint64_t oldmask;
-  __uint64_t cr2;
-  __extension__ union
-    {
-      struct _fpstate * fpstate;
-      __uint64_t __fpstate_word;
-    };
-  __uint64_t __reserved1 [8];
-};
-
-#endif /* __x86_64__ */
-
-#endif /* _BITS_SIGCONTEXT_H */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]