You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your startup isn't quite correct, so I thought I would give you some idea of what you need to know.
First, you should have something like this function in the initial code.
int getLogicalProcessorCount() {
unsigned int eax, ebx, ecx, edx;
// Check CPUID support (simplified)
__asm__ volatile("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "a"(0));
// Get extended CPUID support
__asm__ volatile("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "a"(0x80000000));
if (eax >= 0x80000008) {
// Get logical processor count
__asm__ volatile("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "a"(0x80000008));
return (ebx & 0xFF); // Extract logical core count from lower 8 bits.
}
return 1; // Default to 1 processor if CPUID fails.
}
It's necessary to set up each of the getLogicalProcessorCount() processors. Each of them has an LAPIC, paging, etc,. You can steer certain interrupts to certain processors. Of course I am assuming you will want to run this on real hardware. If this is QEMU only application, just set the processor count to 1 and you won't need to deal with things.
You could do something like run the above function and if the count comes back greater than 1, just print out an error message and halt. Otherwise things get pretty complicated and you will have to know a lot about the Amd64/x86_64.
The text was updated successfully, but these errors were encountered:
Your startup isn't quite correct, so I thought I would give you some idea of what you need to know.
First, you should have something like this function in the initial code.
It's necessary to set up each of the getLogicalProcessorCount() processors. Each of them has an LAPIC, paging, etc,. You can steer certain interrupts to certain processors. Of course I am assuming you will want to run this on real hardware. If this is QEMU only application, just set the processor count to 1 and you won't need to deal with things.
You could do something like run the above function and if the count comes back greater than 1, just print out an error message and halt. Otherwise things get pretty complicated and you will have to know a lot about the Amd64/x86_64.
The text was updated successfully, but these errors were encountered: