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.
This commit is contained in:
parent
8bc7bc1ea0
commit
4a95ae9a68
@ -310,16 +310,12 @@ decr_get_timecount(struct timecounter *tc)
|
|||||||
void
|
void
|
||||||
delay(int n)
|
delay(int n)
|
||||||
{
|
{
|
||||||
u_quad_t tb;
|
u_quad_t tb, ttb;
|
||||||
u_long tbh, tbl, scratch;
|
|
||||||
|
|
||||||
tb = mftb();
|
tb = mftb();
|
||||||
tb += (n * 1000 + ns_per_tick - 1) / ns_per_tick;
|
ttb = tb + (n * 1000 + ns_per_tick - 1) / ns_per_tick;
|
||||||
tbh = tb >> 32;
|
while (tb < ttb)
|
||||||
tbl = tb;
|
tb = mftb();
|
||||||
__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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -310,16 +310,12 @@ decr_get_timecount(struct timecounter *tc)
|
|||||||
void
|
void
|
||||||
delay(int n)
|
delay(int n)
|
||||||
{
|
{
|
||||||
u_quad_t tb;
|
u_quad_t tb, ttb;
|
||||||
u_long tbh, tbl, scratch;
|
|
||||||
|
|
||||||
tb = mftb();
|
tb = mftb();
|
||||||
tb += (n * 1000 + ns_per_tick - 1) / ns_per_tick;
|
ttb = tb + (n * 1000 + ns_per_tick - 1) / ns_per_tick;
|
||||||
tbh = tb >> 32;
|
while (tb < ttb)
|
||||||
tbl = tb;
|
tb = mftb();
|
||||||
__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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user