1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 09:27:35 +00:00

Kernel: Add SMP IPI support

We can now properly initialize all processors without
crashing by sending SMP IPI messages to synchronize memory
between processors.

We now initialize the APs once we have the scheduler running.
This is so that we can process IPI messages from the other
cores.

Also rework interrupt handling a bit so that it's more of a
1:1 mapping. We need to allocate non-sharable interrupts for
IPIs.

This also fixes the occasional hang/crash because all
CPUs now synchronize memory with each other.
This commit is contained in:
Tom 2020-07-06 07:27:22 -06:00 committed by Andreas Kling
parent dec27e5e6f
commit bc107d0b33
27 changed files with 1236 additions and 627 deletions

View file

@ -38,6 +38,7 @@ namespace Kernel {
static u8* s_vga_buffer;
static VirtualConsole* s_consoles[6];
static int s_active_console;
static RecursiveSpinLock s_lock;
void VirtualConsole::flush_vga_cursor()
{
@ -85,7 +86,7 @@ void VirtualConsole::switch_to(unsigned index)
ASSERT(index < 6);
ASSERT(s_consoles[index]);
InterruptDisabler disabler;
ScopedSpinLock lock(s_lock);
if (s_active_console != -1) {
auto* active_console = s_consoles[s_active_console];
// We won't know how to switch away from a graphical console until we
@ -107,7 +108,7 @@ void VirtualConsole::set_active(bool active)
if (active == m_active)
return;
InterruptDisabler disabler;
ScopedSpinLock lock(s_lock);
m_active = active;
@ -240,7 +241,7 @@ void VirtualConsole::on_key_pressed(KeyboardDevice::Event event)
ssize_t VirtualConsole::on_tty_write(const u8* data, ssize_t size)
{
InterruptDisabler disabler;
ScopedSpinLock lock(s_lock);
for (ssize_t i = 0; i < size; ++i)
m_terminal.on_input(data[i]);
if (m_active)