1
0
Fork 0
mirror of https://github.com/tailix/kernel.git synced 2025-07-31 22:00:58 -04:00

Remove memory module

This commit is contained in:
Braiden Vasco 2017-11-04 10:19:53 +00:00
parent f33dd3c9f8
commit 70bcb07df3
5 changed files with 23 additions and 38 deletions

View file

@ -10,7 +10,6 @@ OBJS += console.c.o
OBJS += kprintf.c.o
OBJS += multiboot.c.o
OBJS += memory.c.o
OBJS += kmalloc.c.o
OBJS += paging.c.o

View file

@ -1,14 +1,27 @@
#include "console.h"
#include "logger.h"
#include "kprintf.h"
#include "multiboot.h"
#include "memory.h"
#include <kernelmq/info.h>
#include <kernelmq/stdlib.h>
// Defined in linker script
extern char _kernel_offset;
extern char _kernel_phys_base;
extern char _kernel_virt_base;
static struct KernelMQ_Info kinfo;
void init(struct KernelMQ_Multiboot_Info multiboot_info)
{
kmemset(&kinfo, 0, sizeof(struct KernelMQ_Info));
kinfo.kernel_offset = (unsigned long)&_kernel_offset;
kinfo.kernel_phys_base = (unsigned long)&_kernel_phys_base;
kinfo.kernel_virt_base = (unsigned long)&_kernel_virt_base;
console_initialize();
logger_info("Multiboot info:");
@ -17,5 +30,10 @@ void init(struct KernelMQ_Multiboot_Info multiboot_info)
logger_info("Virtual memory info:");
print_memory_info();
kprintf(
"0x%x (phys base) + 0x%x (offset) = 0x%x (virt base)\n",
kinfo.kernel_phys_base,
kinfo.kernel_offset,
kinfo.kernel_virt_base
);
}

View file

@ -1,10 +1,10 @@
OUTPUT_ARCH("i386")
ENTRY(_start)
_memory_offset = 0xC0000000; /* 3 GB */
_kernel_offset = 0xC0000000; /* 3 GB */
_memory_phys_base = 4M;
_memory_virt_base = (_memory_phys_base + _memory_offset);
_kernel_phys_base = 4M;
_kernel_virt_base = (_kernel_phys_base + _kernel_offset);
SECTIONS
{

View file

@ -1,22 +0,0 @@
#include "memory.h"
#include "kprintf.h"
// Defined in linker script
extern char _memory_offset;
extern char _memory_phys_base;
extern char _memory_virt_base;
const unsigned int memory_offset = (unsigned int)&_memory_offset;
const unsigned int memory_phys_base = (unsigned int)&_memory_phys_base;
const unsigned int memory_virt_base = (unsigned int)&_memory_virt_base;
void print_memory_info()
{
kprintf(
"0x%x (phys base) + 0x%x (offset) = 0x%x (virt base)\n",
memory_phys_base,
memory_offset,
memory_virt_base
);
}

View file

@ -1,10 +0,0 @@
#ifndef KERNELMQ_INCLUDED_MEMORY
#define KERNELMQ_INCLUDED_MEMORY 1
extern const unsigned int memory_offset;
extern const unsigned int memory_phys_base;
extern const unsigned int memory_virt_base;
void print_memory_info();
#endif