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

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
miaowei
Member
Member
Posts: 84
Joined: Wed Dec 18, 2013 9:10 am

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

Post 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)
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

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

Post 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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Post Reply