Skip to content

Commit

Permalink
Kernel changes
Browse files Browse the repository at this point in the history
+ Initialize memory
+ Add init function to header
- Remove unnecessary definitions (they're in types.h)
  • Loading branch information
XenithMusic committed Nov 22, 2024
1 parent d3cf356 commit 7ce3a31
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
extern "C" {
namespace Allocator {

enum MMAPAccessType {
ALLOCATE, // Find a location to allocate memory (target = how much)
FREE // Find a location to free memory (target = location)
};
void init(multiboot_info* mbi);

void getMatchingMMAP(multiboot_info* mbi, enum MMAPAccessType type, uint32_t target);

Expand Down
24 changes: 23 additions & 1 deletion src/paranoia.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,33 @@
#include "string.h"
#include "const.h"
#include "pit.h"
#include "memory.h"
#include "types.h"

/*
TODO:
- Memory Management
[X] Parse MMAP table
[X] Basic kmalloc
[X] Allocate
[ ] Split memory when needed so you don't allocate lots of memory unnecessarily!
[ ] Basic kfree
- Interrupt Descriptor Table
[ ] Make space for the IDT (figure out memory management first)
[ ] Tell the CPU where that is
[ ] Tell the PIC to screw off with BIOS defaults (https://wiki.osdev.org/PIC#Programming_the_PIC_chips)
[ ] Write a couple of ISR (interrupt service routines) for IRQs and exceptions
[ ] Put the addresses of the ISR handlers in the appropiate descriptors (in the IDT)
[ ] Enable all supported interrupts in the IRQ mask of the PIC
*/

extern "C" {

void kernel_main(void) {
void kernel_main(multiboot_info* mbi) {
// Set up basic environment (screen, interrupts, etc.)
Allocator::init(mbi);
Terminal::init();
Terminal::print("System information:\n");
Terminal::print("KERNEL: PARANOIA\n");
Expand Down

0 comments on commit 7ce3a31

Please sign in to comment.