[rtems-libbsd commit] Use signed integer type for ticks
Sebastian Huber
sebh at rtems.org
Wed Apr 8 05:59:23 UTC 2015
Module: rtems-libbsd
Branch: master
Commit: c6e85efd7ee837afe9d40bbb620af4afb730e77e
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=c6e85efd7ee837afe9d40bbb620af4afb730e77e
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Wed Apr 8 07:52:14 2015 +0200
Use signed integer type for ticks
---
freebsd/sys/sys/kernel.h | 8 ++++++--
rtemsbsd/rtems/rtems-bsd-init.c | 7 +++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/freebsd/sys/sys/kernel.h b/freebsd/sys/sys/kernel.h
index c739cd5..687ee53 100644
--- a/freebsd/sys/sys/kernel.h
+++ b/freebsd/sys/sys/kernel.h
@@ -68,8 +68,12 @@ extern int profprocs; /* number of process's profiling */
#ifndef __rtems__
extern volatile int ticks;
#else /* __rtems__ */
-#include <rtems/score/watchdogimpl.h>
-#define ticks _Watchdog_Ticks_since_boot
+/*
+ * This must be a singed integer type, otherwise expressions like
+ * (x - ticks) > 0 would yield unexpected results.
+ */
+extern volatile int32_t _bsd_ticks;
+#define ticks _bsd_ticks
#endif /* __rtems__ */
#endif /* _KERNEL */
diff --git a/rtemsbsd/rtems/rtems-bsd-init.c b/rtemsbsd/rtems/rtems-bsd-init.c
index f7fcd27..fefcee3 100644
--- a/rtemsbsd/rtems/rtems-bsd-init.c
+++ b/rtemsbsd/rtems/rtems-bsd-init.c
@@ -85,6 +85,13 @@ SYSCTL_INT(_kern_smp, OID_AUTO, maxid, CTLFLAG_RD|CTLFLAG_CAPRD,
SYSCTL_INT(_kern_smp, OID_AUTO, maxcpus, CTLFLAG_RD|CTLFLAG_CAPRD,
&maxid_maxcpus, 0, "Max number of CPUs that the system was compiled for.");
+RTEMS_STATIC_ASSERT(sizeof(int) == sizeof(int32_t), ticks);
+
+volatile uint32_t _Watchdog_Ticks_since_boot;
+
+extern volatile int32_t _bsd_ticks
+ __attribute__ ((__alias__("_Watchdog_Ticks_since_boot")));
+
rtems_status_code
rtems_bsd_initialize(void)
{
More information about the vc
mailing list