We shouldn't trust the TOS, but for now use the cookie jar to find the cpu type and if it has lpstop.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23461 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
416458e9c4
commit
89f97fe903
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "cpu.h"
|
#include "cpu.h"
|
||||||
|
#include "toscalls.h"
|
||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <boot/platform.h>
|
#include <boot/platform.h>
|
||||||
@ -28,16 +29,23 @@
|
|||||||
# define TRACE(x) ;
|
# define TRACE(x) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool gCpuHasLPSTOP = false;
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
check_cpu_features()
|
check_cpu_features()
|
||||||
{
|
{
|
||||||
#warning M68K: check for LPSTOP
|
#warning M68K: TODO: probe ourselves, we shouldn't trust the TOS!
|
||||||
if (false)
|
|
||||||
gCpuHasLPSTOP = true;
|
|
||||||
|
|
||||||
#warning M68K: check for >= 020
|
const tos_cookie *c = tos_find_cookie('_CPU');
|
||||||
|
if (!c) {
|
||||||
|
panic("can't get a cookie (_CPU)! Mum, I'm hungry!");
|
||||||
|
return EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
#warning M68K: check for 020 + mmu
|
||||||
|
if (c->ivalue < 30/*20*/)
|
||||||
|
return EINVAL;
|
||||||
|
|
||||||
|
gKernelArgs.arch_args.has_lpstop = (c->ivalue >= 60)?true:false;
|
||||||
|
#warning M68K: add cpu type to kern args
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@ -50,13 +58,8 @@ extern "C" void
|
|||||||
spin(bigtime_t microseconds)
|
spin(bigtime_t microseconds)
|
||||||
{
|
{
|
||||||
bigtime_t time = system_time();
|
bigtime_t time = system_time();
|
||||||
if (gCpuHasLPSTOP) {
|
while ((system_time() - time) < microseconds)
|
||||||
while ((system_time() - time) < microseconds)
|
asm volatile ("nop;");
|
||||||
asm volatile ("nop;");//asm volatile ("lpstop;");
|
|
||||||
} else {
|
|
||||||
while ((system_time() - time) < microseconds)
|
|
||||||
asm volatile ("nop;");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user