OSDev.org

The Place to Start for Operating System Developers
It is currently Mon Mar 18, 2024 11:23 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: SMP, cpu1 started to cleaning memory.
PostPosted: Mon Apr 22, 2019 2:08 pm 
Offline
Member
Member
User avatar

Joined: Tue Feb 11, 2014 4:59 pm
Posts: 74
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

_________________
https://blackdev.org/ - system programming, my own 64 bit kernel and software.


Top
 Profile  
 
 Post subject: Re: SMP, cpu1 started to cleaning memory.
PostPosted: Tue Apr 23, 2019 2:35 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5069
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?


Top
 Profile  
 
 Post subject: Re: SMP, cpu1 started to cleaning memory.
PostPosted: Tue Apr 23, 2019 9:58 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 11, 2014 4:59 pm
Posts: 74
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?

_________________
https://blackdev.org/ - system programming, my own 64 bit kernel and software.


Top
 Profile  
 
 Post subject: Re: SMP, cpu1 started to cleaning memory.
PostPosted: Tue Apr 23, 2019 11:17 am 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5069
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.)


Top
 Profile  
 
 Post subject: Re: SMP, cpu1 started to cleaning memory.
PostPosted: Tue Apr 23, 2019 11:27 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 11, 2014 4:59 pm
Posts: 74
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], YaCy [Bot] and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group