diff options
author | benno <benno@FreeBSD.org> | 2003-02-05 11:26:14 +0000 |
---|---|---|
committer | benno <benno@FreeBSD.org> | 2003-02-05 11:26:14 +0000 |
commit | 966bb12f6e7ff8075e0fbeca5b8e0c7f6ac501c7 (patch) | |
tree | 0f893948c3d173d77ab647e53c67fa81524ec23e /sys/powerpc | |
parent | 53ee945def248d5dc6271513ea65d8cbea225e2f (diff) | |
download | FreeBSD-src-966bb12f6e7ff8075e0fbeca5b8e0c7f6ac501c7.zip FreeBSD-src-966bb12f6e7ff8075e0fbeca5b8e0c7f6ac501c7.tar.gz |
Replace the inline asm in delay() with a while loop. This may not be as
efficient but it appears to actually work. Some investigation may be
required.
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/aim/clock.c | 12 | ||||
-rw-r--r-- | sys/powerpc/powerpc/clock.c | 12 |
2 files changed, 8 insertions, 16 deletions
diff --git a/sys/powerpc/aim/clock.c b/sys/powerpc/aim/clock.c index 073f9eb..867b8dd 100644 --- a/sys/powerpc/aim/clock.c +++ b/sys/powerpc/aim/clock.c @@ -310,16 +310,12 @@ decr_get_timecount(struct timecounter *tc) void delay(int n) { - u_quad_t tb; - u_long tbh, tbl, scratch; + u_quad_t tb, ttb; tb = mftb(); - tb += (n * 1000 + ns_per_tick - 1) / ns_per_tick; - tbh = tb >> 32; - tbl = tb; - __asm ("1: mftbu %0; cmplw %0,%1; blt 1b; bgt 2f;" - "mftb %0; cmplw %0,%2; blt 1b; 2:" - : "=r"(scratch) : "r"(tbh), "r"(tbl)); + ttb = tb + (n * 1000 + ns_per_tick - 1) / ns_per_tick; + while (tb < ttb) + tb = mftb(); } /* diff --git a/sys/powerpc/powerpc/clock.c b/sys/powerpc/powerpc/clock.c index 073f9eb..867b8dd 100644 --- a/sys/powerpc/powerpc/clock.c +++ b/sys/powerpc/powerpc/clock.c @@ -310,16 +310,12 @@ decr_get_timecount(struct timecounter *tc) void delay(int n) { - u_quad_t tb; - u_long tbh, tbl, scratch; + u_quad_t tb, ttb; tb = mftb(); - tb += (n * 1000 + ns_per_tick - 1) / ns_per_tick; - tbh = tb >> 32; - tbl = tb; - __asm ("1: mftbu %0; cmplw %0,%1; blt 1b; bgt 2f;" - "mftb %0; cmplw %0,%2; blt 1b; 2:" - : "=r"(scratch) : "r"(tbh), "r"(tbl)); + ttb = tb + (n * 1000 + ns_per_tick - 1) / ns_per_tick; + while (tb < ttb) + tb = mftb(); } /* |