[email protected] said:
> On 06/03/15 15:04, Martin Lucina wrote:
> >+RUMP_COMPONENT(RUMP_COMPONENT_KERN)
> >+{
> >+ tc_init(&rumpxen_tc);
> >+}
>
> It would be better to use MODULE().
Okay, so I can do something like this, however then I don't know what to do
with the result (see below):
--- /dev/null
+++ b/platform/xen/rumpxentc/Makefile
@@ -0,0 +1,6 @@
+KMOD= rumpxen_tc
+SRCS= rumpxen_tc.c
+
+CPPFLAGS+= -I${.CURDIR}/../xen/include -I${.CURDIR}/../rump/include
+
+.include <bsd.kmodule.mk>
diff --git a/platform/xen/rumpxentc/rumpxen_tc.c
b/platform/xen/rumpxentc/rumpxen_tc.c
new file mode 100644
index 0000000..15d86a4
--- /dev/null
+++ b/platform/xen/rumpxentc/rumpxen_tc.c
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2015 Martin Lucina. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#include <sys/param.h>
+#include <sys/cpu.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/timetc.h>
+
+#include <mini-os/time.h>
+
+MODULE(MODULE_CLASS_MISC, rumpxen_tc, NULL);
+
+static u_int
+rumpxen_tc_get(struct timecounter *tc)
+{
+ return (u_int)minios_clock_monotonic();
+}
+
+static struct timecounter rumpxen_tc = {
+ .tc_get_timecount = rumpxen_tc_get,
+ .tc_poll_pps = NULL,
+ .tc_counter_mask = ~0,
+ .tc_frequency = 1000000000ULL,
+ .tc_name = "rumpxen",
+ .tc_quality = 100,
+};
+
+static int
+rumpxen_tc_modcmd(modcmd_t cmd, void *arg)
+{
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ tc_init(&rumpxen_tc);
+ break;
+
+ case MODULE_CMD_FINI:
+ tc_detach(&rumpxen_tc);
+ break;
+
+ default:
+ return ENOTTY;
+ }
+ return 0;
+}
If I build this using "makekernlib" then I am left with a .kmod and bunch
of stuff in a long set of paths under rumpobj/rumpxentc, but no actual
librumpxen_tc.a I can use in a link set:
rumpobj/rumpxentc
rumpobj/rumpxentc/home
rumpobj/rumpxentc/home/mato
rumpobj/rumpxentc/home/mato/projects
rumpobj/rumpxentc/home/mato/projects/rumpkernel
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform/xen
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform/xen/rumpxentc
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform/xen/rumpxentc/rumpxen_tc.d
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform/xen/rumpxentc/.depend
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform/xen/rumpxentc/rumpxen_tc.o
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform/xen/rumpxentc/rumpxen_tc.kmod.map
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform/xen/rumpxentc/rumpxen_tc.kmod
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform/xen/rumpxentc/machine
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform/xen/rumpxentc/amd64
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform/xen/rumpxentc/i386
rumpobj/rumpxentc/home/mato/projects/rumpkernel/rumprun/platform/xen/rumpxentc/x86
Now what?
-mato