summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-12-04 15:38:28 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-12-16 15:34:46 +0100
commit5084ad89e4690c1a375172c6a28c738530c5c4c2 (patch)
treeafe7848f223cba02c6ded9336fca0f90efc45694
parentAdd support for M68K (diff)
downloadrtems-libbsd-5084ad89e4690c1a375172c6a28c738530c5c4c2.tar.bz2
Simplify linker set handling
-rw-r--r--freebsd/sys/kern/init_main.c4
-rw-r--r--freebsd/sys/sys/kernel.h2
-rw-r--r--freebsd/sys/sys/linker_set.h31
-rw-r--r--rtemsbsd/rtems/rtems-bsd-init.c9
4 files changed, 37 insertions, 9 deletions
diff --git a/freebsd/sys/kern/init_main.c b/freebsd/sys/kern/init_main.c
index 40fcacbf..88f5f685 100644
--- a/freebsd/sys/kern/init_main.c
+++ b/freebsd/sys/kern/init_main.c
@@ -122,9 +122,7 @@ SYSINIT(placeholder, SI_SUB_DUMMY, SI_ORDER_ANY, NULL, NULL);
* The sysinit table itself. Items are checked off as the are run.
* If we want to register new sysinit types, add them to newsysinit.
*/
-#endif /* __rtems__ */
SET_DECLARE(sysinit_set, struct sysinit);
-#ifndef __rtems__
struct sysinit **sysinit, **sysinit_end;
struct sysinit **newsysinit, **newsysinit_end;
@@ -162,6 +160,8 @@ sysinit_add(struct sysinit **set, struct sysinit **set_end)
newsysinit = newset;
newsysinit_end = newset + count;
}
+#else /* __rtems__ */
+RWSET_DECLARE(sysinit_set, struct sysinit);
#endif /* __rtems__ */
#if defined (DDB) && defined(VERBOSE_SYSINIT)
diff --git a/freebsd/sys/sys/kernel.h b/freebsd/sys/sys/kernel.h
index e276f8ee..c3e83022 100644
--- a/freebsd/sys/sys/kernel.h
+++ b/freebsd/sys/sys/kernel.h
@@ -255,7 +255,7 @@ struct sysinit {
func, \
(ident) \
}; \
- DATA_SET(sysinit_set,SYSINIT_ENTRY_NAME(uniquifier))
+ RWDATA_SET(sysinit_set,SYSINIT_ENTRY_NAME(uniquifier))
#define SYSINIT_REFERENCE(uniquifier) \
extern struct sysinit SYSINIT_ENTRY_NAME(uniquifier); \
static struct sysinit const * const \
diff --git a/freebsd/sys/sys/linker_set.h b/freebsd/sys/sys/linker_set.h
index b915302f..47957816 100644
--- a/freebsd/sys/sys/linker_set.h
+++ b/freebsd/sys/sys/linker_set.h
@@ -51,9 +51,25 @@
static void const * const __set_##set##_sym_##sym \
__section("set_" #set) __used = &sym
#else /* __rtems__ */
+#define RTEMS_BSD_DEFINE_SET(set, ptype) \
+ ptype * const __CONCAT(_bsd__start_set_,set)[0] \
+ __section(".rtemsroset.bsd." __STRING(set) ".begin") __used; \
+ ptype * const __CONCAT(_bsd__stop_set_,set)[0] \
+ __section(".rtemsroset.bsd." __STRING(set) ".end") __used
+
#define __MAKE_SET(set, sym) \
- static void const * const __set_##set##_sym_##sym \
- __section("_bsd_set_" #set) __used = &sym
+ static const void * const __set_##set##_sym_##sym \
+ __section(".rtemsroset.bsd." __STRING(set) ".content") __used = &sym
+
+#define RTEMS_BSD_DEFINE_RWSET(set, ptype) \
+ ptype *__CONCAT(_bsd__start_set_,set)[0] \
+ __section(".rtemsrwset.bsd." __STRING(set) ".begin") __used; \
+ ptype *__CONCAT(_bsd__stop_set_,set)[0] \
+ __section(".rtemsrwset.bsd." __STRING(set) ".end") __used
+
+#define __MAKE_RWSET(set, sym) \
+ static const void * __set_##set##_sym_##sym \
+ __section(".rtemsrwset.bsd." __STRING(set) ".content") __used = &sym
#endif /* __rtems__ */
#else /* !__GNUCLIKE___SECTION */
#ifndef lint
@@ -70,6 +86,9 @@
#define BSS_SET(set, sym) __MAKE_SET(set, sym)
#define ABS_SET(set, sym) __MAKE_SET(set, sym)
#define SET_ENTRY(set, sym) __MAKE_SET(set, sym)
+#ifdef __rtems__
+#define RWDATA_SET(set, sym) __MAKE_RWSET(set, sym)
+#endif /* __rtems__ */
/*
* Initialize before referring to a given linker set.
@@ -85,8 +104,12 @@
(&__CONCAT(__stop_set_,set))
#else /* __rtems__ */
#define SET_DECLARE(set, ptype) \
- extern ptype *__CONCAT(_bsd__start_set_,set) []; \
- extern ptype *__CONCAT(_bsd__stop_set_,set) []
+ extern ptype * const __CONCAT(_bsd__start_set_,set)[]; \
+ extern ptype * const __CONCAT(_bsd__stop_set_,set)[]
+
+#define RWSET_DECLARE(set, ptype) \
+ extern ptype *__CONCAT(_bsd__start_set_,set)[]; \
+ extern ptype *__CONCAT(_bsd__stop_set_,set)[]
#define SET_BEGIN(set) \
(__CONCAT(_bsd__start_set_,set))
diff --git a/rtemsbsd/rtems/rtems-bsd-init.c b/rtemsbsd/rtems/rtems-bsd-init.c
index 613cab3d..ed462655 100644
--- a/rtemsbsd/rtems/rtems-bsd-init.c
+++ b/rtemsbsd/rtems/rtems-bsd-init.c
@@ -7,10 +7,10 @@
*/
/*
- * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2009-2013 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
- * Obere Lagerstr. 30
+ * Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
@@ -57,6 +57,11 @@ SYSINIT_REFERENCE(linker_kernel);
SYSINIT_MODULE_REFERENCE(rootbus);
SYSINIT_DRIVER_REFERENCE(nexus, root);
+RTEMS_BSD_DEFINE_SET(modmetadata_set, struct mod_metadata);
+RTEMS_BSD_DEFINE_SET(sysctl_set, struct sysctl_oid);
+
+RTEMS_BSD_DEFINE_RWSET(sysinit_set, struct sysinit);
+
/* In FreeBSD this is a local function */
void mi_startup(void);