chore: general cleanup in code (removed unused includes and cosmetic stuff
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <Types.h>
|
#include <Types.h>
|
||||||
#include <Arch/IO.h>
|
|
||||||
#include <Arch/Exceptions.h>
|
#include <Arch/Exceptions.h>
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|||||||
@@ -2,8 +2,10 @@
|
|||||||
#include <Types.h>
|
#include <Types.h>
|
||||||
#include <Arch/Exceptions.h>
|
#include <Arch/Exceptions.h>
|
||||||
|
|
||||||
static const UInt64 kTimerFrequency = 1000; // 1ms
|
enum {
|
||||||
static const UInt8 kTimerIRQ = 27;
|
kTimerFrequency = 1000, // 1ms
|
||||||
|
kTimerIRQ = 27,
|
||||||
|
};
|
||||||
|
|
||||||
void TimerInitialize();
|
void TimerInitialize();
|
||||||
void TimerReset(UInt64 interval);
|
void TimerReset(UInt64 interval);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ typedef struct __attribute__((aligned(16))) VMHeapBlockHeader {
|
|||||||
struct VMHeapBlockHeader* next;
|
struct VMHeapBlockHeader* next;
|
||||||
struct VMHeapBlockHeader* previous;
|
struct VMHeapBlockHeader* previous;
|
||||||
UInt64 size;
|
UInt64 size;
|
||||||
bool isFree;
|
Boolean isFree;
|
||||||
} VMHeapBlockHeader;
|
} VMHeapBlockHeader;
|
||||||
|
|
||||||
void HeapInitialize();
|
void HeapInitialize();
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <Types.h>
|
#include <Types.h>
|
||||||
#include "../Common/bootinfo.h"
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kVMPageSize = 4096,
|
kVMPageSize = 4096,
|
||||||
|
|||||||
@@ -25,11 +25,12 @@ enum {
|
|||||||
kVMKernelVMA = 0xFFFFFFFF80000000,
|
kVMKernelVMA = 0xFFFFFFFF80000000,
|
||||||
kHHDMOffset = 0xFFFF888000000000,
|
kHHDMOffset = 0xFFFF888000000000,
|
||||||
kVMFbVirtBase = 0xFFFFFFFFFC000000,
|
kVMFbVirtBase = 0xFFFFFFFFFC000000,
|
||||||
|
kKernelPhysBase = 0x40100000,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static inline Address VMKernelVirtToPhys(Address virt) {
|
static inline Address VMKernelVirtToPhys(Address virt) {
|
||||||
return virt - 0xFFFFFFFF80100000 + 0x40100000; // TODO: hardcode is awful
|
return virt - 0xFFFFFFFF80100000 + kKernelPhysBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Address VMPhysToHHDM(Address phys) {
|
static inline Address VMPhysToHHDM(Address phys) {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
#include <Arch/DTB.h>
|
#include <Arch/DTB.h>
|
||||||
#include <OS/Panic.h>
|
#include <OS/Panic.h>
|
||||||
#include <OS/Log.h>
|
|
||||||
#include <Lib/Bytes.h>
|
#include <Lib/Bytes.h>
|
||||||
#include <Lib/Align.h>
|
#include <Lib/Align.h>
|
||||||
#include <Lib/String.h>
|
#include <Lib/String.h>
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#include <Arch/Exceptions.h>
|
#include <Arch/Exceptions.h>
|
||||||
#include <Arch/CPU.h>
|
|
||||||
#include <Arch/GIC.h>
|
#include <Arch/GIC.h>
|
||||||
#include <IO/Serial.h>
|
|
||||||
#include <OS/Panic.h>
|
#include <OS/Panic.h>
|
||||||
|
|
||||||
Address ExceptionsHandler(ExceptionsContext* frame, ExceptionsType type) {
|
Address ExceptionsHandler(ExceptionsContext* frame, ExceptionsType type) {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ static void CombineForward(VMHeapBlockHeader* current) {
|
|||||||
if (!current->next || !current->next->isFree) return;
|
if (!current->next || !current->next->isFree) return;
|
||||||
current->size += sizeof(VMHeapBlockHeader) + current->next->size;
|
current->size += sizeof(VMHeapBlockHeader) + current->next->size;
|
||||||
current->next = current->next->next;
|
current->next = current->next->next;
|
||||||
if (current->next) current->next->previous = current; // what the fuck
|
if (current->next) current->next->previous = current;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HeapInitialize() {
|
void HeapInitialize() {
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ void PMMInitialize(VMBootMemoryMap* bootMap) {
|
|||||||
Size pagesToReserve = (regionSize + kVMPageSize - 1) / kVMPageSize;
|
Size pagesToReserve = (regionSize + kVMPageSize - 1) / kVMPageSize;
|
||||||
|
|
||||||
for (Size p = 0; p < pagesToReserve; p++) {
|
for (Size p = 0; p < pagesToReserve; p++) {
|
||||||
Address pageAdress = regionBase + (p * kVMPageSize);
|
Address pageAddress = regionBase + (p * kVMPageSize);
|
||||||
if (pageAdress >= sPMMRamBase && pageAdress < (sPMMRamBase + bootMap->totalRAM.size)) {
|
if (pageAddress >= sPMMRamBase && pageAddress < (sPMMRamBase + bootMap->totalRAM.size)) {
|
||||||
BitmapSet(sPMMBitmap, pageAdress);
|
BitmapSet(sPMMBitmap, pageAddress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ void VMMInitialize(VMBootMemoryMap* bootMap, Bootinfo* info) {
|
|||||||
Size kernelSize = ((Address)_kernelEnd - (Address)_kernelStart) + pmmBitmapSize;
|
Size kernelSize = ((Address)_kernelEnd - (Address)_kernelStart) + pmmBitmapSize;
|
||||||
kernelSize = (kernelSize + kVMPageSize - 1) & ~(kVMPageSize - 1);
|
kernelSize = (kernelSize + kVMPageSize - 1) & ~(kVMPageSize - 1);
|
||||||
|
|
||||||
Address kernelPhysStart = 0x40100000; // TODO: hardcode is awful
|
Address kernelPhysStart = kKernelPhysBase;
|
||||||
|
|
||||||
for (Address offset = 0; offset < kernelSize; offset += kVMPageSize) {
|
for (Address offset = 0; offset < kernelSize; offset += kVMPageSize) {
|
||||||
Address phys = kernelPhysStart + offset;
|
Address phys = kernelPhysStart + offset;
|
||||||
|
|||||||
Reference in New Issue
Block a user