Re: AMD cache values for page colouring

From: Alexander Leidinger <Alexander_at_Leidinger.net>
Date: Mon, 02 Jan 2006 20:03:47 +0100
Divacky Roman <xdivac02_at_stud.fit.vutbr.cz> wrote:

[no cachesize detection]
> my CPU is:
> CPU: AMD Athlon(tm) XP 2500+ (1834.88-MHz 686-class CPU)
> Origin = "AuthenticAMD"  Id = 0x6a0  Stepping = 0
> Features=0x383fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE>
> AMD Features=0xc0400800<SYSCALL,MMX+,3DNow+,3DNow>

So the AMD64 code works (on AMD processors) but the IA32 (on AMD) fails.
Either I did something completely wrong, or it's a small typo I do overlook
(tomatoes on the eyes...). Can someone with a little bit of AMD feature
detection knowledge have a look at:
---snip---
	 static void
  	 setPQL2_AMD(int *const size, int *const ways) {
  	         if (cpu_exthigh >= 0x80000006) {
  	                 u_int regs[4];

  	                 do_cpuid(0x80000006, regs);
  	                 *size = regs[2] >> 16;
  	                 *ways = (regs[2] >> 12) & 0x0f;
  	                 if(*ways == 255)                /* fully associative */
  	                         *ways = 1;
  	         }
  	 }



	 void
  	 setPQL2(int *const size, int *const ways)
  	 {
  	         if (strcmp(cpu_vendor, "AuthenticAMD") == 0)
  	                 setPQL2_AMD(size, ways);
  	         else if (strcmp(cpu_vendor, "GenuineIntel") == 0)
  	                 setPQL2_INTEL(size, ways);
	 }
---snip---
This is from sys/i386/i386/identcpu.c.

Bye,
Alexander.

-- 
http://www.Leidinger.net  Alexander _at_ Leidinger.net: PGP ID = B0063FE7
http://www.FreeBSD.org     netchild _at_ FreeBSD.org  : PGP ID = 72077137
When we are planning for posterity, we ought to remember that virtue is
not hereditary.
		-- Thomas Paine
Received on Mon Jan 02 2006 - 18:03:53 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:50 UTC