OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Oct 28, 2020 9:30 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: some questions about SMP?
PostPosted: Tue Jul 28, 2020 12:56 pm 
Offline
Member
Member

Joined: Thu Apr 30, 2020 6:03 am
Posts: 54
I am implementing the drivers so that the kernel supports several processors:
1- I did the search in the bios area (EBDA) and found the entry _MP_ (floating pointer structure), I did the checksum, ok
2- Then I got the PCMP (configuration table), I did the checksum, ok
3- I identified the IO PIC inputs and processors.
4- When I read in the configuration table, the field belonging to the address of the local APICs, I get that this address is
in 0xFEE00000, which is consistent with what the BIOS says that the addresses for this type of device are above 0xC0000000.

This memory location is virtual?
Before starting to work with IO-APIC, should I get a physical page and assign it to this virtual address?


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Tue Jul 28, 2020 1:04 pm 
Offline
Member
Member
User avatar

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 368
That is a physical address. It must be mapped as present, writeable, and non-cacheable somewhere.

_________________
Working on NexBoot, a simple and lightweight GRUB replacement. and NexKe, a stable and fast microkernel. Part of the Nexware Project.


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Tue Jul 28, 2020 1:08 pm 
Offline
Member
Member
User avatar

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 368
Also, have you read the MP specification? The xv6 source code really helped me out as well.

_________________
Working on NexBoot, a simple and lightweight GRUB replacement. and NexKe, a stable and fast microkernel. Part of the Nexware Project.


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Tue Jul 28, 2020 1:16 pm 
Offline
Member
Member

Joined: Thu Apr 30, 2020 6:03 am
Posts: 54
Nexos,
If I have the QUEMU configured with only 256MB of RAM, how is it possible to allocate such a memory location above the physical memory, or am I doing something wrong?


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Tue Jul 28, 2020 1:21 pm 
Offline
Member
Member
User avatar

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 368
This address is not RAM. Instead, it points to the LAPIC registers. It is called memory mapped because the firmware (to be precise, the chipset) maps this address to the LAPICs registers. Physical address are not necessarily RAM. They can also point to ROM (the BIOS is mapped to memory, yet is on ROM), a hardware device (PCI BARs and the APICs), or video ram(i.e. 0xB8000 points to VGA RAM, not system RAM). This is very important to understand when dealing with device management.

_________________
Working on NexBoot, a simple and lightweight GRUB replacement. and NexKe, a stable and fast microkernel. Part of the Nexware Project.


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Tue Jul 28, 2020 1:34 pm 
Offline
Member
Member

Joined: Thu Apr 30, 2020 6:03 am
Posts: 54
Ok, thank you very much, I am already reviewing the xv6 code, I hope to clarify some doubts.


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Tue Jul 28, 2020 1:35 pm 
Offline
Member
Member
User avatar

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 368
To see more about why the APIC addresses can exist so high in memory read https://en.wikipedia.org/wiki/Memory-mapped_I/O

_________________
Working on NexBoot, a simple and lightweight GRUB replacement. and NexKe, a stable and fast microkernel. Part of the Nexware Project.


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Tue Jul 28, 2020 2:00 pm 
Offline
Member
Member

Joined: Thu Apr 30, 2020 6:03 am
Posts: 54
Ok, really the address decoder takes care of all this, I had not thought of it that way for this address, really my question is nonsense.


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Wed Jul 29, 2020 6:14 am 
Offline
Member
Member

Joined: Thu Apr 30, 2020 6:03 am
Posts: 54
Nexos,
You have tested your implementation with the bochs, because when I do the virtual memory allocation in the kernel directory, it tells me
PANIC (APIC write with len = 1 (should be 4)), disable the cache for this page, I even got the address via
of the rdmsr instructions to check the addresses with those of the bios and they are the same. Will it be an emulator problem?
the same with quemu.


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Wed Jul 29, 2020 6:34 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 368
Did you set the cache disable bit in the PTE when mapping it (it is bit 5)?

_________________
Working on NexBoot, a simple and lightweight GRUB replacement. and NexKe, a stable and fast microkernel. Part of the Nexware Project.


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Wed Jul 29, 2020 7:01 am 
Offline
Member
Member

Joined: Thu Apr 30, 2020 6:03 am
Posts: 54
Yes, (PG_CACHE_DISABLED 0x00000010)


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Wed Jul 29, 2020 7:07 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 368
Where can I see the code?

_________________
Working on NexBoot, a simple and lightweight GRUB replacement. and NexKe, a stable and fast microkernel. Part of the Nexware Project.


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Wed Jul 29, 2020 7:55 am 
Offline
Member
Member

Joined: Thu Apr 30, 2020 6:03 am
Posts: 54
Thank you very much for the help.


Attachments:
rev.rar [7.25 KiB]
Downloaded 3 times
Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Wed Jul 29, 2020 8:34 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 368
My APIC driver is at https://github.com/Nexware-Project/NexOS/blob/master/NexKe/Hal/x86-common/Lapic.c

_________________
Working on NexBoot, a simple and lightweight GRUB replacement. and NexKe, a stable and fast microkernel. Part of the Nexware Project.


Top
 Profile  
 
 Post subject: Re: some questions about SMP?
PostPosted: Wed Jul 29, 2020 8:35 am 
Offline
Member
Member
User avatar

Joined: Tue Feb 18, 2020 3:29 pm
Posts: 368
The APIC memory base should be a u32 and it should have the volatile keyword. It should work then.

_________________
Working on NexBoot, a simple and lightweight GRUB replacement. and NexKe, a stable and fast microkernel. Part of the Nexware Project.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Majestic-12 [Bot] and 1 guest


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