Page 1 of 1

the 'core' num detected under bochs never changes (always 1)

Posted: Thu Dec 19, 2013 9:39 am
by miaowei
my bochs is configured as:1 package * 2 cores * 2 threads
------------------------
cpu: count=1:2:2 ...
------------------------
i use cpuid's leaf-4 to detect addressable cores, but always get '1'. Here is a part of code:

Code: Select all

"movl $4,%%eax\n\t"
			"movl $0,%%ecx\n\t"
			"cpuid\n\t"
			"shr $26,%%eax\n\t"
			"inc %%eax\n\t"
			"movl %%eax,%5\n\t"
			"end:nop"
			:"=m"(xapic_support),"=m"(x2apic_support),"=m"(multi_thread_support),"=m"(cpuid_input_max),"=m"(addressable_logic_num),\
			"=m"(addressable_core_num), "=m"(cpuid_family)
I can guarantee that the bochs support xapic, and, from the test results,the num of 'addressable logical processor'' detected using cpuid's leaf-0 is always right.(it's 4 in the case above)

Re: the 'core' num detected under bochs never changes (alway

Posted: Thu Dec 19, 2013 10:03 am
by Brendan
Hi,
miaowei wrote:i use cpuid's leaf-4 to detect addressable cores, but always get '1'.
Here's the relevant part of Bochs source code, where you can see that everything is just set to zeros for cpuid's leaf 4.

For some CPUs I think Bochs is correct (I don't think AMD CPUs support this function), and for other CPUs (Intel) Bochs is wrong.

Note: A more complete explanation of all the different cases (which CPUs are supposed to support what) can be found on this wiki page. :)


Cheers,

Brendan