feat: refactor to use gcc types

This commit is contained in:
2021-02-12 22:16:03 +01:00
parent 555c1177a6
commit 8f615b259c
33 changed files with 419 additions and 361 deletions

View File

@@ -29,8 +29,8 @@ extern void *kernel_start;
typedef struct {
void *address;
u32 length;
u32 type;
uint32_t length;
uint32_t type;
} __attribute((packed)) mmap_entry;
int malloc_entries = 0;
@@ -59,7 +59,7 @@ mmap_entry memmap[MEMMAP_ENTRIES] = {
typedef struct malloc_map {
struct malloc_map *next;
struct malloc_map *pref;
u32 size;
uint32_t size;
int type;
} malloc_map;
@@ -96,8 +96,8 @@ void use_mmap_entry(struct multiboot_mmap_entry *entry) {
}
}
void init_mmap_multiboot(struct multiboot_mmap_entry *entries, u32 count) {
for (u32 i = 0; i < count; ++i) {
void init_mmap_multiboot(struct multiboot_mmap_entry *entries, uint32_t count) {
for (uint32_t i = 0; i < count; ++i) {
use_mmap_entry(&entries[i]);
}
}
@@ -114,7 +114,7 @@ void split_malloc_map(malloc_map *entry, unsigned int size) {
entry->size = size;
}
void *malloc(unsigned int size) {
void *malloc(size_t size) {
// todo replace this horrible mess!
// this lacks any page alignment and what so ever
for (int i = 0; i < MEMMAP_ENTRIES; ++i) {

View File

@@ -7,13 +7,13 @@
#include <multiboot.h>
void init_mmap_multiboot(struct multiboot_mmap_entry *entries, u32 count);
void init_mmap_multiboot(struct multiboot_mmap_entry *entries, uint32_t count);
void print_malloc_info();
void print_mmap_info();
void *malloc(unsigned int size);
void *malloc(size_t size);
void free(void *mem);