Memory struct

This commit is contained in:
Adrien Bourmault 2019-03-18 17:43:41 +01:00
parent 8c4a96a9f6
commit 918c4f1b2e
6 changed files with 43 additions and 25 deletions

View File

@ -127,7 +127,7 @@ $(KOBJDIR)/prog.o: $(KERNELDIR)/extras/prog.c
kal_kern_obj= $(KOBJDIR)/kernel/cpuid.o $(KOBJDIR)/kernel/init.o \
$(KOBJDIR)/kernel/table.o $(KOBJDIR)/kernel/cursor.o \
$(KOBJDIR)/kernel/term.o $(KOBJDIR)/kernel/vga.o \
$(KOBJDIR)/kernel/panic.o
$(KOBJDIR)/kernel/panic.o $(KOBJDIR)/kernel/map.o \
$(KOBJDIR)/kernel/cpuid.o: $(KERNELDIR)/kernel/cpu/cpuid.c
@$(KCC) $< -o $@
@ -150,6 +150,9 @@ $(KOBJDIR)/kernel/vga.o: $(KERNELDIR)/kernel/io/vga.c
$(KOBJDIR)/kernel/panic.o: $(KERNELDIR)/kernel/ke/panic.c
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/map.o: $(KERNELDIR)/kernel/mm/map.c
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
## MISC MAKEFILE ------------------------------------------------------------- #
./ProjectTree: ./.stylehlp_sh

View File

@ -42,6 +42,7 @@ typedef struct Terminal_t Terminal_t;
typedef struct ListHead_t ListHead_t;
typedef struct ListNode_t ListNode_t;
typedef struct Processor_t Processor_t;
typedef struct MemoryMap_t MemoryMap_t;
typedef enum ProcState_t ProcState_t;
typedef enum TermColor_t TermColor_t;
@ -96,11 +97,17 @@ struct Processor_t
ListHead_t *timeCritProcs;
};
struct MemoryMap_t
{
void *addr;
int length;
};
//------------------------------------------//
extern int cpuCount;
extern Processor_t cpuTable[NCPUS];
extern MemoryMap_t memTab;
//------------------------------------------//
#define DEC_PER_CPU(name, field, type) \

View File

@ -21,3 +21,20 @@
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//
#include <multiboot/multiboot.h>
#include <kernel/base.h>
#define GetCurMemMap() (memTab)
//
// Returns a pointer to the first entry of the memory map
//
multiboot_memory_map_t *GetMemoryMap(void);
//
// Initializes the memory map structure
//
void InitMemoryMap(multiboot_info_t *mbInfo);
// -------------------------------------------------------------------------- //

View File

@ -24,9 +24,7 @@
#include <multiboot/multiboot.h>
#include <kernel/term.h>
#include <kernel/panic.h>
extern void testf(void);
#include <kernel/mm.h>
//
// Entry point of the Kaleid kernel
@ -39,21 +37,12 @@ noreturn void StartKern(multiboot_info_t *mbInfo, int mbMagic)
// Kernel terminals
InitTerms();
// We're out
StartPanic( "We were loaded by : %s\n\n\n"
"We get\n"
" *mbInfo : %p\n"
" mbMagic : %x\n"
" mbBootdrv : %x\n"
" *mbMmap : %p\n"
" `-length : %d\n"
"\nGoodbye World :(",
//Memory mapping
InitMemoryMap(mbInfo);
mbInfo->boot_loader_name,
mbInfo,
mbMagic,
mbInfo->boot_device,
mbInfo->mmap_addr,
mbInfo->mmap_length
);
KernLog("InitMemoryMap : %p, %x\n", GetCurMemMap().addr, GetCurMemMap().length );
// We're out
KernLog("Yup, we have magic : %x", mbMagic);
CrashSystem(); //yay
}

View File

@ -27,5 +27,7 @@
int cpuCount = 1;
Processor_t cpuTable[NCPUS] = {0};
MemoryMap_t memTab = {0};
Terminal_t *stdOut = 0, *stdDbg = 0;