OSDev.org
https://forum.osdev.org/

SMP, cpu1 started to cleaning memory.
https://forum.osdev.org/viewtopic.php?f=1&t=33654
Page 1 of 1

Author:  akasei [ Mon Apr 22, 2019 2:08 pm ]
Post subject:  SMP, cpu1 started to cleaning memory.

Hey!

I found something strange in Bochs BIOS, when there are more than 2 logical processors.

Its starting just after sending SIPI to cpu1 and cpu2.

It's even more strange, because sometimes cpu1/cpu2 is going to start at 0x0800:0x0000 (where he should be starting), and the second one is going thru BIOS to clean area of 0x100000 :/

My SIPI inicjalization looks like that (and is proper, at least for cpu0 with cpu1):
Code:
   ; eax = 0x00000001 eg. cpu1 etc.

   ; send START command to logical processor (vector 0x08 > 0x0800:0x0000)
   shl   eax,   24
   mov   dword [rdi + KERNEL_ACPI_MADT_LAPIC_ICH_register],   eax
   mov   eax,   0x00004608
   mov   dword [rdi + KERNEL_ACPI_MADT_LAPIC_ICL_register],   eax


This is my first time seeing something like that :)

Screenshot below is from CPU1

Image

Author:  Octocontrabass [ Tue Apr 23, 2019 2:35 am ]
Post subject:  Re: SMP, cpu1 started to cleaning memory.

According to the log in your image, both APs are starting at the correct address. Something in the code there is causing the unexpected jump.

Is your code enabling IRQs before the APs are prepared to handle it? Is your code trying to call BIOS interrupts? Is your code triple-faulting and causing the CPU to reset? Is your code self-modifying?

Author:  akasei [ Tue Apr 23, 2019 9:58 am ]
Post subject:  Re: SMP, cpu1 started to cleaning memory.

Octocontrabass wrote:
[...] Something in the code there is causing the unexpected jump. [...] Is your code trying to call BIOS interrupts? [...]


Today I know where the problem was and you noticed it well :) (I've had enough bug hunting that day).

I thought that every processor after starting has a blocked line A20 - therefore, each newly started processor used this code

Code:
   ; otwórz bramę A20 za pomocą funkcji BIOSu
   ; open gate A20 by BIOS function
   mov   ax,   0x2401
   int   0x15


I use only virtualization for my OS purposes, so please don't complain ;)

I did not think that using the BIOS functions on other CPUs that are still in real mode can cause such complications.

Therefore, returning to the topic of the A20 line, is it blocked for each of the logical processors?

Author:  Octocontrabass [ Tue Apr 23, 2019 11:17 am ]
Post subject:  Re: SMP, cpu1 started to cleaning memory.

akasei wrote:
I did not think that using the BIOS functions on other CPUs that are still in real mode can cause such complications.

BIOS functions are not designed to run in parallel, and some functions won't work unless you call them from the BSP.

akasei wrote:
Therefore, returning to the topic of the A20 line, is it blocked for each of the logical processors?

No, there's only one A20 gate and you've already enabled it before you started the APs. (I'm not sure if it's even connected to the APs, the specifications I've read are not very clear about it.)

Author:  akasei [ Tue Apr 23, 2019 11:27 am ]
Post subject:  Re: SMP, cpu1 started to cleaning memory.

Not its working correctly :) Thank You.

https://www.youtube.com/watch?v=RQShMgHg90s

[[embed url=http://www.youtube.com/watch?v=RQShMgHg90s]]

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/