pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/emulators/lrmi adapt to API (and ABI) changes of the i...
details: https://anonhg.NetBSD.org/pkgsrc/rev/565cc4b1c083
branches: trunk
changeset: 462576:565cc4b1c083
user: drochner <drochner%pkgsrc.org@localhost>
date: Sun Oct 05 13:39:24 2003 +0000
description:
adapt to API (and ABI) changes of the i386_vm86() call due to the
siginfo changes in -current
(changed to use sigaction() instead of signal() in all cases to limit
the number of #ifdefs)
diffstat:
emulators/lrmi/distinfo | 3 +-
emulators/lrmi/patches/patch-aa | 125 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 127 insertions(+), 1 deletions(-)
diffs (139 lines):
diff -r f193a82cae08 -r 565cc4b1c083 emulators/lrmi/distinfo
--- a/emulators/lrmi/distinfo Sun Oct 05 13:13:06 2003 +0000
+++ b/emulators/lrmi/distinfo Sun Oct 05 13:39:24 2003 +0000
@@ -1,4 +1,5 @@
-$NetBSD: distinfo,v 1.1.1.1 2003/08/11 18:13:50 drochner Exp $
+$NetBSD: distinfo,v 1.2 2003/10/05 13:39:24 drochner Exp $
SHA1 (lrmi-0.8.tar.gz) = e01ba74b5343551b8d717c2fa9c365cb11d1ab48
Size (lrmi-0.8.tar.gz) = 9347 bytes
+SHA1 (patch-aa) = 2bb9fd03af21363040715b4471b5bec250663c8f
diff -r f193a82cae08 -r 565cc4b1c083 emulators/lrmi/patches/patch-aa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/emulators/lrmi/patches/patch-aa Sun Oct 05 13:39:24 2003 +0000
@@ -0,0 +1,125 @@
+$NetBSD: patch-aa,v 1.1 2003/10/05 13:39:24 drochner Exp $
+
+--- lrmi.c.orig 2003-05-14 05:18:12.000000000 +0200
++++ lrmi.c
+@@ -211,12 +211,26 @@ LRMI_free_real(void *m)
+ #define DEFAULT_STACK_SIZE 0x1000
+ #define RETURN_TO_32_INT 255
+
++#if defined(__NetBSD__) && defined(SA_SIGINFO)
++struct gregset_overlay {
++ int gs, fs, es, ds;
++ int edi, esi, ebp, esp, ebx, edx, ecx, eax;
++ int _trapno, _err;
++ int eip, cs, eflags, uesp, ss;
++};
++#endif
++
+ #if defined(__linux__)
+ #define CONTEXT_REGS context.vm.regs
+ #define REG(x) x
+ #elif defined(__NetBSD__)
++#if defined(SA_SIGINFO)
++#define CONTEXT_REGS (*(struct gregset_overlay *)&context.vm.substr.regs)
++#define REG(x) x
++#else
+ #define CONTEXT_REGS context.vm.substr.regs
+ #define REG(x) vmsc.sc_ ## x
++#endif /* SA_SIGINFO */
+ #elif defined(__FreeBSD__)
+ #define CONTEXT_REGS context.vm.uc
+ #define REG(x) uc_mcontext.mc_ ## x
+@@ -237,7 +251,7 @@ static struct {
+ #if defined(__NetBSD__) || defined(__FreeBSD__)
+ int success;
+ jmp_buf env;
+- void *old_sighandler;
++ struct sigaction old_sighandler;
+ int vret;
+ #endif
+ } context = { 0 };
+@@ -808,10 +822,22 @@ run_vm86(void)
+ #elif defined(__NetBSD__) || defined(__FreeBSD__)
+ #if defined(__NetBSD__)
+ static void
+-vm86_callback(int sig, int code, struct sigcontext *sc)
++vm86_callback(int sig,
++#if defined(SA_SIGINFO)
++ siginfo_t *info, void *vctx
++#else
++ int code, struct sigcontext *sc
++#endif
++ )
+ {
+ /* Sync our context with what the kernel develivered to us. */
++#if defined(SA_SIGINFO)
++ int code = info->si_trap;
++ ucontext_t *ctx = vctx;
++ memcpy(&CONTEXT_REGS, &ctx->uc_mcontext.__gregs, sizeof(CONTEXT_REGS));
++#else
+ memcpy(&CONTEXT_REGS, sc, sizeof(*sc));
++#endif
+
+ switch (VM86_TYPE(code)) {
+ case VM86_INTx:
+@@ -850,7 +876,11 @@ vm86_callback(int sig, int code, struct
+ }
+
+ /* ...and sync our context back to the kernel. */
++#if defined(SA_SIGINFO)
++ memcpy(&ctx->uc_mcontext.__gregs, &CONTEXT_REGS, sizeof(CONTEXT_REGS));
++#else
+ memcpy(sc, &CONTEXT_REGS, sizeof(*sc));
++#endif
+ }
+ #elif defined(__FreeBSD__)
+ static void
+@@ -899,21 +929,28 @@ vm86_callback(int sig, int code, struct
+ static int
+ run_vm86(void)
+ {
+- if (context.old_sighandler) {
++ struct sigaction sa;
++ int res;
++
++ if (context.old_sighandler.sa_sigaction) {
+ #ifdef LRMI_DEBUG
+ fprintf(stderr, "run_vm86: callback already installed\n");
+ #endif
+ return (0);
+ }
+
++ memset(&sa, 0, sizeof(sa));
++ sa.sa_sigaction = vm86_callback;
+ #if defined(__NetBSD__)
+- context.old_sighandler = signal(SIGURG, (void (*)(int))vm86_callback);
++#if defined(SA_SIGINFO)
++ sa.sa_flags = SA_SIGINFO;
++#endif
++ res = sigaction(SIGURG, &sa, &context.old_sighandler);
+ #elif defined(__FreeBSD__)
+- context.old_sighandler = signal(SIGBUS, (void (*)(int))vm86_callback);
++ res = sigaction(SIGBUS, &sa, &context.old_sighandler);
+ #endif
+
+- if (context.old_sighandler == (void *)-1) {
+- context.old_sighandler = NULL;
++ if (res < 0) {
+ #ifdef LRMI_DEBUG
+ fprintf(stderr, "run_vm86: cannot install callback\n");
+ #endif
+@@ -922,11 +959,11 @@ run_vm86(void)
+
+ if (setjmp(context.env)) {
+ #if defined(__NetBSD__)
+- (void) signal(SIGURG, context.old_sighandler);
++ sigaction(SIGURG, &context.old_sighandler, 0);
+ #elif defined(__FreeBSD__)
+- (void) signal(SIGBUS, context.old_sighandler);
++ sigaction(SIGBUS, &context.old_sighandler, 0);
+ #endif
+- context.old_sighandler = NULL;
++ context.old_sighandler.sa_sigaction = NULL;
+
+ if (context.success)
+ return (1);
Home |
Main Index |
Thread Index |
Old Index