2 Copyright © 2011, The AROS Development Team. All rights reserved.
6 #include <exec/rawfmt.h>
7 #include <proto/exec.h>
9 #include <aros/symbolsets.h>
11 #include "processor_intern.h"
12 #include "processor_arch_intern.h"
14 static VOID
__sprintf(UBYTE
*buffer
, const UBYTE
*format
, ...)
18 va_start(args
, format
);
19 VNewRawDoFmt(format
, RAWFMTFUNC_STRING
, buffer
, args
);
23 static VOID
ReadProcessorInformation(struct M68KProcessorInformation
* info
)
26 __sprintf(info
->ModelStringBuffer
, "%s", "Unknown");
27 info
->ModelString
= info
->ModelStringBuffer
;
29 info
->CPUModel
= CPUMODEL_UNKNOWN
;
30 info
->FPUModel
= FPUMODEL_UNKNOWN
;
31 info
->L1InstructionCacheSize
= 0;
32 info
->L1DataCacheSize
= 0;
34 if (SysBase
->AttnFlags
& AFF_68060
)
36 info
->CPUModel
= CPUMODEL_68060
;
37 __sprintf(info
->ModelStringBuffer
, "%s", "68060");
38 info
->L1InstructionCacheSize
= 8192;
39 info
->L1DataCacheSize
= 8192;
41 else if (SysBase
->AttnFlags
& AFF_68040
)
43 info
->CPUModel
= CPUMODEL_68040
;
44 __sprintf(info
->ModelStringBuffer
, "%s", "68040");
45 info
->L1InstructionCacheSize
= 4096;
46 info
->L1DataCacheSize
= 4096;
48 else if (SysBase
->AttnFlags
& AFF_68030
)
50 info
->CPUModel
= CPUMODEL_68030
;
51 __sprintf(info
->ModelStringBuffer
, "%s", "68030");
52 info
->L1InstructionCacheSize
= 256;
53 info
->L1DataCacheSize
= 256;
55 else if (SysBase
->AttnFlags
& AFF_68020
)
57 info
->CPUModel
= CPUMODEL_68020
;
58 __sprintf(info
->ModelStringBuffer
, "%s", "68020");
59 info
->L1InstructionCacheSize
= 256;
61 else if (SysBase
->AttnFlags
& AFF_68010
)
63 info
->CPUModel
= CPUMODEL_68010
;
64 __sprintf(info
->ModelStringBuffer
, "%s", "68010");
68 info
->CPUModel
= CPUMODEL_68000
;
69 __sprintf(info
->ModelStringBuffer
, "%s", "68000");
72 if (SysBase
->AttnFlags
& AFF_FPU40
) {
73 if (SysBase
->AttnFlags
& AFF_68060
)
75 info
->FPUModel
= FPUMODEL_INTERNAL
;
76 __sprintf(info
->ModelStringBuffer
+ 5, "%s", " + FPU");
78 else if (SysBase
->AttnFlags
& AFF_68040
)
80 info
->FPUModel
= FPUMODEL_INTERNAL
;
81 __sprintf(info
->ModelStringBuffer
+ 5, "%s", " + FPU");
84 info
->FPUModel
= FPUMODEL_NONE
;
86 else if (SysBase
->AttnFlags
& AFF_68882
)
88 info
->FPUModel
= FPUMODEL_68882
;
89 __sprintf(info
->ModelStringBuffer
+ 5, "%s", " + 68882");
91 else if (SysBase
->AttnFlags
& AFF_68881
)
93 info
->FPUModel
= FPUMODEL_68881
;
94 __sprintf(info
->ModelStringBuffer
+ 5, "%s", " + 68881");
97 info
->FPUModel
= FPUMODEL_NONE
;
99 info
->CPUFrequency
= 0; /* TODO: Implement */
102 LONG
Processor_Init(struct ProcessorBase
* ProcessorBase
)
104 struct SystemProcessors
* sysprocs
=
105 AllocVec(sizeof(struct SystemProcessors
), MEMF_ANY
| MEMF_CLEAR
);
107 if (sysprocs
== NULL
)
110 ProcessorBase
->Private1
= sysprocs
;
112 ReadProcessorInformation(&sysprocs
->processor
);
117 ADD2INITLIB(Processor_Init
, 1);