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

View File

@ -42,6 +42,7 @@ typedef struct Terminal_t Terminal_t;
typedef struct ListHead_t ListHead_t; typedef struct ListHead_t ListHead_t;
typedef struct ListNode_t ListNode_t; typedef struct ListNode_t ListNode_t;
typedef struct Processor_t Processor_t; typedef struct Processor_t Processor_t;
typedef struct MemoryMap_t MemoryMap_t;
typedef enum ProcState_t ProcState_t; typedef enum ProcState_t ProcState_t;
typedef enum TermColor_t TermColor_t; typedef enum TermColor_t TermColor_t;
@ -96,11 +97,17 @@ struct Processor_t
ListHead_t *timeCritProcs; ListHead_t *timeCritProcs;
}; };
struct MemoryMap_t
{
void *addr;
int length;
};
//------------------------------------------// //------------------------------------------//
extern int cpuCount; extern int cpuCount;
extern Processor_t cpuTable[NCPUS]; extern Processor_t cpuTable[NCPUS];
extern MemoryMap_t memTab;
//------------------------------------------// //------------------------------------------//
#define DEC_PER_CPU(name, field, type) \ #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 // // You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // 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 <multiboot/multiboot.h>
#include <kernel/term.h> #include <kernel/term.h>
#include <kernel/panic.h> #include <kernel/panic.h>
#include <kernel/mm.h>
extern void testf(void);
// //
// Entry point of the Kaleid kernel // Entry point of the Kaleid kernel
@ -39,21 +37,12 @@ noreturn void StartKern(multiboot_info_t *mbInfo, int mbMagic)
// Kernel terminals // Kernel terminals
InitTerms(); InitTerms();
// We're out //Memory mapping
StartPanic( "We were loaded by : %s\n\n\n" InitMemoryMap(mbInfo);
"We get\n"
" *mbInfo : %p\n"
" mbMagic : %x\n"
" mbBootdrv : %x\n"
" *mbMmap : %p\n"
" `-length : %d\n"
"\nGoodbye World :(",
mbInfo->boot_loader_name, KernLog("InitMemoryMap : %p, %x\n", GetCurMemMap().addr, GetCurMemMap().length );
mbInfo,
mbMagic, // We're out
mbInfo->boot_device, KernLog("Yup, we have magic : %x", mbMagic);
mbInfo->mmap_addr, CrashSystem(); //yay
mbInfo->mmap_length
);
} }

View File

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