1 ; System Information Program (v1.0, July 6 2010)
2 ; Written by Ian Seyler
5 ; nasm sysinfo.asm -o sysinfo.app
9 [ORG 0x0000000000200000]
13 start: ; Start of program label
15 mov rsi
, startmessage
; Load RSI with memory address of string
16 call b_print_string
; Print the string that RSI points to
18 ;Get processor brand string
49 stosb ; Terminate the string
83 ; L1 code/data cache info
85 mov eax, 0x80000005 ; L1 cache info
87 mov eax, edx ; EDX bits 31 - 24 store code L1 cache size in KBs
98 mov eax, ecx ; ECX bits 31 - 24 store data L1 cache size in KBs
111 mov eax, 0x80000006 ; L2/L3 cache info
113 mov eax, ecx ; ecx bits 31 - 16 store unified L2 cache size in KBs
125 mov eax, edx ; edx bits 31 - 18 store unified L3 cache size in 512 KB chunks
127 and eax, 0x3FFFF ; Clear bits 18 - 31
128 shl eax, 9 ; Convert the value for 512 KB chunks to KBs (Multiply by 512)
146 test edx, 00000010000000000000000000000000b
152 test edx, 00000100000000000000000000000000b
158 test ecx, 00000000000000000000000000000001b
164 test ecx, 00000000000000000000001000000000b
170 test ecx, 00000000000010000000000000000000b
176 test ecx, 00000000000100000000000000000000b
182 test ecx, 00000010000000000000000000000000b
188 test ecx, 00010000000000000000000000000000b
213 startmessage: db 'System Information:', 13, 0
214 cpustringmsg: db 'CPU String: ', 0
215 numcoresmsg: db 'Number of cores: ', 0
216 speedmsg: db 'Detected speed: ', 0
217 l1ccachemsg: db 'L1 code cache: ', 0
218 l1dcachemsg: db 'L1 data cache: ', 0
219 l2ucachemsg: db 'L2 unified cache: ', 0
220 l3ucachemsg: db 'L3 unified cache: ', 0
221 cpufeatures: db 'CPU features: ', 0
228 ssse3: db 'SSSE3 ', 0
229 sse41: db 'SSE4.1 ', 0
230 sse42: db 'SSE4.2 ', 0
233 memmessage: db 'RAM: ', 0
235 tstring: times
50 db 0