;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; High MSR Display Program ;; ;; -- dumps Model-Specific Registers 80000000h to 8000001Fh ;; ;; to standard output ;; ;; (Note: will crash on non-Intel CPUs or future Pentia ;; ;; without access to high MSRs) ;; ;; ;; ;; Public Domain 1995 Ralf Brown ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; .title High MSR Display Program .386 code segment 'code' use16 assume cs:code,ds:code,es:nothing,ss:nothing org 100h dumpmsr proc near mov ecx,80000000h ; start showing MSRs at 80000000h dump_loop: call dump_one_msr ; display the value of MSR # ECX mov al,9 ; separate the columns between call putc ; the first 16 and last 16 mov al,9 ; MSR with two tabs call putc add cx,10h ; switch to second column call dump_one_msr ; and display the appropriate MSR mov al,13 ; output a carriage return call putc mov al,10 ; output a line feed to complete call putc ; the newline operation sub cx,0fh ; advance to next MSR (-10h + 01h) cmp cx,10h ; quit after 16 lines displayed jb dump_loop int 20h ; exit program dumpmsr endp dump_one_msr proc near mov eax,ecx ; show MSR number call dword_to_string mov al,'=' ; put equal sign between MSR number call putc ; and its value db 0fh,32h ; RDMSR (in case mnem. not supported) push eax ; remember low half of MSR value mov eax,edx ; output the high half of value call dword_to_string mov al,':' ; separate halves with a colon call putc pop eax ; get back low half of MSR value ;; fall through to dword_to_string dump_one_msr endp dword_to_string proc near push eax shr eax,16 ; display 32 bits in hex by displaying call word_to_string ; high 16 bits first, pop eax ; then falling through for low 16 word_to_string: push ax mov al,ah ; display 16 bits in hex by displaying call byte_to_string ; high 8 bits first, pop ax ; then falling through for low 8 byte_to_string: push ax shr al,4 ; display 8 bits as two hex digits call nybble_to_string ; by doing high digit first, pop ax ; then falling through for low digit and al,0fh nybble_to_string: add al,90h ; convert nybble in AL into ASCII daa ; hex digit in AL adc al,40h daa putc: mov dl,al ; send the character in AL to the mov ah,2 ; DOS standard output int 21h ret dword_to_string endp code ends end dumpmsr