15

talking in very low level, how the cores are initialized ?

Ahmed Khalaf
  • 1,220
  • 12
  • 28
  • I'd be intersted to know also how the OS initially (at the hardware level) determines how many cores/packages/logical processors there are – PhiS Oct 30 '10 at 12:14
  • @PhiS: It just asks. look up cpuid... – Bahbar Oct 31 '10 at 08:41
  • @Bahbar CPUID does not provide all the necessary information if there's more than one physical package present in the system, because you only receive info on the package level (how many cores/log processors within a package). – PhiS Oct 31 '10 at 10:59
  • @PhiS: For packages, it looks like it's a game of trial-and-error. Check the AppendixD in the spec in my answer for how Intel recommends to do it (case here for dual packages). Steps 14 to 16 are where it waits for the remote package to wake up and answer. – Bahbar Oct 31 '10 at 13:35
  • @Bahbar - yes, I see that now; thanks for that info. – PhiS Nov 01 '10 at 08:03
  • 1
    @PhiS, on x86_64 pc's, there is a descriptor table initially stored in the memory at boot at a certain physical memory address that contains the details of the CPU setup. It's called the Multiboot table and is detailed in a spec that you can get from Intel. The table contains the layout of CPUs and information about LAPIC and IOAPIC interrupt controllers. The CPUs are then booted according to a protocol by invoking interrupts from the boostrap processor to the other cpus. This is very platform specific, and all CPU types work differently. – exDM69 Aug 11 '12 at 13:58
  • @exDM69 - thanks, that's good information! – PhiS Aug 14 '12 at 11:00

2 Answers2

9

you can check out all the gory details in the Intel specification. The gory details are in chapter 8.1.

Here is an excerpt:

Following power-up or an assertion of the RESET# pin, each processor on the system bus performs a hardware initialization of the processor (known as a hardware reset) and an optional built-in self-test (BIST). [snip] At this point, the action taken depends on the processor family:

• P6 family processors—All the processors on the system bus (including a single processor in a uniprocessor system) execute the multiple processor (MP) initialization protocol across the APIC bus. The processor that is selected through this protocol as the bootstrap processor (BSP) then immediately starts executing software-initialization code in the current code segment beginning at the offset in the EIP register.

Community
  • 1
  • 1
Bahbar
  • 17,760
  • 43
  • 62
3

There are multiple ways of booting multicore soc depending on architecture, system - AMP or SMP etc. One of simple way for dual core SMP system is that CPU0 starts at reset vector (e.g. 0x00000000 which points to flash memory where boot monitor program is stored). During this time other cores are in WFI (wait for interrupt) or boot hold-off state. CPU0 boots and sets up ground for booting of CPU1.

for further details http://www.linux-arm.org/LinuxBootLoader/SMPBoot

freescale.com/files/32bit/doc/app_note/AN3542.pdf

x19x
  • 31
  • 1