1
0
mirror of https://gitlab.os-k.eu/os-k-team/os-k.git synced 2023-08-25 14:03:10 +02:00
This commit is contained in:
Adrien Bourmault 2019-03-26 17:50:03 +01:00
parent f67e1baa25
commit 669236cea1
6 changed files with 46 additions and 32 deletions

View File

@ -125,16 +125,20 @@ $(KOBJDIR)/prog.o: $(KERNELDIR)/extras/prog.c $(KERNELDIR)/include/*/*.h
# Kernel objects
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/map.o \
$(KOBJDIR)/kernel/heap.o $(KOBJDIR)/kernel/malloc.o \
$(KOBJDIR)/kernel/buf.o $(KOBJDIR)/kernel/sched.o \
$(KOBJDIR)/kernel/bput.o $(KOBJDIR)/kernel/bprint.o \
$(KOBJDIR)/kernel/table.o $(KOBJDIR)/kernel/cursor.o \
$(KOBJDIR)/kernel/term.o $(KOBJDIR)/kernel/vga.o \
$(KOBJDIR)/kernel/panic.o $(KOBJDIR)/kernel/map.o \
$(KOBJDIR)/kernel/heap.o $(KOBJDIR)/kernel/malloc.o \
$(KOBJDIR)/kernel/buf.o $(KOBJDIR)/kernel/sched.o \
$(KOBJDIR)/kernel/bput.o $(KOBJDIR)/kernel/bprint.o \
$(KOBJDIR)/kernel/gdt.o $(KOBJDIR)/kernel/gdt.o
$(KOBJDIR)/kernel/cpuid.o: $(KERNELDIR)/kernel/cpu/cpuid.c $(KERNELDIR)/include/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/idt.o: $(KERNELDIR)/kernel/cpu/idt.c $(KERNELDIR)/include/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/init.o: $(KERNELDIR)/kernel/init/init.c $(KERNELDIR)/include/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
@ -161,6 +165,8 @@ $(KOBJDIR)/kernel/heap.o: $(KERNELDIR)/kernel/mm/heap.c $(KERNELDIR)/include/*/*
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/malloc.o: $(KERNELDIR)/kernel/mm/malloc.c $(KERNELDIR)/include/*/*.h
@$(KCC) $< -o $@
$(KOBJDIR)/kernel/gdt.o: $(KERNELDIR)/kernel/mm/gdt.c $(KERNELDIR)/include/*/*.h
@$(KCC) $< -o $@
@echo ${CL2}[$@] ${CL}Compiled.${CL3}
$(KOBJDIR)/kernel/buf.o: $(KERNELDIR)/kernel/buf/buf.c $(KERNELDIR)/include/*/*.h
@$(KCC) $< -o $@

View File

@ -61,6 +61,7 @@
│   │   │   ├── buf.o
│   │   │   ├── cpuid.o
│   │   │   ├── cursor.o
│   │   │   ├── gdt.o
│   │   │   ├── heap.o
│   │   │   ├── init.o
│   │   │   ├── malloc.o
@ -151,10 +152,10 @@
│   ├── ke
│   │   └── panic.c
│   ├── mm
│   │   ├── gdt.c
│   │   ├── heap.c
│   │   ├── malloc.c
│   │   ├── map.c
│   │   └── stack.c
│   │   └── map.c
│   └── proc
│   ├── Makefile
│   └── sched.c
@ -169,4 +170,4 @@
├── qemu.log
└── Readme.md
28 directories, 116 files
28 directories, 117 files

View File

@ -37,6 +37,8 @@
typedef struct MemoryMap_t MemoryMap_t;
typedef struct MapEntry_t MapEntry_t;
typedef struct GdtEntry_t GdtEntry_t;
typedef struct GdtPtr_t GdtPtr_t;
// -------------------------------------------------------------------------- //
// The entry structure of the map
@ -54,7 +56,23 @@ struct MemoryMap_t {
MapEntry_t entry[MAX_ENTRIES];
} __attribute__((__packed__));
// The gdt
struct GdtEntry_t
{
ushort lowLimit; // lower 16 bits
ushort lowBase; // lower 16 bits
uchar middleBase; // next 8 bits
uchar access; // determine what ring this segment can be used in
uchar granularity;
uchar highBase; // last 8 bits
} __attribute__((packed));
struct GdtPtr_t
{
uchar limit; // upper 16 bits
ushort base; // address of the first entry
}
__attribute__((packed));
// -------------------------------------------------------------------------- //
@ -71,6 +89,11 @@ size_t MmGetAvailZoneSize(void *start);
//
// Returns the first available memory zone from the start address pointer
//
void *MmGetFirstAvailZone(void *start);
//
// Initialize the descriptor table
//
void MmInitGdt(void);
// -------------------------------------------------------------------------- //

View File

@ -28,6 +28,7 @@
//
static inline void lidt(void* idtAddr, ushort size)
{
// The IDTR register structure that will be sent
struct {
ushort length;
void* base;

View File

@ -150,6 +150,12 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, int mbMagic)
//if(rc)KernLog("error\n");
//KernLog((char*)buf->buf);
uchar *addr = (uchar *)(ullong)(1024*MB - 1);
KernLog("Test, valeur autour de %p: %hhu\n", addr, *addr);
*addr = 1;
KernLog("Test, valeur autour de %p: %hhu\n", addr, *addr);
// We're out
PsFiniSched();
KeCrashSystem(); //yay

View File

@ -1,23 +0,0 @@
//----------------------------------------------------------------------------//
// GNU GPL OS/K //
// //
// Desc: Mapping and checking memory related functions //
// //
// //
// Copyright © 2018-2019 The OS/K Team //
// //
// This file is part of OS/K. //
// //
// OS/K is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// any later version. //
// //
// OS/K is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY//without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------//