Author: stepan Date: Thu Mar 25 19:53:20 2010 New Revision: 5292 URL: https://tracker.coreboot.org/trac/coreboot/changeset/5292
Log: prevent timer overflows in libpayload
Signed-off-by: Stefan Reinauer stepan@coresystems.de Acked-by: Patrick Georgi patrick.georgi@coresystems.de
Modified: trunk/payloads/libpayload/arch/i386/timer.c
Modified: trunk/payloads/libpayload/arch/i386/timer.c ============================================================================== --- trunk/payloads/libpayload/arch/i386/timer.c Thu Mar 25 19:52:24 2010 (r5291) +++ trunk/payloads/libpayload/arch/i386/timer.c Thu Mar 25 19:53:20 2010 (r5292) @@ -88,7 +88,7 @@ */ void ndelay(unsigned int n) { - _delay(n * cpu_khz / 1000000); + _delay((unsigned long long)n * cpu_khz / 1000000); }
/** @@ -98,7 +98,7 @@ */ void udelay(unsigned int n) { - _delay(n * cpu_khz / 1000); + _delay((unsigned long long)n * cpu_khz / 1000); }
/** @@ -108,7 +108,7 @@ */ void mdelay(unsigned int m) { - _delay(m * cpu_khz); + _delay((unsigned long long)m * cpu_khz); }
/** @@ -118,5 +118,7 @@ */ void delay(unsigned int s) { - _delay(s * cpu_khz * 1000); + int i; + for (i=0; i<1000; i++) + _delay((unsigned long long)s * cpu_khz); }