fix(kcp, IDT, Heap, kernel): Various fixes, scrap broken memory allocator
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
#include "GDT.hpp"
|
||||
#include "../Terminal/terminal.hpp"
|
||||
#include "../Terminal/Terminal.hpp"
|
||||
|
||||
// Limine loads a GDT of course, (CS = 0x28) but we will need to make a TSS someday... therefore we load our own now
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Hal {
|
||||
BasicGDT kernelGDT{};
|
||||
|
||||
void PrepareGDT() {
|
||||
kout << "[Hal] GDT at " << base::hex << (uint64_t)&kernelGDT << "\n";
|
||||
kout << "HardwareAbstraction: GDT at " << base::hex << (uint64_t)&kernelGDT << "\n";
|
||||
kernelGDT = {
|
||||
// Code segment offset 0x08
|
||||
// Data segment offset 0x10
|
||||
@@ -61,10 +61,10 @@ namespace Hal {
|
||||
|
||||
void BridgeLoadGDT() {
|
||||
// Puts the GDT pointer structure into the GDTR
|
||||
kout << "[Hal] Setting GDTR" << Kt::newline;
|
||||
kout << "HardwareAbstraction: Setting GDTR" << Kt::newline;
|
||||
LoadGDT(&gdtPointer);
|
||||
|
||||
kout << "[Hal] Reloading segments" << Kt::newline;
|
||||
kout << "HardwareAbstraction: Reloading segments" << Kt::newline;
|
||||
ReloadSegments();
|
||||
}
|
||||
};
|
||||
@@ -16,6 +16,7 @@ namespace Hal {
|
||||
constexpr auto TrapGate = 0x8F;
|
||||
|
||||
InterruptDescriptor* IDT;
|
||||
InterruptDescriptor InterruptDescriptorTable[255]{};
|
||||
IDTRStruct IDTR{};
|
||||
|
||||
const char* ExceptionStrings[] = {
|
||||
@@ -55,12 +56,12 @@ namespace Hal {
|
||||
template<size_t i>
|
||||
__attribute__((interrupt)) void ExceptionHandler(System::PanicFrame* frame)
|
||||
{
|
||||
kcp::cstringstream stream;
|
||||
stream << "Caught " << base::hex << "0x" << i << " " << ExceptionStrings[i] << " in kernel";
|
||||
// kcp::cstringstream stream;
|
||||
// stream << "Caught " << base::hex << "0x" << i << " " << ExceptionStrings[i] << " in kernel";
|
||||
|
||||
frame->InterruptVector = i;
|
||||
|
||||
Panic(stream.cstr(), frame);
|
||||
Panic(ExceptionStrings[i], frame);
|
||||
}
|
||||
|
||||
void LoadIDT(IDTRStruct& idtr) {
|
||||
@@ -112,16 +113,16 @@ namespace Hal {
|
||||
struct SetHandler<N,N> {static void run() {}};
|
||||
|
||||
void IDTInitialize() {
|
||||
IDT = (InterruptDescriptor*)Memory::g_heap->Request(4096);
|
||||
IDT = (InterruptDescriptor*)&InterruptDescriptorTable;
|
||||
IDTR.Limit = 0x0FF;
|
||||
IDTR.Base = (uint64_t)&IDT;
|
||||
|
||||
SetHandler<0, 31>::run();
|
||||
|
||||
kout << "[Hal] Created exception interrupt vectors" << "\n";
|
||||
kout << "HardwareAbstraction: Created exception interrupt vectors" << "\n";
|
||||
|
||||
LoadIDT(IDTR);
|
||||
|
||||
kout << "[Hal] Loaded new IDT" << "\n";
|
||||
kout << "HardwareAbstraction: Loaded new IDT" << "\n";
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user