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

some questions about SMP?
https://forum.osdev.org/viewtopic.php?f=15&t=37048
Page 1 of 2

Author:  mkfree [ Tue Jul 28, 2020 12:56 pm ]
Post subject:  some questions about SMP?

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?

Author:  nexos [ Tue Jul 28, 2020 1:04 pm ]
Post subject:  Re: some questions about SMP?

That is a physical address. It must be mapped as present, writeable, and non-cacheable somewhere.

Author:  nexos [ Tue Jul 28, 2020 1:08 pm ]
Post subject:  Re: some questions about SMP?

Also, have you read the MP specification? The xv6 source code really helped me out as well.

Author:  mkfree [ Tue Jul 28, 2020 1:16 pm ]
Post subject:  Re: some questions about SMP?

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?

Author:  nexos [ Tue Jul 28, 2020 1:21 pm ]
Post subject:  Re: some questions about SMP?

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.

Author:  mkfree [ Tue Jul 28, 2020 1:34 pm ]
Post subject:  Re: some questions about SMP?

Ok, thank you very much, I am already reviewing the xv6 code, I hope to clarify some doubts.

Author:  nexos [ Tue Jul 28, 2020 1:35 pm ]
Post subject:  Re: some questions about SMP?

To see more about why the APIC addresses can exist so high in memory read https://en.wikipedia.org/wiki/Memory-mapped_I/O

Author:  mkfree [ Tue Jul 28, 2020 2:00 pm ]
Post subject:  Re: some questions about SMP?

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.

Author:  mkfree [ Wed Jul 29, 2020 6:14 am ]
Post subject:  Re: some questions about SMP?

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.

Author:  nexos [ Wed Jul 29, 2020 6:34 am ]
Post subject:  Re: some questions about SMP?

Did you set the cache disable bit in the PTE when mapping it (it is bit 5)?

Author:  mkfree [ Wed Jul 29, 2020 7:01 am ]
Post subject:  Re: some questions about SMP?

Yes, (PG_CACHE_DISABLED 0x00000010)

Author:  nexos [ Wed Jul 29, 2020 7:07 am ]
Post subject:  Re: some questions about SMP?

Where can I see the code?

Author:  mkfree [ Wed Jul 29, 2020 7:55 am ]
Post subject:  Re: some questions about SMP?

Thank you very much for the help.

Attachments:
rev.rar [7.25 KiB]
Downloaded 46 times

Author:  nexos [ Wed Jul 29, 2020 8:34 am ]
Post subject:  Re: some questions about SMP?

My APIC driver is at https://github.com/Nexware-Project/NexOS/blob/master/NexKe/Hal/x86-common/Lapic.c

Author:  nexos [ Wed Jul 29, 2020 8:35 am ]
Post subject:  Re: some questions about SMP?

The APIC memory base should be a u32 and it should have the volatile keyword. It should work then.

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