1 #include <aros/kernel.h>
2 #include <exec/execbase.h>
3 #include <exec/memory.h>
4 #include <resources/hpet.h>
5 #include <resources/processor.h>
7 #include <proto/aros.h>
8 #include <proto/hpet.h>
9 #include <proto/kernel.h>
10 #include <proto/exec.h>
11 #include <proto/utility.h>
12 #include <proto/processor.h>
16 #include "cpuspecific.h"
18 APTR ProcessorBase
= NULL
;
21 ULONG
ExtUDivMod32(ULONG a
, ULONG b
, ULONG
*mod
)
28 void PrintNum(ULONG num
)
43 num
= ExtUDivMod32(UMult32(num
, 100) >> 10, 100, &x
);
46 x
= ExtUDivMod32(x
, 10, &xx
);
57 printf("%d.%d %s", (int)num
, (int)x
, fmt
);
61 printf("%d K", (int)num
);
65 ULONG
ComputeKBytes(APTR a
, APTR b
)
69 return (ULONG
)(result
>> 10);
72 static ULONG
GetProcessorsCount()
75 struct TagItem tags
[] =
77 {GCIT_NumberOfProcessors
, (IPTR
)&count
},
90 } ProcessorArchitecture
[] =
92 { PROCESSORARCH_UNKNOWN
, "Unknown" },
93 { PROCESSORARCH_M68K
, "M68K" },
94 { PROCESSORARCH_PPC
, "PowerPC" },
95 { PROCESSORARCH_X86
, "X86" },
96 { PROCESSORARCH_ARM
, "ARM" },
104 } CurrentEndianness
[] =
106 { ENDIANNESS_UNKNOWN
, "Unknown" },
107 { ENDIANNESS_LE
, "LE" },
108 { ENDIANNESS_BE
, "BE" },
112 static VOID
PrintProcessorInformation()
114 ULONG count
= GetProcessorsCount();
116 CONST_STRPTR modelstring
;
117 ULONG architecture
, endianness
;
118 CONST_STRPTR architecturestring
= "", endiannessstring
= "";
121 for (i
= 0; i
< count
; i
++)
123 struct TagItem tags
[] =
125 {GCIT_SelectedProcessor
, i
},
126 {GCIT_ModelString
, (IPTR
)&modelstring
},
127 {GCIT_Architecture
, (IPTR
)&architecture
},
128 {GCIT_Endianness
, (IPTR
)&endianness
},
129 {GCIT_ProcessorSpeed
, (IPTR
)&cpuspeed
},
136 while(ProcessorArchitecture
[j
].Description
!= NULL
)
138 if (ProcessorArchitecture
[j
].Architecture
== architecture
)
140 architecturestring
= ProcessorArchitecture
[j
].Description
;
147 while(CurrentEndianness
[j
].Description
!= NULL
)
149 if (CurrentEndianness
[j
].Endianness
== endianness
)
151 endiannessstring
= CurrentEndianness
[j
].Description
;
158 modelstring
= "Unknown";
160 printf("PROCESSOR %d:\t[%s/%s] %s", (int)(i
+ 1), architecturestring
, endiannessstring
, modelstring
);
162 printf(" (%llu MHz)", (unsigned long long)(cpuspeed
/ 1000000));
165 PrintCPUSpecificInfo(i
, ProcessorBase
);
170 char __stdiowin
[]="CON://800/400/ShowConfig/AUTO/CLOSE/WAIT";
174 struct MemHeader
*mh
;
180 sprintf(&execextra
[1], "64bit/");
183 if (OpenResource("execlock.resource"))
185 sprintf(&execextra
[1 + offset
], "SMP Enabled ");
194 execextra
[offset
] = ']';
197 printf("VERS:\t\tAROS version %d.%d, Exec version %d.%d %s\n", ArosBase
->lib_Version
, ArosBase
->lib_Revision
,
198 SysBase
->LibNode
.lib_Version
, SysBase
->LibNode
.lib_Revision
, execextra
);
200 ProcessorBase
= OpenResource(PROCESSORNAME
);
202 PrintProcessorInformation();
204 HPETBase
= OpenResource("hpet.resource");
210 while (GetUnitAttrs(i
, HPET_UNIT_OWNER
, &owner
, TAG_DONE
))
213 owner
= "Available for use";
215 printf("HPET %u:\t\t%s\n", (unsigned)(++i
), owner
);
220 for (mh
= (struct MemHeader
*)SysBase
->MemList
.lh_Head
; mh
->mh_Node
.ln_Succ
; mh
= (struct MemHeader
*)mh
->mh_Node
.ln_Succ
) {
221 char *memtype
= "ROM";
223 if (mh
->mh_Attributes
& MEMF_CHIP
)
225 if (mh
->mh_Attributes
& MEMF_FAST
)
227 printf("\t\tNode Type 0x%X, Attributes 0x%X (%s), at $%p-$%p (", mh
->mh_Node
.ln_Type
, mh
->mh_Attributes
, memtype
, mh
->mh_Lower
, mh
->mh_Upper
- 1);
228 PrintNum(ComputeKBytes(mh
->mh_Lower
, mh
->mh_Upper
));
232 KernelBase
= OpenResource("kernel.resource");
235 struct TagItem
*bootinfo
= KrnGetBootInfo();
238 tag
= FindTagItem(KRN_BootLoader
, bootinfo
);
240 printf("BOOTLDR:\t%s\n", (char *)tag
->ti_Data
);
242 tag
= FindTagItem(KRN_CmdLine
, bootinfo
);
244 printf("ARGS:\t\t%s\n", (char *)tag
->ti_Data
);