Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/rump/librump/rumpnet Refetch netisr function pointers wi...



details:   https://anonhg.NetBSD.org/src/rev/69c741e31886
branches:  trunk
changeset: 760188:69c741e31886
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Dec 30 16:19:39 2010 +0000

description:
Refetch netisr function pointers with dlsym().  This gives the
desired values in case the components containing the netisr handlers
were not linked in but dlopen()'d before calling rump_init().

(could simplify a little in case static linking is declared dead)

diffstat:

 sys/rump/librump/rumpnet/netisr.c |  56 ++++++++++++++++++--------------------
 1 files changed, 27 insertions(+), 29 deletions(-)

diffs (95 lines):

diff -r 624f50190cdc -r 69c741e31886 sys/rump/librump/rumpnet/netisr.c
--- a/sys/rump/librump/rumpnet/netisr.c Thu Dec 30 15:47:30 2010 +0000
+++ b/sys/rump/librump/rumpnet/netisr.c Thu Dec 30 16:19:39 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netisr.c,v 1.4 2009/05/26 23:43:39 pooka Exp $ */
+/*     $NetBSD: netisr.c,v 1.5 2010/12/30 16:19:39 pooka Exp $ */
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netisr.c,v 1.4 2009/05/26 23:43:39 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netisr.c,v 1.5 2010/12/30 16:19:39 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/intr.h>
@@ -38,6 +38,8 @@
 #include <netinet6/ip6_var.h>
 #include <net/netisr.h>
 
+#include <rump/rumpuser.h>
+
 #include "rump_net_private.h"
 
 static void *netisrs[NETISR_MAX];
@@ -49,44 +51,40 @@
 }
 
 /*
- * Provide weak aliases purely for linkage in case the real
- * networking stack isn't used
+ * Aliases are needed only for static linking (dlsym() is not supported).
  */
-void __ipintr_stub(void);
+void __netisr_stub(void);
 void
-__ipintr_stub(void)
+__netisr_stub(void)
 {
 
-       panic("ipintr called but networking stack missing");
-}
-__weak_alias(ipintr,__ipintr_stub);
-
-void __arpintr_stub(void);
-void
-__arpintr_stub(void)
-{
-
-       panic("arpintr called but networking stack missing");
+       panic("netisr called but networking stack missing");
 }
-__weak_alias(arpintr,__arpintr_stub);
-
-void __ip6intr_stub(void);
-void
-__ip6intr_stub(void)
-{
-
-       panic("ip6intr called but networking stack missing");
-}
-__weak_alias(ip6intr,__ip6intr_stub);
+__weak_alias(ipintr,__netisr_stub);
+__weak_alias(arpintr,__netisr_stub);
+__weak_alias(ip6intr,__netisr_stub);
 
 void
 rump_netisr_init(void)
 {
+       void *iphand, *arphand, *ip6hand, *sym;
 
+       iphand = ipintr;
+       if ((sym = rumpuser_dl_globalsym("rumpns_ipintr")) != NULL)
+               iphand = sym;
+
+       arphand = arpintr;
+       if ((sym = rumpuser_dl_globalsym("rumpns_arpintr")) != NULL)
+               arphand = sym;
+
+       ip6hand = ip6intr;
+       if ((sym = rumpuser_dl_globalsym("rumpns_ip6intr")) != NULL)
+               ip6hand = sym;
+               
        netisrs[NETISR_IP] = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
-           (void (*)(void *))ipintr, NULL);
+           (void (*)(void *))iphand, NULL);
        netisrs[NETISR_ARP] = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
-           (void (*)(void *))arpintr, NULL);
+           (void (*)(void *))arphand, NULL);
        netisrs[NETISR_IPV6] = softint_establish(SOFTINT_NET | SOFTINT_MPSAFE,
-           (void (*)(void *))ip6intr, NULL);
+           (void (*)(void *))ip6hand, NULL);
 }



Home | Main Index | Thread Index | Old Index