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

[Xen-changelog] [linux-2.6.18-xen] xen: Do not allow gcc-3.4 to turn loop on a 64-bit variable into



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1211385877 -3600
# Node ID 446c39a967fc0904e2d27ca876c671b414fb5917
# Parent  1e8c3287b395f53d91c5e1951325563b5942d2c0
xen: Do not allow gcc-3.4 to turn loop on a 64-bit variable into
64-bit division, which the kernel does not support.

Signed-off-by: Guillaume Rousse <guillaume.rousse@xxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 arch/i386/kernel/time-xen.c |    8 ++++++++
 1 files changed, 8 insertions(+)

diff -r 1e8c3287b395 -r 446c39a967fc arch/i386/kernel/time-xen.c
--- a/arch/i386/kernel/time-xen.c       Wed May 21 11:11:00 2008 +0100
+++ b/arch/i386/kernel/time-xen.c       Wed May 21 17:04:37 2008 +0100
@@ -137,13 +137,21 @@ static void __clock_was_set(void *unused
 }
 static DECLARE_WORK(clock_was_set_work, __clock_was_set, NULL);
 
+/*
+ * GCC 4.3 can turn loops over an induction variable into division. We do
+ * not support arbitrary 64-bit division, and so must break the induction.
+ */
+#define clobber_induction_variable(v) asm ( "" : "+r" (v) )
+
 static inline void __normalize_time(time_t *sec, s64 *nsec)
 {
        while (*nsec >= NSEC_PER_SEC) {
+               clobber_induction_variable(*nsec);
                (*nsec) -= NSEC_PER_SEC;
                (*sec)++;
        }
        while (*nsec < 0) {
+               clobber_induction_variable(*nsec);
                (*nsec) += NSEC_PER_SEC;
                (*sec)--;
        }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.