- Add a cpu_exthigh variable to hold the highest extended cpuid value

returned from cpuid 0x80000000.
- Add a cpu_brand char array to hold the processor name returned by
  cpuid 0x80000002-0x80000004 on AMD, Intel, Transmeta, and possibly
  other CPUs.
- Use cpuid to set cpu_exthigh and read the processor name if it is present
  in identify_cpu().
This commit is contained in:
John Baldwin 2003-01-08 16:35:59 +00:00
parent b33c8e3ded
commit 26aa6d02bf
7 changed files with 80 additions and 0 deletions

View file

@ -83,10 +83,12 @@ u_int cpu_id = 0; /* Stepping ID */
u_int cpu_feature = 0; /* Feature flags */
u_int cpu_high = 0; /* Highest arg to CPUID */
u_int cpuid_cpuinfo = 0; /* HyperThreading Info / Brand Index / CLFUSH */
u_int cpu_exthigh = 0; /* Highest arg to extended CPUID */
#ifdef CPU_ENABLE_SSE
u_int cpu_fxsr = 0; /* SSE enabled */
#endif
char cpu_vendor[20] = ""; /* CPU Origin code */
char cpu_brand[48] = ""; /* Brand name */
#ifdef I486_CPU
/*

View file

@ -740,6 +740,30 @@ trycpuid: /* Use the `cpuid' instruction. */
/* Greater than Pentium...call it a Pentium Pro */
movl $CPU_686,R(cpu)
3:
/* Try to read extended CPUID information. */
movl $0x80000000,%eax # cpuid 80000000
cpuid
cmpl $0x80000000,%eax # is it a valid value?
jb 5f
movl %eax,R(cpu_exthigh) # highest extended capability
cmpl $0x80000004,%eax # does it have a brand name?
jb 5f
/* Read the brand name. */
leal R(cpu_brand),%edi
movl $0x80000002,%esi
4:
movl %esi,%eax
cpuid
movl %eax,(%edi) # Store next 16 characters
movl %ebx,4(%edi) # of brand name
movl %ecx,8(%edi)
movl %edx,12(%edi)
incl %esi # Advance to next set of 16
addl $16,%edi
cmpl $0x80000004,%esi
jbe 4b
5:
ret

View file

@ -740,6 +740,30 @@ trycpuid: /* Use the `cpuid' instruction. */
/* Greater than Pentium...call it a Pentium Pro */
movl $CPU_686,R(cpu)
3:
/* Try to read extended CPUID information. */
movl $0x80000000,%eax # cpuid 80000000
cpuid
cmpl $0x80000000,%eax # is it a valid value?
jb 5f
movl %eax,R(cpu_exthigh) # highest extended capability
cmpl $0x80000004,%eax # does it have a brand name?
jb 5f
/* Read the brand name. */
leal R(cpu_brand),%edi
movl $0x80000002,%esi
4:
movl %esi,%eax
cpuid
movl %eax,(%edi) # Store next 16 characters
movl %ebx,4(%edi) # of brand name
movl %ecx,8(%edi)
movl %edx,12(%edi)
incl %esi # Advance to next set of 16
addl $16,%edi
cmpl $0x80000004,%esi
jbe 4b
5:
ret

View file

@ -42,12 +42,14 @@ extern void (*bcopy_vector)(const void *from, void *to, size_t len);
extern int busdma_swi_pending;
extern int (*copyin_vector)(const void *udaddr, void *kaddr, size_t len);
extern int (*copyout_vector)(const void *kaddr, void *udaddr, size_t len);
extern u_int cpu_exthigh;
extern u_int cpu_feature;
extern u_int cpu_high;
extern u_int cpuid_cpuinfo;
extern u_int cpu_id;
extern u_int cpu_fxsr;
extern char cpu_vendor[];
extern char cpu_brand[];
extern u_int cyrix_did;
extern uint16_t *elan_mmcr;
extern char kstack[];

View file

@ -83,10 +83,12 @@ u_int cpu_id = 0; /* Stepping ID */
u_int cpu_feature = 0; /* Feature flags */
u_int cpu_high = 0; /* Highest arg to CPUID */
u_int cpuid_cpuinfo = 0; /* HyperThreading Info / Brand Index / CLFUSH */
u_int cpu_exthigh = 0; /* Highest arg to extended CPUID */
#ifdef CPU_ENABLE_SSE
u_int cpu_fxsr = 0; /* SSE enabled */
#endif
char cpu_vendor[20] = ""; /* CPU Origin code */
char cpu_brand[48] = ""; /* Brand name */
#ifdef I486_CPU
/*

View file

@ -740,6 +740,30 @@ trycpuid: /* Use the `cpuid' instruction. */
/* Greater than Pentium...call it a Pentium Pro */
movl $CPU_686,R(cpu)
3:
/* Try to read extended CPUID information. */
movl $0x80000000,%eax # cpuid 80000000
cpuid
cmpl $0x80000000,%eax # is it a valid value?
jb 5f
movl %eax,R(cpu_exthigh) # highest extended capability
cmpl $0x80000004,%eax # does it have a brand name?
jb 5f
/* Read the brand name. */
leal R(cpu_brand),%edi
movl $0x80000002,%esi
4:
movl %esi,%eax
cpuid
movl %eax,(%edi) # Store next 16 characters
movl %ebx,4(%edi) # of brand name
movl %ecx,8(%edi)
movl %edx,12(%edi)
incl %esi # Advance to next set of 16
addl $16,%edi
cmpl $0x80000004,%esi
jbe 4b
5:
ret

View file

@ -42,12 +42,14 @@ extern void (*bcopy_vector)(const void *from, void *to, size_t len);
extern int busdma_swi_pending;
extern int (*copyin_vector)(const void *udaddr, void *kaddr, size_t len);
extern int (*copyout_vector)(const void *kaddr, void *udaddr, size_t len);
extern u_int cpu_exthigh;
extern u_int cpu_feature;
extern u_int cpu_high;
extern u_int cpuid_cpuinfo;
extern u_int cpu_id;
extern u_int cpu_fxsr;
extern char cpu_vendor[];
extern char cpu_brand[];
extern u_int cyrix_did;
extern uint16_t *elan_mmcr;
extern char kstack[];