xref: /haiku/src/system/boot/platform/amiga_m68k/cpu.cpp (revision 675ffabd70492a962f8c0288a32208c22ce5de18)
1 /*
2  * Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * calculate_cpu_conversion_factor() was written by Travis Geiselbrecht and
6  * licensed under the NewOS license.
7  */
8 
9 
10 #include "cpu.h"
11 #include "rom_calls.h"
12 
13 #include <OS.h>
14 #include <boot/platform.h>
15 #include <boot/stdio.h>
16 #include <boot/kernel_args.h>
17 #include <boot/stage2.h>
18 #include <arch/cpu.h>
19 #include <arch_kernel.h>
20 #include <arch_platform.h>
21 #include <arch_system_info.h>
22 
23 #include <string.h>
24 
25 
26 //#define TRACE_CPU
27 #ifdef TRACE_CPU
28 #	define TRACE(x) dprintf x
29 #else
30 #	define TRACE(x) ;
31 #endif
32 
33 #warning M68K: add set_vbr()
34 
35 
36 static status_t
37 check_cpu_features()
38 {
39 	//TODO
40 	return B_ERROR;
41 }
42 
43 #warning M68K: move and implement system_time()
44 static bigtime_t gSystemTimeCounter = 0; //HACK
45 extern "C" bigtime_t
46 system_time(void)
47 {
48 	return gSystemTimeCounter++;
49 }
50 
51 
52 //	#pragma mark -
53 
54 
55 extern "C" void
56 spin(bigtime_t microseconds)
57 {
58 	bigtime_t time = system_time();
59 	while ((system_time() - time) < microseconds)
60 		asm volatile ("nop;");
61 }
62 
63 
64 extern "C" void
65 cpu_init()
66 {
67 	if (check_cpu_features() != B_OK)
68 		panic("You need a 68020 or higher in order to boot!\n");
69 
70 	gKernelArgs.num_cpus = 1;
71 		// this will eventually be corrected later on
72 		// ...or not!
73 }
74 
75