This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [SH][PATCH] SH Kernel compatibility
- From: Andrew Stubbs <ams at codesourcery dot com>
- To: Mike Frysinger <vapier at gentoo dot org>, libc-alpha at sourceware dot org
- Date: Tue, 03 Feb 2009 15:00:48 +0000
- Subject: Re: [SH][PATCH] SH Kernel compatibility
- References: <4981BFE7.5080000@codesourcery.com> <200901301700.23908.vapier@gentoo.org> <4986C526.5090909@codesourcery.com> <20090202172758.GA21539@caradoc.them.org>
Daniel Jacobowitz wrote:
On Mon, Feb 02, 2009 at 10:04:22AM +0000, Andrew Stubbs wrote:
I think the problem is that I have added an include of asm/ptrace.h in
sys/procfs.h (to get struct pt_regs).
Is the size of the struct all you need asm/ptrace.h for? Some other
targets just "#define ELF_NGREG 33", which avoids any namespace
pollution issues.
OK, how about this one? The code only need the pt_regs for the size, as
you say. However, it does use REG_GBR, and possibly others. I've
included the full set of register defines, just in case.
Andrew
2009-02-03 Andrew Stubbs <ams@codesourcery.com>
glibc/
* sysdeps/unix/sysv/linux/sh/sys/procfs.h: Don't include asm/elf.h.
(REG_REG0, REG_REG15, REG_PC, REG_PR, REG_SR, REG_GBR, REG_MACH,
REG_MACL, REG_MACL): Define.
(elf_greg_t, ELF_NGREG, elf_gregset_t, user_fpu_struct,
elf_fpregset_t): Copy from linux asm-sh/elf.h.
* sysdeps/unix/sysv/linux/sh/sys/user.h: Don't include asm/user.h.
---
src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/procfs.h | 24 ++++++++++++-
src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/user.h | 2 -
2 files changed, 23 insertions(+), 3 deletions(-)
Index: src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/procfs.h
===================================================================
--- src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/procfs.h.orig
+++ src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/procfs.h
@@ -29,10 +29,32 @@
#include <sys/types.h>
#include <sys/ucontext.h>
#include <sys/user.h>
-#include <asm/elf.h>
__BEGIN_DECLS
+typedef unsigned long elf_greg_t;
+
+#define ELF_NGREG 23
+typedef elf_greg_t elf_gregset_t[ELF_NGREG];
+
+#define REG_REG0 0
+#define REG_REG15 15
+#define REG_PC 16
+#define REG_PR 17
+#define REG_SR 18
+#define REG_GBR 19
+#define REG_MACH 20
+#define REG_MACL 21
+#define REG_SYSCALL 22
+
+struct user_fpu_struct {
+ unsigned long fp_regs[16];
+ unsigned long xfp_regs[16];
+ unsigned long fpscr;
+ unsigned long fpul;
+};
+typedef struct user_fpu_struct elf_fpregset_t;
+
struct elf_siginfo
{
int si_signo; /* Signal number. */
Index: src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/user.h
===================================================================
--- src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/user.h.orig
+++ src/glibc-mainline/sysdeps/unix/sysv/linux/sh/sys/user.h
@@ -21,8 +21,6 @@
#include <features.h>
-#include <asm/user.h>
-
#undef start_thread
#endif /* sys/user.h */