File: microcode.c

package info (click to toggle)
x86info 1.18-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 468 kB
  • ctags: 442
  • sloc: ansic: 3,978; makefile: 115; asm: 67; sh: 38
file content (35 lines) | stat: -rw-r--r-- 656 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
 *  $Id: microcode.c,v 1.3 2003/04/11 00:17:20 davej Exp $
 *  This file is part of x86info.
 *  (C) 2002 Dave Jones.
 *
 *  Licensed under the terms of the GNU GPL License version 2.
 *
 *  Intel P6 microcode information.
 *
 */

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include "../x86info.h"
#include "Intel.h"

void decode_microcode(struct cpudata *cpu)
{
	unsigned long long val=0;
	int ver;

	if (!user_is_root)
		return;

	if (cpu->family < 6)
		return;

	if (read_msr (cpu->number, MSR_IA32_UCODE_REV, &val)==1) {
		ver = val >>32;
		if (ver>0)
			printf ("Microcode version: 0x%016llx\n", val >>32);
		printf ("\n");
	}
}