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
;
20 ULONG
ExtUDivMod32(ULONG a
, ULONG b
, ULONG
*mod
)
27 void PrintNum(ULONG num
)
42 num
= ExtUDivMod32(UMult32(num
, 100) >> 10, 100, &x
);
45 x
= ExtUDivMod32(x
, 10, &xx
);
56 printf("%d.%d %s", (int)num
, (int)x
, fmt
);
60 printf("%d K", (int)num
);
64 ULONG
ComputeKBytes(APTR a
, APTR b
)
68 return (ULONG
)(result
>> 10);
71 static ULONG
GetProcessorsCount()
74 struct TagItem tags
[] =
76 {GCIT_NumberOfProcessors
, (IPTR
)&count
},
89 } ProcessorArchitecture
[] =
91 { PROCESSORARCH_UNKNOWN
, "Unknown" },
92 { PROCESSORARCH_M68K
, "Motorola 68K" },
93 { PROCESSORARCH_PPC
, "PowerPC" },
94 { PROCESSORARCH_X86
, "X86" },
95 { PROCESSORARCH_ARM
, "ARM" },
103 } CurrentEndianness
[] =
105 { ENDIANNESS_UNKNOWN
, "Unknown" },
106 { ENDIANNESS_LE
, "LE" },
107 { ENDIANNESS_BE
, "BE" },
111 static VOID
PrintProcessorInformation()
113 ULONG count
= GetProcessorsCount();
115 CONST_STRPTR modelstring
;
116 ULONG architecture
, endianness
;
117 CONST_STRPTR architecturestring
= "", endiannessstring
= "";
120 for (i
= 0; i
< count
; i
++)
122 struct TagItem tags
[] =
124 {GCIT_SelectedProcessor
, i
},
125 {GCIT_ModelString
, (IPTR
)&modelstring
},
126 {GCIT_Architecture
, (IPTR
)&architecture
},
127 {GCIT_Endianness
, (IPTR
)&endianness
},
128 {GCIT_ProcessorSpeed
, (IPTR
)&cpuspeed
},
135 while(ProcessorArchitecture
[j
].Description
!= NULL
)
137 if (ProcessorArchitecture
[j
].Architecture
== architecture
)
139 architecturestring
= ProcessorArchitecture
[j
].Description
;
146 while(CurrentEndianness
[j
].Description
!= NULL
)
148 if (CurrentEndianness
[j
].Endianness
== endianness
)
150 endiannessstring
= CurrentEndianness
[j
].Description
;
157 modelstring
= "Unknown";
159 printf("PROCESSOR %d:\t[%s/%s] %s", (int)(i
+ 1), architecturestring
, endiannessstring
, modelstring
);
161 printf(" (%llu MHz)", (unsigned long long)(cpuspeed
/ 1000000));
164 PrintCPUSpecificInfo(i
, ProcessorBase
);
169 char __stdiowin
[]="CON://800/400/ShowConfig/AUTO/CLOSE/WAIT";
173 struct MemHeader
*mh
;
177 printf("VERS:\t\tAROS version %d.%d, Exec version %d.%d\n", ArosBase
->lib_Version
, ArosBase
->lib_Revision
,
178 SysBase
->LibNode
.lib_Version
, SysBase
->LibNode
.lib_Revision
);
180 ProcessorBase
= OpenResource(PROCESSORNAME
);
182 PrintProcessorInformation();
184 HPETBase
= OpenResource("hpet.resource");
190 while (GetUnitAttrs(i
, HPET_UNIT_OWNER
, &owner
, TAG_DONE
))
193 owner
= "Available for use";
195 printf("HPET %u:\t\t%s\n", (unsigned)(++i
), owner
);
200 for (mh
= (struct MemHeader
*)SysBase
->MemList
.lh_Head
; mh
->mh_Node
.ln_Succ
; mh
= (struct MemHeader
*)mh
->mh_Node
.ln_Succ
) {
201 char *memtype
= "ROM";
203 if (mh
->mh_Attributes
& MEMF_CHIP
)
205 if (mh
->mh_Attributes
& MEMF_FAST
)
207 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);
208 PrintNum(ComputeKBytes(mh
->mh_Lower
, mh
->mh_Upper
));
212 KernelBase
= OpenResource("kernel.resource");
215 struct TagItem
*bootinfo
= KrnGetBootInfo();
218 tag
= FindTagItem(KRN_BootLoader
, bootinfo
);
220 printf("BOOTLDR:\t%s\n", (char *)tag
->ti_Data
);
222 tag
= FindTagItem(KRN_CmdLine
, bootinfo
);
224 printf("ARGS:\t\t%s\n", (char *)tag
->ti_Data
);