Skip to contentSkip to conversation

RFC - glibc - patch reivew - 64->32

parisc-linux Carlos O'Donell 2 participants 3 messages Aug 23, 2002

lore
Share & tools
lore
#0 lore raw

pa,

I've been going through some of the glibc issues that we have and trying to fix them... or put in a large enough shoe -horn that the solution fits.

The following are two .dpatch's that I'd like to send to gotom to get put in for -15 or -16 depending on how much testing I get done.

The first .dpatch has to do with our jmpbuf implementation, and the fact that division calculation is not always correct. I _think_ this is a solution, but since I'm away this weekend, I challenge someone to put together a jmpbuf test that tries to break this. I've been told that anything using libst is prone to breakage on PA without some ugly hacks (e.g. lurker).

The second .dpatch fixes our mcontext_t problem. I don't know what was going on with out rather wonky definition, but I'm probably sure it was just bitrot. I've specified that a signal context _is_ just a machine context. Kernel and glibc are now in sync.

This brings up another issue! When passing the sigcontext back from a 64-bit kernel, the kernel passes back 64-bit values and the mcontext is rather useless to the signal handler. This has _always_ been broken and has never worked properly. I'm working on adding some rather ugly "#ifdef __LP64__" code to arch/parisc/signal.c to have it translate the values into a sigcontext32 that I have defined in sys32.h. There are a few other examples in signal.c that already do some rather ugly conversion :)

Suggested solutions:
- Widen sigcontext
- Add conversion code to signal handling path

I would rather do the later... since it doesn't change the way we do business across the board.

Ideas and input welcome and appreciated!

c.

#! /bin/sh -e

# DP: PA-RISC jmpbuf changes.

if [ $# -ne 2 ]; then
echo >&2 "basename $0: script expects -patch|-unpatch as argument" exit 1
fi
case "$1" in

    -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
    *)
        echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
        exit 1

esac
exit 0

sysdeps/hppa/bits/setjmp.h +1 -1
diff -urN glibc-2.2.5/sysdeps/hppa/bits/setjmp.h glibc-2.2.5/sysdeps/hppa/bits/setjmp.h
@@ -32,7 +32,7 @@
 #endif
 
 #ifndef	_ASM
-typedef double __jmp_buf[21];
+typedef int __jmp_buf[21] __attribute__ ((aligned (8)));
 #endif
 
 /* Test if longjmp to JMPBUF would unwind the frame containing a local

#! /bin/sh -e

# DP: Makes mcontext_t a typedef to sigcontext on hppa.

if [ $# -ne 2 ]; then
echo >&2 "basename $0: script expects -patch|-unpatch as argument" exit 1
fi
case "$1" in

    -patch) patch -d "$2" -f --no-backup-if-mismatch -p1 < $0;;
    -unpatch) patch -d "$2" -f --no-backup-if-mismatch -R -p1 < $0;;
    *)
	echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
	exit 1

esac
exit 0

# append the patch here and adjust the -p? flag in the patch calls.
--- glibc-2.2.5/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h	2002-08-20 20:50:17.000000000 -0400
+++ glibc-2.2.5/sysdeps/unix/sysv/linux/hppa/sys/ucontext.h	2002-08-20 20:49:01.000000000 -0400
@@ -52,11 +52,7 @@
   } fpregset_t;

/* 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

#1 lore raw

sysdeps/hppa/bits/setjmp.h line 36

Quoted 4 lines

#ifndef _ASM

sysdeps/hppa/bits/setjmp.h +1 -1
-typedef double __jmp_buf[21];
+typedef int __jmp_buf[21] __attribute__ ((aligned (8)));
 #endif

this should now be
typedef int __jmp_buf[42] __attribute__ ((aligned (8))); (sizeof(double) == 2 * sizeof(int))

randolph

Signature · 3 lines
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/
#2 lore raw
Quoted 9 lines

sysdeps/hppa/bits/setjmp.h line 36

Quoted 4 lines

#ifndef _ASM

sysdeps/hppa/bits/setjmp.h +1 -1
-typedef double __jmp_buf[21];
+typedef int __jmp_buf[21] __attribute__ ((aligned (8)));
 #endif

this should now be
typedef int __jmp_buf[42] __attribute__ ((aligned (8))); (sizeof(double) == 2 * sizeof(int))

Correct. Thanks! I've been working in a mixed 32/64-bit mode for most of the week trying to get sigcontext right... that sometimes I miss the simple things :}

Can you find example jmpbuf usages that break this?

c.