Source-Changes-HG archive

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

[src/trunk]: src/sys Add an optional hook for adjusting module string table a...



details:   https://anonhg.NetBSD.org/src/rev/fccf68597560
branches:  trunk
changeset: 754295:fccf68597560
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Apr 26 22:58:53 2010 +0000

description:
Add an optional hook for adjusting module string table after load.
Currently to be used for rump "SAOS" namespace trick.

diffstat:

 sys/kern/kern_stub.c |   6 ++++--
 sys/kern/subr_kobj.c |  13 +++++++++++--
 sys/sys/kobj.h       |   8 +++++++-
 3 files changed, 22 insertions(+), 5 deletions(-)

diffs (88 lines):

diff -r e9830dd2b423 -r fccf68597560 sys/kern/kern_stub.c
--- a/sys/kern/kern_stub.c      Mon Apr 26 20:10:23 2010 +0000
+++ b/sys/kern/kern_stub.c      Mon Apr 26 22:58:53 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_stub.c,v 1.26 2010/04/19 18:24:27 dyoung Exp $    */
+/*     $NetBSD: kern_stub.c,v 1.27 2010/04/26 22:58:53 pooka Exp $     */
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.26 2010/04/19 18:24:27 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.27 2010/04/26 22:58:53 pooka Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_ktrace.h"
@@ -129,6 +129,8 @@
 __weak_alias(bus_space_tag_destroy, voidop);
 __weak_alias(bus_space_is_equal, default_bus_space_is_equal);
 
+__weak_alias(kobj_renamespace, nullop);
+
 #if !defined(KERN_SA)
 /*
  * Scheduler activations system calls.  These need to remain, even when
diff -r e9830dd2b423 -r fccf68597560 sys/kern/subr_kobj.c
--- a/sys/kern/subr_kobj.c      Mon Apr 26 20:10:23 2010 +0000
+++ b/sys/kern/subr_kobj.c      Mon Apr 26 22:58:53 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_kobj.c,v 1.40 2009/11/27 17:54:11 pooka Exp $     */
+/*     $NetBSD: subr_kobj.c,v 1.41 2010/04/26 22:58:53 pooka Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.40 2009/11/27 17:54:11 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kobj.c,v 1.41 2010/04/26 22:58:53 pooka Exp $");
 
 #include "opt_modular.h"
 
@@ -337,6 +337,15 @@
        }
 
        /*
+        * Adjust module symbol namespace, if necessary (e.g. with rump)
+        */
+       error = kobj_renamespace(ko->ko_symtab, ko->ko_symcnt,
+           &ko->ko_strtab, &ko->ko_strtabsz);
+       if (error != 0) {
+               goto out;
+       }
+
+       /*
         * Do we have a string table for the section names?
         */
        if (hdr->e_shstrndx != 0 && shdr[hdr->e_shstrndx].sh_size != 0 &&
diff -r e9830dd2b423 -r fccf68597560 sys/sys/kobj.h
--- a/sys/sys/kobj.h    Mon Apr 26 20:10:23 2010 +0000
+++ b/sys/sys/kobj.h    Mon Apr 26 22:58:53 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kobj.h,v 1.13 2010/01/19 22:17:45 pooka Exp $  */
+/*     $NetBSD: kobj.h,v 1.14 2010/04/26 22:58:53 pooka Exp $  */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,6 +29,9 @@
 #ifndef _SYS_KOBJ_H_
 #define        _SYS_KOBJ_H_
 
+#define ELFSIZE ARCH_ELFSIZE
+#include <sys/exec_elf.h>
+
 typedef struct kobj *kobj_t;
 
 /* External interface. */
@@ -44,4 +47,7 @@
 int            kobj_reloc(kobj_t, uintptr_t, const void *, bool, bool);
 int            kobj_machdep(kobj_t, void *, size_t, bool);
 
+/* implementation interface. */
+int            kobj_renamespace(Elf_Sym *, size_t, char **, size_t *);
+
 #endif /* !_SYS_KOBJ_H_ */



Home | Main Index | Thread Index | Old Index