aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-02-07 20:46:14 +0000
committerUlrich Drepper <drepper@redhat.com>1999-02-07 20:46:14 +0000
commite1f601e87837e586eb6acc1de087aedbc85ea7d4 (patch)
treeb5317db0462a5ec6486e726871281c41ecf9bed0 /sysdeps/unix/sysv/linux
parente518937a3a87560561f4988dc69094324e17e723 (diff)
downloadglibc-e1f601e87837e586eb6acc1de087aedbc85ea7d4.tar
glibc-e1f601e87837e586eb6acc1de087aedbc85ea7d4.tar.gz
glibc-e1f601e87837e586eb6acc1de087aedbc85ea7d4.tar.bz2
glibc-e1f601e87837e586eb6acc1de087aedbc85ea7d4.zip
Update.
1999-02-03 Jakub Jelinek <jj@ultra.linux.cz> * sysdeps/generic/segfault.c: Add ADVANCE_STACK_FRAME macro, so that architectures which need to add some special offset to stack pointer can share this file. * sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h: New file. * sysdeps/unix/sysv/linux/sparc/sparc64/sigcontextinfo.h: New file. * sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h: New file. * sysdeps/unix/sysv/linux/sparc/sparc32/bits/mman.h: Remove. * sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h: Remove. * sysdeps/unix/sysv/linux/sparc/bits/mman.h: New file - common between sparc32 and sparc64. * sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S: Remove. * sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S: Remove. * sysdeps/unix/sysv/linux/sparc/vfork.S: New file - common between sparc32 and sparc64. * sysdeps/unix/sysv/linux/sparc/sparc32/fork.S: Remove. * sysdeps/unix/sysv/linux/sparc/sparc64/fork.S: Remove. * sysdeps/unix/sysv/linux/sparc/fork.S: New file - common between sparc32 and sparc64. * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.S: Remove. * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.S: Remove. * sysdeps/unix/sysv/linux/sparc/sysdep.S: New file - common between sparc32 and sparc64.
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/sparc/bits/mman.h (renamed from sysdeps/unix/sysv/linux/sparc/sparc32/bits/mman.h)2
-rw-r--r--sysdeps/unix/sysv/linux/sparc/fork.S (renamed from sysdeps/unix/sysv/linux/sparc/sparc64/fork.S)0
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h337
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h (renamed from sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S)21
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.S10
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h77
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h266
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/sigcontextinfo.h (renamed from sysdeps/unix/sysv/linux/sparc/sparc32/fork.S)24
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sysdep.S (renamed from sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.S)7
-rw-r--r--sysdeps/unix/sysv/linux/sparc/vfork.S (renamed from sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S)6
10 files changed, 626 insertions, 124 deletions
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/bits/mman.h b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
index bc70a58e24..8114244053 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/bits/mman.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/mman.h
@@ -1,5 +1,5 @@
/* Definitions for POSIX memory map interface. Linux/SPARC version.
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1999 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
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/fork.S b/sysdeps/unix/sysv/linux/sparc/fork.S
index 3e78a0b0d4..3e78a0b0d4 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/fork.S
+++ b/sysdeps/unix/sysv/linux/sparc/fork.S
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h b/sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h
new file mode 100644
index 0000000000..198f5cfc74
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h
@@ -0,0 +1,337 @@
+/* Dump registers.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sys/uio.h>
+#include <stdio-common/_itoa.h>
+#include <bits/sigcontext.h>
+
+/* We will print the register dump in this format:
+
+ PSR: XXXXXXXX PC: XXXXXXXX NPC: XXXXXXXX Y: XXXXXXXX
+ g0: 00000000 g1: XXXXXXXX g2: XXXXXXXX g3: XXXXXXXX
+ g4: XXXXXXXX g5: XXXXXXXX g6: XXXXXXXX g7: XXXXXXXX
+ o0: XXXXXXXX o1: XXXXXXXX o2: XXXXXXXX o3: XXXXXXXX
+ o4: XXXXXXXX o5: XXXXXXXX sp: XXXXXXXX o7: XXXXXXXX
+ l0: XXXXXXXX l1: XXXXXXXX l2: XXXXXXXX l3: XXXXXXXX
+ l4: XXXXXXXX l5: XXXXXXXX l6: XXXXXXXX l7: XXXXXXXX
+ i0: XXXXXXXX i1: XXXXXXXX i2: XXXXXXXX i3: XXXXXXXX
+ i4: XXXXXXXX i5: XXXXXXXX fp: XXXXXXXX i7: XXXXXXXX
+
+ followed on sun4, sun4c, sun4d, sun4m by:
+
+ Old mask: XXXXXXXX FSR: XXXXXXXX FPQ: XXXXXXXX
+ f0: XXXXXXXXXXXXXXXX f2: XXXXXXXXXXXXXXXX f4: XXXXXXXXXXXXXXXX
+ f6: XXXXXXXXXXXXXXXX f8: XXXXXXXXXXXXXXXX f10: XXXXXXXXXXXXXXXX
+ f12: XXXXXXXXXXXXXXXX f14: XXXXXXXXXXXXXXXX f16: XXXXXXXXXXXXXXXX
+ f18: XXXXXXXXXXXXXXXX f20: XXXXXXXXXXXXXXXX f22: XXXXXXXXXXXXXXXX
+ f24: XXXXXXXXXXXXXXXX f26: XXXXXXXXXXXXXXXX f28: XXXXXXXXXXXXXXXX
+ f30: XXXXXXXXXXXXXXXX
+
+ and on sun4u by:
+
+ Old mask: XXXXXXXX XFSR: XXXXXXXXXXXXXXXX GSR: XX FPRS: X
+ f0: XXXXXXXXXXXXXXXX f2: XXXXXXXXXXXXXXXX f4: XXXXXXXXXXXXXXXX
+ f6: XXXXXXXXXXXXXXXX f8: XXXXXXXXXXXXXXXX f10: XXXXXXXXXXXXXXXX
+ f12: XXXXXXXXXXXXXXXX f14: XXXXXXXXXXXXXXXX f16: XXXXXXXXXXXXXXXX
+ f18: XXXXXXXXXXXXXXXX f20: XXXXXXXXXXXXXXXX f22: XXXXXXXXXXXXXXXX
+ f24: XXXXXXXXXXXXXXXX f26: XXXXXXXXXXXXXXXX f28: XXXXXXXXXXXXXXXX
+ f30: XXXXXXXXXXXXXXXX f32: XXXXXXXXXXXXXXXX f34: XXXXXXXXXXXXXXXX
+ f36: XXXXXXXXXXXXXXXX f38: XXXXXXXXXXXXXXXX f40: XXXXXXXXXXXXXXXX
+ f42: XXXXXXXXXXXXXXXX f44: XXXXXXXXXXXXXXXX f46: XXXXXXXXXXXXXXXX
+ f48: XXXXXXXXXXXXXXXX f50: XXXXXXXXXXXXXXXX f52: XXXXXXXXXXXXXXXX
+ f54: XXXXXXXXXXXXXXXX f56: XXXXXXXXXXXXXXXX f58: XXXXXXXXXXXXXXXX
+ f60: XXXXXXXXXXXXXXXX f62: XXXXXXXXXXXXXXXX
+
+ */
+
+static void
+hexvalue (unsigned long int value, char *buf, size_t len)
+{
+ char *cp = _itoa_word (value, buf + len, 16, 0);
+ while (cp > buf)
+ *--cp = '0';
+}
+
+struct __siginfo_sparc32_fpu
+{
+ unsigned int si_float_regs[32];
+ unsigned int si_fsr;
+ unsigned int si_fpq;
+};
+struct __siginfo_sparc64_fpu
+{
+ unsigned int si_float_regs[64];
+ unsigned int si_xfsr;
+ unsigned int si_fsr;
+ unsigned int _pad1;
+ unsigned int si_gsr;
+ unsigned int _pad2;
+ unsigned int si_fprs;
+};
+
+static void
+register_dump (int fd, SIGCONTEXT ctx)
+{
+ char regs[36][8];
+ char fregs[68][8];
+ struct iovec iov[150];
+ size_t nr = 0;
+ int i;
+ struct reg_window *r = (struct reg_window *)
+ ctx->si_regs.u_regs[14];
+
+#define ADD_STRING(str) \
+ iov[nr].iov_base = (char *) str; \
+ iov[nr].iov_len = strlen (str); \
+ ++nr
+#define ADD_MEM(str, len) \
+ iov[nr].iov_base = str; \
+ iov[nr].iov_len = len; \
+ ++nr
+
+ /* Generate strings of register contents. */
+ hexvalue (ctx->si_regs.psr, regs[0], 8);
+ hexvalue (ctx->si_regs.pc, regs[1], 8);
+ hexvalue (ctx->si_regs.npc, regs[2], 8);
+ hexvalue (ctx->si_regs.y, regs[3], 8);
+ for (i = 1; i <= 15; i++)
+ hexvalue (ctx->si_regs.u_regs[i], regs[3+i], 8);
+ for (i = 0; i <= 15; i++)
+ hexvalue (r->locals[i], regs[19+i], 8);
+ hexvalue (ctx->si_mask, regs[35], 8);
+
+ /* Generate the output. */
+ ADD_STRING ("Register dump:\n\n PSR: ");
+ ADD_MEM (regs[0], 8);
+ ADD_STRING (" PC: ");
+ ADD_MEM (regs[1], 8);
+ ADD_STRING (" NPC: ");
+ ADD_MEM (regs[2], 8);
+ ADD_STRING (" Y: ");
+ ADD_MEM (regs[3], 8);
+ ADD_STRING ("\n g0: 00000000 g1: ");
+ ADD_MEM (regs[4], 8);
+ ADD_STRING (" g2: ");
+ ADD_MEM (regs[5], 8);
+ ADD_STRING (" g3: ");
+ ADD_MEM (regs[6], 8);
+ ADD_STRING ("\n g4: ");
+ ADD_MEM (regs[7], 8);
+ ADD_STRING (" g5: ");
+ ADD_MEM (regs[8], 8);
+ ADD_STRING (" g6: ");
+ ADD_MEM (regs[9], 8);
+ ADD_STRING (" g7: ");
+ ADD_MEM (regs[10], 8);
+ ADD_STRING ("\n o0: ");
+ ADD_MEM (regs[11], 8);
+ ADD_STRING (" o1: ");
+ ADD_MEM (regs[12], 8);
+ ADD_STRING (" o2: ");
+ ADD_MEM (regs[13], 8);
+ ADD_STRING (" o3: ");
+ ADD_MEM (regs[14], 8);
+ ADD_STRING ("\n o4: ");
+ ADD_MEM (regs[15], 8);
+ ADD_STRING (" o5: ");
+ ADD_MEM (regs[16], 8);
+ ADD_STRING (" sp: ");
+ ADD_MEM (regs[17], 8);
+ ADD_STRING (" o7: ");
+ ADD_MEM (regs[18], 8);
+ ADD_STRING ("\n l0: ");
+ ADD_MEM (regs[19], 8);
+ ADD_STRING (" l1: ");
+ ADD_MEM (regs[20], 8);
+ ADD_STRING (" l2: ");
+ ADD_MEM (regs[21], 8);
+ ADD_STRING (" l3: ");
+ ADD_MEM (regs[22], 8);
+ ADD_STRING ("\n l4: ");
+ ADD_MEM (regs[23], 8);
+ ADD_STRING (" l5: ");
+ ADD_MEM (regs[24], 8);
+ ADD_STRING (" l6: ");
+ ADD_MEM (regs[25], 8);
+ ADD_STRING (" l7: ");
+ ADD_MEM (regs[26], 8);
+ ADD_STRING ("\n i0: ");
+ ADD_MEM (regs[27], 8);
+ ADD_STRING (" i1: ");
+ ADD_MEM (regs[28], 8);
+ ADD_STRING (" i2: ");
+ ADD_MEM (regs[29], 8);
+ ADD_STRING (" i3: ");
+ ADD_MEM (regs[30], 8);
+ ADD_STRING ("\n i4: ");
+ ADD_MEM (regs[31], 8);
+ ADD_STRING (" i5: ");
+ ADD_MEM (regs[32], 8);
+ ADD_STRING (" fp: ");
+ ADD_MEM (regs[33], 8);
+ ADD_STRING (" i7: ");
+ ADD_MEM (regs[34], 8);
+ ADD_STRING ("\n\n Old mask: ");
+ ADD_MEM (regs[35], 8);
+
+ if ((ctx->si_regs.psr & 0xff000000) == 0xff000000)
+ {
+ struct __siginfo_sparc64_fpu *f;
+
+ f = *(struct __siginfo_sparc64_fpu **) (ctx + 1);
+ if (f != NULL)
+ {
+ for (i = 0; i < 64; i++)
+ hexvalue (f->si_float_regs[i], fregs[i], 8);
+ hexvalue (f->si_xfsr, fregs[64], 8);
+ hexvalue (f->si_fsr, fregs[65], 8);
+ hexvalue (f->si_gsr, fregs[66], 2);
+ hexvalue (f->si_fprs, fregs[67], 1);
+ ADD_STRING (" XFSR: ");
+ ADD_MEM (fregs[64], 8);
+ ADD_MEM (fregs[65], 8);
+ ADD_STRING (" GSR: ");
+ ADD_MEM (fregs[66], 2);
+ ADD_STRING (" FPRS: ");
+ ADD_MEM (fregs[67], 1);
+ ADD_STRING ("\n f0: ");
+ ADD_MEM (fregs[0], 16);
+ ADD_STRING (" f2: ");
+ ADD_MEM (fregs[2], 16);
+ ADD_STRING (" f4: ");
+ ADD_MEM (fregs[4], 16);
+ ADD_STRING ("\n f6: ");
+ ADD_MEM (fregs[6], 16);
+ ADD_STRING (" f8: ");
+ ADD_MEM (fregs[8], 16);
+ ADD_STRING (" f10: ");
+ ADD_MEM (fregs[10], 16);
+ ADD_STRING ("\n f12: ");
+ ADD_MEM (fregs[12], 16);
+ ADD_STRING (" f14: ");
+ ADD_MEM (fregs[14], 16);
+ ADD_STRING (" f16: ");
+ ADD_MEM (fregs[16], 16);
+ ADD_STRING ("\n f18: ");
+ ADD_MEM (fregs[18], 16);
+ ADD_STRING (" f20: ");
+ ADD_MEM (fregs[20], 16);
+ ADD_STRING (" f22: ");
+ ADD_MEM (fregs[22], 16);
+ ADD_STRING ("\n f24: ");
+ ADD_MEM (fregs[24], 16);
+ ADD_STRING (" f26: ");
+ ADD_MEM (fregs[26], 16);
+ ADD_STRING (" f28: ");
+ ADD_MEM (fregs[28], 16);
+ ADD_STRING ("\n f30: ");
+ ADD_MEM (fregs[30], 16);
+ ADD_STRING (" f32: ");
+ ADD_MEM (fregs[32], 16);
+ ADD_STRING (" f34: ");
+ ADD_MEM (fregs[34], 16);
+ ADD_STRING ("\n f36: ");
+ ADD_MEM (fregs[36], 16);
+ ADD_STRING (" f38: ");
+ ADD_MEM (fregs[38], 16);
+ ADD_STRING (" f40: ");
+ ADD_MEM (fregs[40], 16);
+ ADD_STRING ("\n f42: ");
+ ADD_MEM (fregs[42], 16);
+ ADD_STRING (" f44: ");
+ ADD_MEM (fregs[44], 16);
+ ADD_STRING (" f46: ");
+ ADD_MEM (fregs[46], 16);
+ ADD_STRING ("\n f48: ");
+ ADD_MEM (fregs[48], 16);
+ ADD_STRING (" f50: ");
+ ADD_MEM (fregs[50], 16);
+ ADD_STRING (" f52: ");
+ ADD_MEM (fregs[52], 16);
+ ADD_STRING ("\n f54: ");
+ ADD_MEM (fregs[54], 16);
+ ADD_STRING (" f56: ");
+ ADD_MEM (fregs[56], 16);
+ ADD_STRING (" f58: ");
+ ADD_MEM (fregs[58], 16);
+ ADD_STRING ("\n f60: ");
+ ADD_MEM (fregs[60], 16);
+ ADD_STRING (" f62: ");
+ ADD_MEM (fregs[62], 16);
+ }
+ }
+ else
+ {
+ struct __siginfo_sparc32_fpu *f;
+
+ f = *(struct __siginfo_sparc32_fpu **) (ctx + 1);
+ if (f != NULL)
+ {
+ for (i = 0; i < 32; i++)
+ hexvalue (f->si_float_regs[i], fregs[i], 8);
+ hexvalue (f->si_fsr, fregs[64], 8);
+ hexvalue (f->si_fpq, fregs[65], 8);
+ ADD_STRING (" FSR: ");
+ ADD_MEM (fregs[64], 8);
+ ADD_STRING (" FPQ: ");
+ ADD_MEM (fregs[65], 8);
+ ADD_STRING ("\n f0: ");
+ ADD_MEM (fregs[0], 16);
+ ADD_STRING (" f2: ");
+ ADD_MEM (fregs[2], 16);
+ ADD_STRING (" f4: ");
+ ADD_MEM (fregs[4], 16);
+ ADD_STRING ("\n f6: ");
+ ADD_MEM (fregs[6], 16);
+ ADD_STRING (" f8: ");
+ ADD_MEM (fregs[8], 16);
+ ADD_STRING (" f10: ");
+ ADD_MEM (fregs[10], 16);
+ ADD_STRING ("\n f12: ");
+ ADD_MEM (fregs[12], 16);
+ ADD_STRING (" f14: ");
+ ADD_MEM (fregs[14], 16);
+ ADD_STRING (" f16: ");
+ ADD_MEM (fregs[16], 16);
+ ADD_STRING ("\n f18: ");
+ ADD_MEM (fregs[18], 16);
+ ADD_STRING (" f20: ");
+ ADD_MEM (fregs[20], 16);
+ ADD_STRING (" f22: ");
+ ADD_MEM (fregs[22], 16);
+ ADD_STRING ("\n f24: ");
+ ADD_MEM (fregs[24], 16);
+ ADD_STRING (" f26: ");
+ ADD_MEM (fregs[26], 16);
+ ADD_STRING (" f28: ");
+ ADD_MEM (fregs[28], 16);
+ ADD_STRING ("\n f30: ");
+ ADD_MEM (fregs[30], 16);
+ }
+ }
+
+ ADD_STRING ("\n");
+
+ /* Write the stuff out. */
+ writev (fd, iov, nr);
+}
+
+
+#define REGISTER_DUMP register_dump (fd, ctx)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S b/sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h
index feed06f225..a5a74289a7 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/vfork.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
@@ -17,16 +17,9 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <sysdep.h>
-
-#ifdef __NR_vfork
-PSEUDO (__vfork, vfork, 0)
-#else
-PSEUDO (__vfork, fork, 0)
-#endif
- sub %o1, 1, %o1
- retl
- and %o0, %o1, %o0
-
-PSEUDO_END (__vfork)
-weak_alias (__vfork, vfork)
+#define SIGCONTEXT __siginfo_t *
+#define GET_PC(ctx) ((void *) ctx->si_regs.pc)
+#define ADVANCE_STACK_FRAME(next) \
+ ((void *)&((struct reg_window *) (next)->ins[6]))
+#define GET_STACK(ctx) ((void *) ctx->si_regs.u_regs[14])
+#define GET_FRAME(ctx) ADVANCE_STACK_FRAME (GET_STACK(ctx))
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.S b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.S
deleted file mode 100644
index 38cd942d1f..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.S
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Define errno */
-
-.section .bss
- .globl errno
- .align 4
-errno: .space 4
- .type errno, @object
- .size errno, 4
-
-weak_alias (errno, _errno)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h b/sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h
deleted file mode 100644
index bc70a58e24..0000000000
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/bits/mman.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Definitions for POSIX memory map interface. Linux/SPARC version.
- Copyright (C) 1997 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 Library General Public License as
- published by the Free Software Foundation; either version 2 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-#ifndef _SYS_MMAN_H
-# error "Never use <bits/mman.h> directly; include <sys/mman.h> instead."
-#endif
-
-/* The following definitions basically come from the kernel headers.
- But the kernel header is not namespace clean. */
-
-
-/* Protections are chosen from these bits, OR'd together. The
- implementation does not necessarily support PROT_EXEC or PROT_WRITE
- without PROT_READ. The only guarantees are that no writing will be
- allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-
-#define PROT_READ 0x1 /* Page can be read. */
-#define PROT_WRITE 0x2 /* Page can be written. */
-#define PROT_EXEC 0x4 /* Page can be executed. */
-#define PROT_NONE 0x0 /* Page can not be accessed. */
-
-/* Sharing types (must choose one and only one of these). */
-#define MAP_SHARED 0x01 /* Share changes. */
-#define MAP_PRIVATE 0x02 /* Changes are private. */
-#ifdef __USE_MISC
-# define MAP_TYPE 0x0f /* Mask for type of mapping. */
-#endif
-
-/* Other flags. */
-#define MAP_FIXED 0x10 /* Interpret addr exactly. */
-#ifdef __USE_MISC
-# define MAP_FILE 0x00
-# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
-# define MAP_ANON MAP_ANONYMOUS
-# define MAP_RENAME MAP_ANONYMOUS
-#endif
-
-/* These are Linux-specific. */
-#ifdef __USE_MISC
-# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
-# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
-# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
-# define MAP_LOCKED 0x0100 /* Lock the mapping. */
-# define MAP_NORESERVE 0x0040 /* Don't check for reservations. */
-# define _MAP_NEW 0x80000000 /* Binary compatibility with SunOS. */
-#endif
-
-/* Flags to `msync'. */
-#define MS_ASYNC 1 /* Sync memory asynchronously. */
-#define MS_SYNC 4 /* Synchronous memory sync. */
-#define MS_INVALIDATE 2 /* Invalidate the caches. */
-
-/* Flags for `mlockall'. */
-#define MCL_CURRENT 0x2000 /* Lock all currently mapped pages. */
-#define MCL_FUTURE 0x4000 /* Lock all additions to address
- space. */
-
-/* Flags for `mremap'. */
-#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h b/sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h
new file mode 100644
index 0000000000..809f7c1d13
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h
@@ -0,0 +1,266 @@
+/* Dump registers.
+ Copyright (C) 1999 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sys/uio.h>
+#include <stdio-common/_itoa.h>
+#include <bits/sigcontext.h>
+
+/* We will print the register dump in this format:
+
+ TSTATE: XXXXXXXXXXXXXXXX TPC: XXXXXXXXXXXXXXXX TNPC: XXXXXXXXXXXXXXXX
+ Y: XXXXXXXX
+ g0: 0000000000000000 g1: XXXXXXXXXXXXXXXX g2: XXXXXXXXXXXXXXXX
+ g3: XXXXXXXXXXXXXXXX g4: XXXXXXXXXXXXXXXX g5: XXXXXXXXXXXXXXXX
+ g6: XXXXXXXXXXXXXXXX g7: XXXXXXXXXXXXXXXX
+ o0: XXXXXXXXXXXXXXXX o1: XXXXXXXXXXXXXXXX o2: XXXXXXXXXXXXXXXX
+ o3: XXXXXXXXXXXXXXXX o4: XXXXXXXXXXXXXXXX o5: XXXXXXXXXXXXXXXX
+ sp: XXXXXXXXXXXXXXXX o7: XXXXXXXXXXXXXXXX
+ l0: XXXXXXXXXXXXXXXX l1: XXXXXXXXXXXXXXXX l2: XXXXXXXXXXXXXXXX
+ l3: XXXXXXXXXXXXXXXX l4: XXXXXXXXXXXXXXXX l5: XXXXXXXXXXXXXXXX
+ l6: XXXXXXXXXXXXXXXX l7: XXXXXXXXXXXXXXXX
+ i0: XXXXXXXXXXXXXXXX i1: XXXXXXXXXXXXXXXX i2: XXXXXXXXXXXXXXXX
+ i3: XXXXXXXXXXXXXXXX i4: XXXXXXXXXXXXXXXX i5: XXXXXXXXXXXXXXXX
+ fp: XXXXXXXXXXXXXXXX i7: XXXXXXXXXXXXXXXX
+
+ Old mask: XXXXXXXX XFSR: XXXXXXXXXXXXXXXX GSR: XX FPRS: X
+ f0: XXXXXXXXXXXXXXXX f2: XXXXXXXXXXXXXXXX f4: XXXXXXXXXXXXXXXX
+ f6: XXXXXXXXXXXXXXXX f8: XXXXXXXXXXXXXXXX f10: XXXXXXXXXXXXXXXX
+ f12: XXXXXXXXXXXXXXXX f14: XXXXXXXXXXXXXXXX f16: XXXXXXXXXXXXXXXX
+ f18: XXXXXXXXXXXXXXXX f20: XXXXXXXXXXXXXXXX f22: XXXXXXXXXXXXXXXX
+ f24: XXXXXXXXXXXXXXXX f26: XXXXXXXXXXXXXXXX f28: XXXXXXXXXXXXXXXX
+ f30: XXXXXXXXXXXXXXXX f32: XXXXXXXXXXXXXXXX f34: XXXXXXXXXXXXXXXX
+ f36: XXXXXXXXXXXXXXXX f38: XXXXXXXXXXXXXXXX f40: XXXXXXXXXXXXXXXX
+ f42: XXXXXXXXXXXXXXXX f44: XXXXXXXXXXXXXXXX f46: XXXXXXXXXXXXXXXX
+ f48: XXXXXXXXXXXXXXXX f50: XXXXXXXXXXXXXXXX f52: XXXXXXXXXXXXXXXX
+ f54: XXXXXXXXXXXXXXXX f56: XXXXXXXXXXXXXXXX f58: XXXXXXXXXXXXXXXX
+ f60: XXXXXXXXXXXXXXXX f62: XXXXXXXXXXXXXXXX
+
+ */
+
+static void
+hexvalue (unsigned long int value, char *buf, size_t len)
+{
+ char *cp = _itoa_word (value, buf + len, 16, 0);
+ while (cp > buf)
+ *--cp = '0';
+}
+
+struct __siginfo_sparc64_fpu
+{
+ unsigned long si_float_regs[32];
+ unsigned long si_xfsr;
+ unsigned long si_gsr;
+ unsigned long si_fprs;
+};
+
+static void
+register_dump (int fd, SIGCONTEXT ctx)
+{
+ char regs[36][16];
+ char fregs[35][8];
+ struct iovec iov[150];
+ size_t nr = 0;
+ int i;
+ struct reg_window *r = (struct reg_window *)
+ ctx->si_regs.u_regs[14];
+ struct __siginfo_sparc64_fpu *f;
+
+#define ADD_STRING(str) \
+ iov[nr].iov_base = (char *) str; \
+ iov[nr].iov_len = strlen (str); \
+ ++nr
+#define ADD_MEM(str, len) \
+ iov[nr].iov_base = str; \
+ iov[nr].iov_len = len; \
+ ++nr
+
+ /* Generate strings of register contents. */
+ hexvalue (ctx->si_regs.tstate, regs[0], 16);
+ hexvalue (ctx->si_regs.tpc, regs[1], 16);
+ hexvalue (ctx->si_regs.tnpc, regs[2], 16);
+ hexvalue (ctx->si_regs.y, regs[3], 8);
+ for (i = 1; i <= 15; i++)
+ hexvalue (ctx->si_regs.u_regs[i], regs[3+i], 16);
+ for (i = 0; i <= 15; i++)
+ hexvalue (r->locals[i], regs[19+i], 16);
+ hexvalue (ctx->si_mask, regs[35], 8);
+
+ /* Generate the output. */
+ ADD_STRING ("Register dump:\n\n TSTATE: ");
+ ADD_MEM (regs[0], 16);
+ ADD_STRING (" TPC: ");
+ ADD_MEM (regs[1], 16);
+ ADD_STRING (" TNPC: ");
+ ADD_MEM (regs[2], 16);
+ ADD_STRING ("\n Y: ");
+ ADD_MEM (regs[3], 8);
+ ADD_STRING ("\n g0: 0000000000000000 g1: ");
+ ADD_MEM (regs[4], 16);
+ ADD_STRING (" g2: ");
+ ADD_MEM (regs[5], 16);
+ ADD_STRING ("\n g3: ");
+ ADD_MEM (regs[6], 16);
+ ADD_STRING (" g4: ");
+ ADD_MEM (regs[7], 16);
+ ADD_STRING (" g5: ");
+ ADD_MEM (regs[8], 16);
+ ADD_STRING ("\n g6: ");
+ ADD_MEM (regs[9], 16);
+ ADD_STRING (" g7: ");
+ ADD_MEM (regs[10], 16);
+ ADD_STRING ("\n o0: ");
+ ADD_MEM (regs[11], 16);
+ ADD_STRING (" o1: ");
+ ADD_MEM (regs[12], 16);
+ ADD_STRING (" o2: ");
+ ADD_MEM (regs[13], 16);
+ ADD_STRING ("\n o3: ");
+ ADD_MEM (regs[14], 16);
+ ADD_STRING (" o4: ");
+ ADD_MEM (regs[15], 16);
+ ADD_STRING (" o5: ");
+ ADD_MEM (regs[16], 16);
+ ADD_STRING ("\n sp: ");
+ ADD_MEM (regs[17], 16);
+ ADD_STRING (" o7: ");
+ ADD_MEM (regs[18], 16);
+ ADD_STRING ("\n l0: ");
+ ADD_MEM (regs[19], 16);
+ ADD_STRING (" l1: ");
+ ADD_MEM (regs[20], 16);
+ ADD_STRING (" l2: ");
+ ADD_MEM (regs[21], 16);
+ ADD_STRING ("\n l3: ");
+ ADD_MEM (regs[22], 16);
+ ADD_STRING (" l4: ");
+ ADD_MEM (regs[23], 16);
+ ADD_STRING (" l5: ");
+ ADD_MEM (regs[24], 16);
+ ADD_STRING ("\n l6: ");
+ ADD_MEM (regs[25], 16);
+ ADD_STRING (" l7: ");
+ ADD_MEM (regs[26], 16);
+ ADD_STRING ("\n i0: ");
+ ADD_MEM (regs[27], 16);
+ ADD_STRING (" i1: ");
+ ADD_MEM (regs[28], 16);
+ ADD_STRING (" i2: ");
+ ADD_MEM (regs[29], 16);
+ ADD_STRING ("\n i3: ");
+ ADD_MEM (regs[30], 16);
+ ADD_STRING (" i4: ");
+ ADD_MEM (regs[31], 16);
+ ADD_STRING (" i5: ");
+ ADD_MEM (regs[32], 16);
+ ADD_STRING ("\n fp: ");
+ ADD_MEM (regs[33], 16);
+ ADD_STRING (" i7: ");
+ ADD_MEM (regs[34], 16);
+ ADD_STRING ("\n\n Old mask: ");
+ ADD_MEM (regs[35], 8);
+
+ f = *(struct __siginfo_sparc64_fpu **)(ctx + 1);
+ if (f != NULL)
+ {
+ for (i = 0; i < 32; i++)
+ hexvalue (f->si_float_regs[i], fregs[i], 16);
+ hexvalue (f->si_xfsr, fregs[32], 16);
+ hexvalue (f->si_gsr, fregs[33], 2);
+ hexvalue (f->si_fprs, fregs[34], 1);
+ ADD_STRING (" XFSR: ");
+ ADD_MEM (fregs[32], 16);
+ ADD_STRING (" GSR: ");
+ ADD_MEM (fregs[33], 2);
+ ADD_STRING (" FPRS: ");
+ ADD_MEM (fregs[34], 1);
+ ADD_STRING ("\n f0: ");
+ ADD_MEM (fregs[0], 16);
+ ADD_STRING (" f2: ");
+ ADD_MEM (fregs[1], 16);
+ ADD_STRING (" f4: ");
+ ADD_MEM (fregs[2], 16);
+ ADD_STRING ("\n f6: ");
+ ADD_MEM (fregs[3], 16);
+ ADD_STRING (" f8: ");
+ ADD_MEM (fregs[4], 16);
+ ADD_STRING (" f10: ");
+ ADD_MEM (fregs[5], 16);
+ ADD_STRING ("\n f12: ");
+ ADD_MEM (fregs[6], 16);
+ ADD_STRING (" f14: ");
+ ADD_MEM (fregs[7], 16);
+ ADD_STRING (" f16: ");
+ ADD_MEM (fregs[8], 16);
+ ADD_STRING ("\n f18: ");
+ ADD_MEM (fregs[9], 16);
+ ADD_STRING (" f20: ");
+ ADD_MEM (fregs[10], 16);
+ ADD_STRING (" f22: ");
+ ADD_MEM (fregs[11], 16);
+ ADD_STRING ("\n f24: ");
+ ADD_MEM (fregs[12], 16);
+ ADD_STRING (" f26: ");
+ ADD_MEM (fregs[13], 16);
+ ADD_STRING (" f28: ");
+ ADD_MEM (fregs[14], 16);
+ ADD_STRING ("\n f30: ");
+ ADD_MEM (fregs[15], 16);
+ ADD_STRING (" f32: ");
+ ADD_MEM (fregs[16], 16);
+ ADD_STRING (" f34: ");
+ ADD_MEM (fregs[17], 16);
+ ADD_STRING ("\n f36: ");
+ ADD_MEM (fregs[18], 16);
+ ADD_STRING (" f38: ");
+ ADD_MEM (fregs[19], 16);
+ ADD_STRING (" f40: ");
+ ADD_MEM (fregs[20], 16);
+ ADD_STRING ("\n f42: ");
+ ADD_MEM (fregs[21], 16);
+ ADD_STRING (" f44: ");
+ ADD_MEM (fregs[22], 16);
+ ADD_STRING (" f46: ");
+ ADD_MEM (fregs[23], 16);
+ ADD_STRING ("\n f48: ");
+ ADD_MEM (fregs[24], 16);
+ ADD_STRING (" f50: ");
+ ADD_MEM (fregs[25], 16);
+ ADD_STRING (" f52: ");
+ ADD_MEM (fregs[26], 16);
+ ADD_STRING ("\n f54: ");
+ ADD_MEM (fregs[27], 16);
+ ADD_STRING (" f56: ");
+ ADD_MEM (fregs[28], 16);
+ ADD_STRING (" f58: ");
+ ADD_MEM (fregs[29], 16);
+ ADD_STRING ("\n f60: ");
+ ADD_MEM (fregs[30], 16);
+ ADD_STRING (" f62: ");
+ ADD_MEM (fregs[31], 16);
+ }
+
+ ADD_STRING ("\n");
+
+ /* Write the stuff out. */
+ writev (fd, iov, nr);
+}
+
+
+#define REGISTER_DUMP register_dump (fd, ctx)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/fork.S b/sysdeps/unix/sysv/linux/sparc/sparc64/sigcontextinfo.h
index 73334ed528..260658a0d9 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/fork.S
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sigcontextinfo.h
@@ -1,6 +1,6 @@
-/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
- Contributed by Miguel de Icaza <miguel@gnu.ai.mit.edu>, 1997.
+ Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -17,13 +17,13 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <sysdep.h>
-
-PSEUDO (__libc_fork, fork, 0)
- sub %o1, 1, %o1
- retl
- and %o0, %o1, %o0
-
-PSEUDO_END (__libc_fork)
-weak_alias (__libc_fork, __fork)
-weak_alias (__libc_fork, fork)
+#ifndef STACK_BIAS
+#define STACK_BIAS 2047
+#endif
+#define SIGCONTEXT __siginfo_t *
+#define GET_PC(ctx) ((void *) ctx->si_regs.tpc)
+#define ADVANCE_STACK_FRAME(next) \
+ ((void *) &((struct reg_window *) (((unsigned long int) next) \
+ + STACK_BIAS))->ins[6])
+#define GET_STACK(ctx) ((void *) ctx->si_regs.u_regs[14])
+#define GET_FRAME(ctx) ADVANCE_STACK_FRAME (GET_STACK (ctx))
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.S b/sysdeps/unix/sysv/linux/sparc/sysdep.S
index 0923ed5141..a6ce96d713 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.S
+++ b/sysdeps/unix/sysv/linux/sparc/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Richard Henderson <richard@gnu.ai.mit.edu>, 1997.
@@ -22,12 +22,9 @@
.section .bss
.globl errno
- .align 2
+ .align 4
errno: .space 4
.type errno, @object
.size errno, 4
- .globl __errno
-__errno = errno
-
weak_alias (errno, _errno)
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S b/sysdeps/unix/sysv/linux/sparc/vfork.S
index feed06f225..78e8fb3e32 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/vfork.S
+++ b/sysdeps/unix/sysv/linux/sparc/vfork.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jj@ultra.linux.cz>, 1999.
@@ -19,11 +19,7 @@
#include <sysdep.h>
-#ifdef __NR_vfork
PSEUDO (__vfork, vfork, 0)
-#else
-PSEUDO (__vfork, fork, 0)
-#endif
sub %o1, 1, %o1
retl
and %o0, %o1, %o0