Skip to contentSkip to conversation

Patch for glibc getcontext()/makecontext()/setcontext()/swapcontext()

RFC In review Helge Deller 2 participants 3 messages Jul 18, 2008 – Jul 20, 2008

lore
Share & tools
lore
#0 lore raw

RFC 1/1 Patch for glibc getcontext()/makecontext()/setcontext()/swapcontext()

I've tried to come up with a patch for glibc on hppa, which implements the *context() functions.

Main reason for me to write up those functions was e.g. this bug
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=459567
but I assume a few other bugs might be fixed then as well, if we get those functions integrated into glibc.

Below is now my first version.
Although it fixes the debian bug 459567 for me (after I rebuilt pth-2.0.7 and telling it to use the *context functions), I'm not sure if I missed anything else.

I'm sending it here on the parisc-devel list and would be happy to get feedback, before I plan to send it to the glibc devel list.

Current limitations:
- only integer parameters allowed (but that's usual on most arches)
- 32bit userspace implementation only
- do I need to save the FP regs?
- maybe more?

Any feedback is very much appreciated.
(Please be kind, my hppa assembler knowledge isn't that good)

Helge

sysdeps/unix/sysv/linux/hppa/Makefile renamed from sysdeps/unix/sysv/linux/hppa/Makefile.org +5 -0
diff -up ports/sysdeps/unix/sysv/linux/hppa/Makefile.org ports/sysdeps/unix/sysv/linux/hppa/Makefile
@@ -1,2 +1,7 @@
 # linux/hppa does not use -lmilli anymore
 gnulib := -lgcc
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
+
sysdeps/unix/sysv/linux/hppa/getcontext.S renamed from sysdeps/unix/sysv/linux/hppa/getcontext.S.org +101 -0

101 lines not on this page · raw message

sysdeps/unix/sysv/linux/hppa/makecontext.c renamed from sysdeps/unix/sysv/linux/hppa/makecontext.c.org +79 -0

79 lines not on this page · raw message

sysdeps/unix/sysv/linux/hppa/setcontext.S renamed from sysdeps/unix/sysv/linux/hppa/setcontext.S.org +124 -0

124 lines not on this page · raw message

sysdeps/unix/sysv/linux/hppa/swapcontext.c renamed from sysdeps/unix/sysv/linux/hppa/swapcontext.c.org +66 -0

66 lines not on this page · raw message

sysdeps/unix/sysv/linux/hppa/ucontext_i.sym renamed from sysdeps/unix/sysv/linux/hppa/ucontext_i.sym.org +90 -0

90 lines not on this page · raw message

#1 lore raw
Quoted 8 lines · Helge Deller

- only integer parameters allowed (but that's usual on most arches)
- 32bit userspace implementation only
- do I need to save the FP regs?
- maybe more?

Any feedback is very much appreciated.
(Please be kind, my hppa assembler knowledge isn't that good)

You probably need to save fpregs as well, but you could just steal all that from setjmp (ordering matters with fprs.)

r, Kyle

#2 lore raw
Quoted 6 lines · Kyle McMartin
Quoted 5 lines · Helge Deller

- only integer parameters allowed (but that's usual on most arches)
- 32bit userspace implementation only
- do I need to save the FP regs?
- maybe more?

Quoted 6 lines
Quoted 3 lines

Any feedback is very much appreciated.
(Please be kind, my hppa assembler knowledge isn't that good)

You probably need to save fpregs as well, but you could just steal all that from setjmp (ordering matters with fprs.)

Thanks Kyle!

Attached is an updated patch, which
- saves and restores the FP regs
- passes glibc's stdlib/tst-setcontext.c test

Helge

sysdeps/unix/sysv/linux/hppa/Makefile renamed from sysdeps/unix/sysv/linux/hppa/Makefile.org +5 -0
diff -up ports/sysdeps/unix/sysv/linux/hppa/Makefile.org ports/sysdeps/unix/sysv/linux/hppa/Makefile
@@ -1,2 +1,7 @@
 # linux/hppa does not use -lmilli anymore
 gnulib := -lgcc
+
+ifeq ($(subdir),stdlib)
+gen-as-const-headers += ucontext_i.sym
+endif
+
sysdeps/unix/sysv/linux/hppa/getcontext.S renamed from sysdeps/unix/sysv/linux/hppa/getcontext.S.org +158 -0

158 lines not on this page · raw message

sysdeps/unix/sysv/linux/hppa/makecontext.c renamed from sysdeps/unix/sysv/linux/hppa/makecontext.c.org +79 -0

79 lines not on this page · raw message

sysdeps/unix/sysv/linux/hppa/setcontext.S renamed from sysdeps/unix/sysv/linux/hppa/setcontext.S.org +155 -0

155 lines not on this page · raw message

sysdeps/unix/sysv/linux/hppa/swapcontext.c renamed from sysdeps/unix/sysv/linux/hppa/swapcontext.c.org +43 -0

43 lines not on this page · raw message

sysdeps/unix/sysv/linux/hppa/ucontext_i.sym renamed from sysdeps/unix/sysv/linux/hppa/ucontext_i.sym.org +59 -0

59 lines not on this page · raw message