summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/kern_tc.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-16 10:28:03 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-16 13:35:26 +0100
commit4bf79afb665bfd9b71c49088afaf655b82186522 (patch)
treec77c5c4dff9e30846b59944c6f288ba8733f94e2 /cpukit/score/src/kern_tc.c
parentscore: Fix intenal mutex attributes (diff)
downloadrtems-4bf79afb665bfd9b71c49088afaf655b82186522.tar.bz2
timecounter: Avoid invalid memcpy()
In uni-processor configurations we have only one timehand. Do not issue a memcpy() with equal source and destination.
Diffstat (limited to 'cpukit/score/src/kern_tc.c')
-rw-r--r--cpukit/score/src/kern_tc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cpukit/score/src/kern_tc.c b/cpukit/score/src/kern_tc.c
index 316a16f05b..bd6ab045b1 100644
--- a/cpukit/score/src/kern_tc.c
+++ b/cpukit/score/src/kern_tc.c
@@ -1411,10 +1411,16 @@ tc_windup(void)
* the contents, the generation must be zero.
*/
tho = timehands;
+#if defined(RTEMS_SMP)
th = tho->th_next;
+#else
+ th = tho;
+#endif
ogen = th->th_generation;
tc_setgen(th, 0);
+#if defined(RTEMS_SMP)
bcopy(tho, th, offsetof(struct timehands, th_generation));
+#endif
/*
* Capture a timecounter delta on the current timecounter and if
@@ -1552,7 +1558,9 @@ tc_windup(void)
}
#endif
+#if defined(RTEMS_SMP)
timehands = th;
+#endif
#ifndef __rtems__
timekeep_push_vdso();
#endif /* __rtems__ */