From c2ae597a496a66466fb1cd1fb02d5d450e3b06a8 Mon Sep 17 00:00:00 2001 From: Marc Espie Date: Sun, 31 Jan 1999 14:56:02 +0000 Subject: Fix clobbers so that GENERIC may compile with egcs. Historically, the documentation of extended asm was lacking, namely you should NOT specify the same register as an input, and a clobber. If the register is clobbered, it should be specified as an output as well, e.g., by linking input and output through the "number" notation. (Beware of lvalues, some local variables needed...) In older versions, up-to egcs1.1.1, the compiler did not even warn about it, but it was liable to output bad code. Newer egcs are pickier and simply refuse to swallow such code. --- sys/arch/i386/isa/clock.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'sys/arch/i386/isa') diff --git a/sys/arch/i386/isa/clock.c b/sys/arch/i386/isa/clock.c index 4c1beee01f6..12cc6bdf252 100644 --- a/sys/arch/i386/isa/clock.c +++ b/sys/arch/i386/isa/clock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clock.c,v 1.18 1999/01/13 07:26:00 niklas Exp $ */ +/* $OpenBSD: clock.c,v 1.19 1999/01/31 14:56:01 espie Exp $ */ /* $NetBSD: clock.c,v 1.39 1996/05/12 23:11:54 mycroft Exp $ */ /*- @@ -262,14 +262,10 @@ delay(n) n -= 5; if (n < 0) return; - {register int m; - __asm __volatile("mul %3" - : "=a" (n), "=d" (m) - : "0" (n), "r" (TIMER_FREQ)); - __asm __volatile("div %3" - : "=a" (n) - : "0" (n), "d" (m), "r" (1000000) - : "%edx");} + __asm __volatile("mul %2\n\tdiv %3" + : "=a" (n) + : "0" (n), "r" (TIMER_FREQ), "r" (1000000) + : "%edx", "cc"); #else /* * Calculate ((n * TIMER_FREQ) / 1e6) without using floating point and -- cgit v1.2.3