SMP, cpu1 started to cleaning memory.

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
User avatar
CorruptedByCPU
Member
Member
Posts: 79
Joined: Tue Feb 11, 2014 4:59 pm

SMP, cpu1 started to cleaning memory.

Post by CorruptedByCPU »

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: Select all

	; 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
https://blackdev.org/ - system programming, my own 64 bit kernel and software.
Octocontrabass
Member
Member
Posts: 5584
Joined: Mon Mar 25, 2013 7:01 pm

Re: SMP, cpu1 started to cleaning memory.

Post by Octocontrabass »

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?
User avatar
CorruptedByCPU
Member
Member
Posts: 79
Joined: Tue Feb 11, 2014 4:59 pm

Re: SMP, cpu1 started to cleaning memory.

Post by CorruptedByCPU »

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: Select all

	; 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?
https://blackdev.org/ - system programming, my own 64 bit kernel and software.
Octocontrabass
Member
Member
Posts: 5584
Joined: Mon Mar 25, 2013 7:01 pm

Re: SMP, cpu1 started to cleaning memory.

Post by Octocontrabass »

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.)
User avatar
CorruptedByCPU
Member
Member
Posts: 79
Joined: Tue Feb 11, 2014 4:59 pm

Re: SMP, cpu1 started to cleaning memory.

Post by CorruptedByCPU »

Not its working correctly :) Thank You.

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

[[embed url=http://www.youtube.com/watch?v=RQShMgHg90s]]
https://blackdev.org/ - system programming, my own 64 bit kernel and software.
Post Reply