<damo22>"youpi: gdt_init is not about interrupts" ... no but if an interrupt happens while the gdt is being set up that would break things <damo22>is the gdt required to be set up on all APs? <youpi>damo22: ints are not enabled at that point <youpi>and interrupts are enabled much later on <damo22>youpi: ljmp $0x8, $M(0f) <--- in cpuboot.S isnt it just supposed to jump to the next instruction to flush the queue? <youpi>in boothdr.S it is documented that the jump is used to load the new segment set by lgdt <damo22>in apboot it looks like it sets the selectors in 16 bit mode to 0 (is that valid?) and then enters protected mode <damo22>but i dont understand the M(0f) jump <damo22>somehow (0 - apboot + 0x7000) is the address of the next instruction? <youpi>it is possibly just cargo-culted code <damo22>i found an explanation in the intel 32/64 manual <damo22>youpi: should the APs share the same boothdr.S code? <damo22>as i understand, starting the APs is slightly different to starting the BSP, because we are not using interrupts on the APs and they need to be added to the kernel somehow instead of start it from scratch <damo22>after "call cpu_ap_main" what is the cpu supposed to do? <damo22>i believe it is executing garbage <damo22>how do you add an AP to the kernel so it sleeps waiting for more instructions? <damo22>im getting further, im stuck on Sending IPI to APIC ID 1 <damo22>so you need some 16 bit code to make it switch to 32 bit <damo22>Sending IPIs to APIC ID 1...done <damo22>AP 1: Waiting for BSP to complete SMP init <damo22>Sending IPIs to APIC ID 1...donAP 1: Waiting for BSP to complete SMP init <damo22>Started cpu 1 (lAPIC ID 1...donAP 1: Waiting for BSP to complete SMP init <damo22>AP m:odO!e 0: acpi --host-priv-port=${host-port} --device-master-port=${device-p <damo22>Starting cpu with APIC ID 1 setup <damo22>youpi: after running mp_desc_init(1) (on the first AP) a variable containing the value 1 changed its value to 16910336 without even writing to it <iska>damo22 so did you make SMP usable? <damo22>the BSP is waiting for the APs to complete initialisation <damo22>something wrong with the addressing <iska>would it have been easier if gnumach was in virtual memory? <iska>(like the original mach was) <damo22>the APs need to be configured to access memory the same way as the BSP <damo22>but calling gdt_init() crashes the processor <iska>can you remind what BSP and AP is <damo22>BSP coordinates the smp inititalisation <damo22>see my last few commits on top of Almu's code <damo22>i think the problem is interrupt_stack[] is just defined in the C code but has no allocation for the stack? ***mbanck is now known as azeem
<damo22>Sending IPIs to APIC ID 1...done <damo22>Started cpu 1 (lapic id 00000001) <damo22>maybe i cannot access a previous variable stored in memory after switching the selectors / gdt <damo22>maybe its sitting on the stack and the stack was switched <iska>damo22 can you help me build your gnumach? <iska>gcc errors because of a cpu_number() #define <damo22>something is changing the value of cpu <damo22>and thus it never completes the init because its waiting for a bogus cpu number to be ready <iska>what hardware can do that? <youpi>damo22: remember that you can use watchpoints to trap variable changes <damo22>you need to run autoreconf -fi in the base gnumach/ directory, then mkdir build && cd build && ../configure --enable-kdb --disable-apic --enable-ncpus=8 <youpi>damo22: with db_set_hw_watchpoint <damo22>i got AP 1 slaved, then a character "m" and nothing, i think the BSP tried to boot the system but something about bringing the AP online crashed it <damo22>im running qemu with --no-reboot --no-shutdown <damo22>what happens if the BSP is running in 32 bit flat mode and the APs try to run in protected mode? <damo22>youpi: i cant see where the uniprocessor gnumach jumps to protected mode? CR0_PE is not set anywhere <youpi> Bit 31 (PG) must be cleared. Bit 0 (PE) must be set. Other bits <damo22>thing is, APs come up in real mode when you send IPI <youpi>that's not really surprising since that's the bootup state for a processor <damo22>ok something is wrong with the cpuboot.S ***ay is now known as Andrew
<luckyluke>Shouldn't APIC be always enabled when NCPU>1?