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

Kernel: Move all code into the Kernel namespace

This commit is contained in:
Andreas Kling 2020-02-16 01:27:42 +01:00
parent d42f0f4661
commit a356e48150
201 changed files with 907 additions and 111 deletions

View file

@ -47,6 +47,8 @@
#define APIC_REG_LVT_LINT1 0x360
#define APIC_REG_LVT_ERR 0x370
namespace Kernel {
extern "C" void apic_spurious_interrupt_entry();
asm(
@ -214,3 +216,5 @@ void enable(u32 cpu)
}
}
}

View file

@ -28,9 +28,13 @@
#include <AK/Types.h>
namespace Kernel {
namespace APIC {
bool init();
void enable(u32 cpu);
}
}

View file

@ -37,6 +37,8 @@
//#define PAGE_FAULT_DEBUG
namespace Kernel {
struct [[gnu::packed]] DescriptorTablePointer
{
u16 limit;
@ -553,24 +555,6 @@ void handle_irq(RegisterState regs)
PIC::eoi(irq);
}
#ifdef DEBUG
void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func)
{
asm volatile("cli");
kprintf("ASSERTION FAILED: %s\n%s:%u in %s\n", msg, file, line, func);
// Switch back to the current process's page tables if there are any.
// Otherwise stack walking will be a disaster.
if (current)
MM.enter_process_paging_scope(current->process());
dump_backtrace();
asm volatile("hlt");
for (;;)
;
}
#endif
void sse_init()
{
asm volatile(
@ -725,3 +709,23 @@ void write_cr3(u32 cr3)
asm volatile("movl %%eax, %%cr3" ::"a"(cr3)
: "memory");
}
}
#ifdef DEBUG
void __assertion_failed(const char* msg, const char* file, unsigned line, const char* func)
{
asm volatile("cli");
kprintf("ASSERTION FAILED: %s\n%s:%u in %s\n", msg, file, line, func);
// Switch back to the current process's page tables if there are any.
// Otherwise stack walking will be a disaster.
if (Kernel::current)
MM.enter_process_paging_scope(Kernel::current->process());
Kernel::dump_backtrace();
asm volatile("hlt");
for (;;)
;
}
#endif

View file

@ -34,6 +34,8 @@
#define PAGE_SIZE 4096
#define PAGE_MASK ((uintptr_t)0xfffff000u)
namespace Kernel {
class MemoryManager;
class PageDirectory;
class PageTableEntry;
@ -589,3 +591,5 @@ public:
private:
u32 m_flags;
};
}

View file

@ -30,6 +30,8 @@
#include <Kernel/Arch/i386/PIC.h>
#include <LibBareMetal/IO.h>
namespace Kernel {
// The slave 8259 is connected to the master's IRQ2 line.
// This is really only to enhance clarity.
#define SLAVE_INDEX 2
@ -137,3 +139,5 @@ u16 get_irr()
}
}
}

View file

@ -28,14 +28,16 @@
#include <AK/Types.h>
namespace Kernel {
namespace PIC {
void enable(u8 number);
void disable(u8 number);
void eoi(u8 number);
void initialize();
u16 get_isr();
u16 get_irr();
void enable(u8 number);
void disable(u8 number);
void eoi(u8 number);
void initialize();
u16 get_isr();
u16 get_irr();
}
@ -50,3 +52,5 @@ public:
private:
u8 m_irq { 0 };
};
}

View file

@ -30,6 +30,8 @@
#include <Kernel/Scheduler.h>
#include <LibBareMetal/IO.h>
namespace Kernel {
#define IRQ_TIMER 0
extern "C" void timer_interrupt_entry();
@ -105,3 +107,5 @@ void initialize()
}
}
}

View file

@ -28,6 +28,8 @@
#include <AK/Types.h>
namespace Kernel {
#define TICKS_PER_SECOND 1000
/* Timer related ports */
#define TIMER0_CTL 0x40
@ -56,3 +58,5 @@ u32 ticks_this_second();
u32 seconds_since_boot();
}
}