update main #1

Merged
Sinipelto merged 240 commits from Bananymous/banan-os:main into main 2023-11-20 13:20:51 +02:00
4 changed files with 28 additions and 4 deletions
Showing only changes of commit fcdc922343 - Show all commits

View File

@ -16,6 +16,11 @@ public:
static void initialize(bool force_pic);
static InterruptController& get();
void enter_acpi_mode();
private:
bool m_using_apic { false };
};
bool interrupts_enabled();

View File

@ -94,7 +94,7 @@ namespace Kernel
void validate_stack() const;
private:
static constexpr size_t m_kernel_stack_size = PAGE_SIZE * 1;
static constexpr size_t m_kernel_stack_size = PAGE_SIZE * 4;
static constexpr size_t m_userspace_stack_size = PAGE_SIZE * 2;
static constexpr size_t m_interrupt_stack_size = PAGE_SIZE * 2;
BAN::UniqPtr<VirtualRange> m_interrupt_stack;

View File

@ -3,6 +3,8 @@
#include <kernel/APIC.h>
#include <kernel/PIC.h>
#include <lai/helpers/sci.h>
static InterruptController* s_instance = nullptr;
InterruptController& InterruptController::get()
@ -19,11 +21,26 @@ void InterruptController::initialize(bool force_pic)
PIC::remap();
if (!force_pic)
{
s_instance = APIC::create();
if (s_instance)
return;
if (s_instance)
{
s_instance->m_using_apic = true;
return;
}
}
dprintln("Using PIC instead of APIC");
s_instance = PIC::create();
ASSERT(s_instance);
s_instance->m_using_apic = false;
}
void InterruptController::enter_acpi_mode()
{
if (lai_enable_acpi(m_using_apic ? 1 : 0) != 0)
dwarnln("could not enter acpi mode");
}
bool interrupts_enabled()

View File

@ -161,6 +161,8 @@ static void init2(void*)
dprintln("Scheduler started");
InterruptController::get().enter_acpi_mode();
auto console = MUST(DevFileSystem::get().root_inode()->find_inode(cmdline.console));
ASSERT(console->is_tty());
((TTY*)console.ptr())->set_as_current();