1 #include <aros/bootloader.h>
2 #include <exec/execbase.h>
3 #include <exec/memory.h>
4 #include <proto/aros.h>
5 #include <proto/bootloader.h>
6 #include <proto/exec.h>
7 #include <proto/utility.h>
8 #include <proto/processor.h>
9 #include <resources/processor.h>
13 APTR ProcessorBase
= NULL
;
15 ULONG
ExtUDivMod32(ULONG a
, ULONG b
, ULONG
*mod
)
22 void PrintNum(ULONG num
)
37 num
= ExtUDivMod32(UMult32(num
, 100) >> 10, 100, &x
);
40 x
= ExtUDivMod32(x
, 10, &xx
);
51 printf("%d.%d %s", (int)num
, (int)x
, fmt
);
55 printf("%d K", (int)num
);
59 ULONG
ComputeKBytes(APTR a
, APTR b
)
63 return (ULONG
)(result
>> 10);
66 static ULONG
GetProcessorsCount()
69 struct TagItem tags
[] =
71 {GCIT_NumberOfProcessors
, (IPTR
)&count
},
84 } ProcessorArchitecture
[] =
86 { PROCESSORARCH_UNKNOWN
, "Unknown" },
87 { PROCESSORARCH_M68K
, "Motorola 68K" },
88 { PROCESSORARCH_PPC
, "PowerPC" },
89 { PROCESSORARCH_X86
, "X86" },
90 { PROCESSORARCH_ARM
, "ARM" },
98 } CurrentEndianness
[] =
100 { ENDIANNESS_UNKNOWN
, "Unknown" },
101 { ENDIANNESS_LE
, "LE" },
102 { ENDIANNESS_BE
, "BE" },
106 static VOID
PrintProcessorInformation()
108 ULONG count
= GetProcessorsCount();
110 CONST_STRPTR modelstring
;
111 ULONG architecture
, endianness
;
112 CONST_STRPTR architecturestring
= "", endiannessstring
= "";
115 for (i
= 0; i
< count
; i
++)
117 struct TagItem tags
[] =
119 {GCIT_SelectedProcessor
, i
},
120 {GCIT_ModelString
, (IPTR
)&modelstring
},
121 {GCIT_Architecture
, (IPTR
)&architecture
},
122 {GCIT_Endianness
, (IPTR
)&endianness
},
123 {GCIT_ProcessorSpeed
, (IPTR
)&cpuspeed
},
130 while(ProcessorArchitecture
[j
].Description
!= NULL
)
132 if (ProcessorArchitecture
[j
].Architecture
== architecture
)
134 architecturestring
= ProcessorArchitecture
[j
].Description
;
141 while(CurrentEndianness
[j
].Description
!= NULL
)
143 if (CurrentEndianness
[j
].Endianness
== endianness
)
145 endiannessstring
= CurrentEndianness
[j
].Description
;
152 printf("PROCESSOR %d:\t[%s/%s] %s", (int)(i
+ 1), architecturestring
, endiannessstring
, modelstring
);
154 printf(" (%llu Mhz)", (unsigned long long)(cpuspeed
/ 1000000));
160 char __stdiowin
[]="CON://800/400/ShowConfig/AUTO/CLOSE/WAIT";
164 struct MemHeader
*mh
;
170 ProcessorBase
= OpenResource(PROCESSORNAME
);
172 PrintProcessorInformation();
174 printf("VERS:\t\tAROS version %d.%d, Exec version %d.%d\n", ArosBase
->lib_Version
, ArosBase
->lib_Revision
,
175 SysBase
->LibNode
.lib_Version
, SysBase
->LibNode
.lib_Revision
);
178 for (mh
= (struct MemHeader
*)SysBase
->MemList
.lh_Head
; mh
->mh_Node
.ln_Succ
; mh
= (struct MemHeader
*)mh
->mh_Node
.ln_Succ
) {
179 char *memtype
= "ROM";
181 if (mh
->mh_Attributes
& MEMF_CHIP
)
183 if (mh
->mh_Attributes
& MEMF_FAST
)
185 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);
186 PrintNum(ComputeKBytes(mh
->mh_Lower
, mh
->mh_Upper
));
190 BootLoaderBase
= OpenResource("bootloader.resource");
191 if (BootLoaderBase
) {
192 bootldr
= GetBootInfo(BL_LoaderName
);
195 printf("BOOTLDR:\t%s\n", bootldr
);
197 args
= GetBootInfo(BL_Args
);
200 for (n
= args
->lh_Head
; n
->ln_Succ
; n
= n
->ln_Succ
) {
201 printf("%s ", n
->ln_Name
);