Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc Make longjmp on vax not use sigreturn. Instead it ...
details: https://anonhg.NetBSD.org/src/rev/af169752fff7
branches: trunk
changeset: 580669:af169752fff7
user: matt <matt%NetBSD.org@localhost>
date: Tue May 03 04:37:33 2005 +0000
description:
Make longjmp on vax not use sigreturn. Instead it rewrites the
jmp_buf into one compatible with __longjmp14 and relies on that
to change that into a ucontext_t suitable for setcontext(2).
diffstat:
lib/libc/Makefile | 5 +++--
lib/libc/arch/vax/Makefile.inc | 3 ++-
lib/libc/arch/vax/gen/__setjmp14.S | 7 ++++---
lib/libc/arch/vax/gen/setjmp.S | 36 +++++++++++++++++++++++++++++-------
lib/libc/arch/vax/genassym.cf | 15 ++++++++++++++-
5 files changed, 52 insertions(+), 14 deletions(-)
diffs (174 lines):
diff -r ec026e162da5 -r af169752fff7 lib/libc/Makefile
--- a/lib/libc/Makefile Tue May 03 04:18:32 2005 +0000
+++ b/lib/libc/Makefile Tue May 03 04:37:33 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.120 2005/01/10 02:32:46 lukem Exp $
+# $NetBSD: Makefile,v 1.121 2005/05/03 04:37:33 matt Exp $
# @(#)Makefile 8.2 (Berkeley) 2/3/94
#
# All library objects contain sccsid strings by default; they may be
@@ -78,7 +78,8 @@
assym.h: genassym.sh ${ARCHDIR}/genassym.cf
${_MKTARGET_CREATE}
- ${HOST_SH} ${.CURDIR}/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
+ ${HOST_SH} ${.CURDIR}/genassym.sh ${CC} ${CFLAGS} \
+ ${CPPFLAGS} ${CPPFLAGS.assym.h} ${PROF} \
< ${ARCHDIR}/genassym.cf > assym.h.tmp && \
mv -f assym.h.tmp assym.h
.endif
diff -r ec026e162da5 -r af169752fff7 lib/libc/arch/vax/Makefile.inc
--- a/lib/libc/arch/vax/Makefile.inc Tue May 03 04:18:32 2005 +0000
+++ b/lib/libc/arch/vax/Makefile.inc Tue May 03 04:37:33 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.6 2004/06/03 16:34:19 mhitch Exp $
+# $NetBSD: Makefile.inc,v 1.7 2005/05/03 04:37:33 matt Exp $
.if ${OBJECT_FMT} == "ELF"
SRCS+= __longjmp14.c
@@ -6,3 +6,4 @@
SRCS+= __sigaction14_sigtramp.c __sigtramp2.S __sigtramp3.S
CPPFLAGS+= -I.
+CPPFLAGS.assym.h+=-D__LIBC12_SOURCE__
diff -r ec026e162da5 -r af169752fff7 lib/libc/arch/vax/gen/__setjmp14.S
--- a/lib/libc/arch/vax/gen/__setjmp14.S Tue May 03 04:18:32 2005 +0000
+++ b/lib/libc/arch/vax/gen/__setjmp14.S Tue May 03 04:37:33 2005 +0000
@@ -29,7 +29,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/* .asciz "@(#)setjmp.s 8.1 (Berkeley) 6/4/93" */
- .asciz "$NetBSD: __setjmp14.S,v 1.9 2004/03/21 18:19:52 matt Exp $"
+ .asciz "$NetBSD: __setjmp14.S,v 1.10 2005/05/03 04:37:33 matt Exp $"
#endif /* LIBC_SCCS and not lint */
/*
@@ -44,6 +44,7 @@
*/
#include "DEFS.h"
+#include "assym.h"
ENTRY(__setjmp14, R6)
movl 4(%ap),%r2 # construct sigcontext
@@ -68,7 +69,7 @@
movpsl (%r2) # save current psl
movw 4(%fp),(%r2) # save psw of caller
#ifdef __ELF__
- addl3 $44,4(%ap),%r2 # point to past signal context
+ addl3 $SC_LEN,4(%ap),%r2 # point to past signal context
movq %r6,(%r2)+ # save r6/r7
movq %r8,(%r2)+ # save r8/r9
movq %r10,(%r2)+ # save r10/r11
@@ -84,7 +85,7 @@
beql botch
#ifdef __ELF__
- moval 44(%r1),%r2 # get ptr to saved registers
+ moval $SC_LEN(%r1),%r2 # get ptr to saved registers
movq (%r2)+,%r6 # restore r6/r7
movq (%r2)+,%r8 # restore r8/r9
movq (%r2)+,%r10 # restore r10/r11
diff -r ec026e162da5 -r af169752fff7 lib/libc/arch/vax/gen/setjmp.S
--- a/lib/libc/arch/vax/gen/setjmp.S Tue May 03 04:18:32 2005 +0000
+++ b/lib/libc/arch/vax/gen/setjmp.S Tue May 03 04:37:33 2005 +0000
@@ -29,7 +29,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/* .asciz "@(#)setjmp.s 8.1 (Berkeley) 6/4/93" */
- .asciz "$NetBSD: setjmp.S,v 1.6 2003/08/07 16:42:31 agc Exp $"
+ .asciz "$NetBSD: setjmp.S,v 1.7 2005/05/03 04:37:33 matt Exp $"
#endif /* LIBC_SCCS and not lint */
/*
@@ -44,6 +44,7 @@
*/
#include "DEFS.h"
+#include "assym.h"
ENTRY(setjmp, R6)
movl 4(%ap),%r6 # construct sigcontext
@@ -52,11 +53,14 @@
pushl $0 # no new values
calls $4,_C_LABEL(__sigaltstack14) # pop args plus signal stack value
movl (%sp)+,(%r6)+ # save onsigstack status of caller
+ subl2 $SS_LEN,%sp
+ pushl %sp
pushl $0
- calls $1,_C_LABEL(sigblock) # get signal mask
- movl %r0,(%r6)+ # save signal mask of caller
+ pushl $SIG_BLOCK
+ calls $3,_C_LABEL(sigprocmask)# get signal mask
+ movl (%sp),(%r6)+ # save signal mask of caller
movl (%ap),%r0
- moval 4(%ap)[%r0],(%r6)+ # save sp of caller
+ moval 4(%ap)[%r0],(%r6)+ # save sp of caller
movl 12(%fp),(%r6)+ # save frame pointer of caller
movl 8(%fp),(%r6)+ # save argument pointer of caller
movl 16(%fp),(%r6)+ # save pc of caller
@@ -85,9 +89,27 @@
ret # pop another frame
done:
- pushl %r1 # pointer to sigcontext
- calls $1,_C_LABEL(sigreturn) # restore previous context
- # we should never return
+ pushl SC13_LEN+20(%r1) # here we fake a sigcontext
+ pushl SC13_LEN+16(%r1) # from a sigcontext13
+ pushl SC13_LEN+12(%r1)
+ pushl SC13_LEN+8(%r1) # first do save registers
+ pushl SC13_LEN+4(%r1)
+ pushl SC13_LEN+0(%r1)
+ pushl $0 # fill out the sigset
+ pushl $0
+ pushl $0
+ pushl SC13_MASK(%r1)
+ pushl SC13_PS(%r1) # now do everything else
+ pushl SC13_PC(%r1)
+ pushl SC13_AP(%r1)
+ pushl SC13_FP(%r1)
+ pushl SC13_AP(%r1)
+ pushl $0
+ pushl SC13_ONSTACK(%r1)
+ movl %sp,%r1
+ pushl %r0 # the return value
+ pushl %r1 # the sigcontext
+ calls $2,_C_LABEL(__longjmp14)
botch:
calls $0,_C_LABEL(longjmperror)
halt
diff -r ec026e162da5 -r af169752fff7 lib/libc/arch/vax/genassym.cf
--- a/lib/libc/arch/vax/genassym.cf Tue May 03 04:18:32 2005 +0000
+++ b/lib/libc/arch/vax/genassym.cf Tue May 03 04:37:33 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.2 2004/03/04 00:16:47 matt Exp $
+# $NetBSD: genassym.cf,v 1.3 2005/05/03 04:37:33 matt Exp $
#
# Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -67,11 +67,24 @@
define SS_FLAGS offsetof(stack_t, ss_flags)
define SS_ONSTACK SS_ONSTACK
+define SC13_LEN sizeof(struct sigcontext13)
+define SC13_ONSTACK offsetof(struct sigcontext13, sc_onstack)
+define SC13_MASK offsetof(struct sigcontext13, sc_mask)
+define SC13_SP offsetof(struct sigcontext13, sc_sp)
+define SC13_FP offsetof(struct sigcontext13, sc_fp)
+define SC13_AP offsetof(struct sigcontext13, sc_ap)
+define SC13_PC offsetof(struct sigcontext13, sc_pc)
+define SC13_PS offsetof(struct sigcontext13, sc_ps)
+
define SC_LEN sizeof(struct sigcontext)
define SC_ONSTACK offsetof(struct sigcontext, sc_onstack)
+define SC_MASK13 offsetof(struct sigcontext, __sc_mask13)
define SC_SP offsetof(struct sigcontext, sc_sp)
define SC_FP offsetof(struct sigcontext, sc_fp)
define SC_AP offsetof(struct sigcontext, sc_ap)
define SC_PC offsetof(struct sigcontext, sc_pc)
define SC_PS offsetof(struct sigcontext, sc_ps)
define SC_MASK offsetof(struct sigcontext, sc_mask)
+
+define SIG_BLOCK SIG_BLOCK
+define SS_LEN sizeof(sigset_t)
Home |
Main Index |
Thread Index |
Old Index