aboutsummaryrefslogtreecommitdiff
path: root/src/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel')
-rw-r--r--src/kernel/boot.asm6
-rw-r--r--src/kernel/fs/ata.c2
-rw-r--r--src/kernel/lib/memory.c6
-rw-r--r--src/kernel/linker.ld5
-rw-r--r--src/kernel/memory/alloc.c10
-rw-r--r--src/kernel/memory/paging.c2
-rw-r--r--src/kernel/system.h5
7 files changed, 13 insertions, 23 deletions
diff --git a/src/kernel/boot.asm b/src/kernel/boot.asm
index cc9c674..22d66ad 100644
--- a/src/kernel/boot.asm
+++ b/src/kernel/boot.asm
@@ -44,8 +44,4 @@ section .text
cli
call kernel_main
; cli
- jmp $
-
-section .end_section
- global ASM_KERNEL_END
- ASM_KERNEL_END: \ No newline at end of file
+ jmp $ \ No newline at end of file
diff --git a/src/kernel/fs/ata.c b/src/kernel/fs/ata.c
index d5c758c..2146822 100644
--- a/src/kernel/fs/ata.c
+++ b/src/kernel/fs/ata.c
@@ -81,7 +81,7 @@ void ata_init()
if (sel_base_port == 0)
log("No drives attached! What's going on?");
else {
- log("Found a drive!\nSelected drive is the %s on the %s bus",
+ log("Found drive: Selecting %s on the %s bus",
sel_master_or_slave == SEL_MASTER ? "master" : "slave",
sel_base_port == PRIMARY_BASE ? "primary" : "secondary");
log("Max LBA value is %d", max_sector);
diff --git a/src/kernel/lib/memory.c b/src/kernel/lib/memory.c
index 819a70f..bda3c1b 100644
--- a/src/kernel/lib/memory.c
+++ b/src/kernel/lib/memory.c
@@ -57,11 +57,11 @@ uint32_t memory_get_free()
void memory_print()
{
- if (meminfo != NULL) {
- // TODO: Fix multiboot mem lower/upper
+ // TODO: Fix multiboot mem lower/upper
+ /*if (meminfo != NULL) {
info("Mem lower: 0x%x", meminfo->mem_lower);
info("Mem upper: 0x%x", meminfo->mem_upper);
- }
+ }*/
info("Total memory found: %dMiB", (memory_get_all() >> 10) + 1);
info("Total free memory: %dMiB", (memory_get_free() >> 10) + 1);
}
diff --git a/src/kernel/linker.ld b/src/kernel/linker.ld
index eda4b85..00ffb20 100644
--- a/src/kernel/linker.ld
+++ b/src/kernel/linker.ld
@@ -27,8 +27,5 @@ SECTIONS
*(.bss)
}
- .end_section BLOCK(4K) : ALIGN(4K)
- {
- *(.end_section)
- }
+ end = .; _end = .; __end = .;
} \ No newline at end of file
diff --git a/src/kernel/memory/alloc.c b/src/kernel/memory/alloc.c
index f03c0f5..098eb75 100644
--- a/src/kernel/memory/alloc.c
+++ b/src/kernel/memory/alloc.c
@@ -5,6 +5,7 @@
#include <kernel/system.h>
#include <kernel/lib/lib.h>
+extern uint32_t end;
uint32_t placement_address;
struct heap_header *kheap = NULL;
@@ -12,7 +13,8 @@ struct heap_header *uheap = NULL;
void kheap_init()
{
- placement_address = &ASM_KERNEL_END;
+ end = &end;
+ placement_address = end;
kheap = (struct heap_header *)fmalloc(KHEAP_SIZE);
init_heap(kheap, KHEAP_SIZE);
@@ -24,7 +26,7 @@ void kheap_init()
void *fmalloc(uint32_t size)
{
- //assert(placement_address + size < MEM_END);
+ assert(placement_address + size < MEM_END);
uint32_t hold = placement_address;
memset((void *)hold, 0, size);
placement_address += size;
@@ -33,7 +35,7 @@ void *fmalloc(uint32_t size)
void *kmalloc_a(uint32_t size)
{
- //assert(((placement_address & 0xFFFFF000) + 0x1000) + size < MEM_END);
+ assert(((placement_address & 0xFFFFF000) + 0x1000) + size < MEM_END);
placement_address &= 0xFFFFF000;
placement_address += 0x1000;
@@ -94,7 +96,7 @@ void free_internal(struct heap_header *heap, void *address)
{
struct heap_header *head = (struct heap_header *)((uint32_t)address - HEAP_S);
if (head == heap) {
- warn("Can't collapse top of heap");
+ //warn("Can't collapse top of heap"); // TODO: Fix "can't collapse top of heap" at start
head->free = true;
return;
}
diff --git a/src/kernel/memory/paging.c b/src/kernel/memory/paging.c
index ed06004..19ec11d 100644
--- a/src/kernel/memory/paging.c
+++ b/src/kernel/memory/paging.c
@@ -126,7 +126,7 @@ void paging_install()
info("Installed paging");
// Test mallocing
- uintptr_t a = (uintptr_t)kmalloc(4096); // TODO: Fix "can't collapse top of heap"
+ uintptr_t a = (uintptr_t)kmalloc(4096);
uintptr_t b = (uintptr_t)kmalloc(4096);
kfree((void *)b);
kfree((void *)a);
diff --git a/src/kernel/system.h b/src/kernel/system.h
index 06a2378..2e4786d 100644
--- a/src/kernel/system.h
+++ b/src/kernel/system.h
@@ -6,11 +6,6 @@
#include <kernel/multiboot.h>
/**
- * The kernel end
- */
-extern void ASM_KERNEL_END();
-
-/**
* The ASM registers as packed structure
*/
typedef struct __attribute__((packed)) {