This commit is contained in:
nub31
2025-09-03 14:31:07 +02:00
parent 08bbe517c5
commit a1205703f0
4 changed files with 17 additions and 10 deletions

View File

@@ -13,6 +13,3 @@ CompileFlags:
- "-nostdlib"
- "-I"
- "/home/oliste/repos/nub-os/src/stdlib"
Style:
AngledHeaders: "src/stdlib/.*"

View File

@@ -2,6 +2,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
typedef struct
{
@@ -25,9 +26,11 @@ void register_irq_handler(uint8_t irq, irq_handler_t handler);
static inline void enable_interrupts()
{
__asm__ volatile("sti");
printf("Interrupts enabled\n");
}
static inline void disable_interrupts()
{
__asm__ volatile("cli");
printf("Interrupts disabled\n");
}

View File

@@ -24,14 +24,22 @@ void map_memory(multiboot_info_t* mbd)
{
multiboot_memory_map_t* mmmt = (multiboot_memory_map_t*)(mbd->mmap_addr + offset);
if (mmmt->type == MULTIBOOT_MEMORY_AVAILABLE && num_regions < USABLE_REGION_SIZE)
if (mmmt->type == MULTIBOOT_MEMORY_AVAILABLE)
{
usable_regions[num_regions] = (memory_region_t){
.base_address = mmmt->addr,
.length = mmmt->len,
};
if (num_regions < USABLE_REGION_SIZE)
{
usable_regions[num_regions] = (memory_region_t){
.base_address = mmmt->addr,
.length = mmmt->len,
};
num_regions++;
num_regions++;
}
else
{
printf("System has more memory than the memory map can hold\n");
break;
}
}
offset += mmmt->size + sizeof(mmmt->size);

View File

@@ -1,7 +1,6 @@
global _start
extern entry
extern handle_isr
extern pml4
%define FLAGS 0b10
%define MAGIC 0x1BADB002