Memory Management is Brutal...
This commit is contained in:
parent
5eed6d0590
commit
cbefa0c30c
6
build.sh
6
build.sh
@ -38,12 +38,14 @@ case $yn in
|
|||||||
echo -------------
|
echo -------------
|
||||||
echo STARTING QEMU
|
echo STARTING QEMU
|
||||||
echo -------------
|
echo -------------
|
||||||
qemu-system-i386 -chardev pty,id=serial1 \
|
qemu-system-i386 \
|
||||||
|
-chardev pty,id=serial1 \
|
||||||
-serial mon:stdio \
|
-serial mon:stdio \
|
||||||
-serial chardev:serial1 \
|
-serial chardev:serial1 \
|
||||||
-audiodev pa,id=speaker \
|
-audiodev pa,id=speaker \
|
||||||
-machine pcspk-audiodev=speaker \
|
-machine pcspk-audiodev=speaker \
|
||||||
-fda build/main_floppy.img
|
-fda build/main_floppy.img \
|
||||||
|
-m size=512M
|
||||||
echo --------
|
echo --------
|
||||||
echo Finshed!
|
echo Finshed!
|
||||||
echo --------
|
echo --------
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
/*----------------*\
|
|
||||||
|Nanite OS |
|
|
||||||
|Copyright (C) 2024|
|
|
||||||
|Tyler McGurrin |
|
|
||||||
\*----------------*/
|
|
||||||
#include "basicfunc.h"
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
/*----------------*\
|
|
||||||
|Nanite OS |
|
|
||||||
|Copyright (C) 2024|
|
|
||||||
|Tyler McGurrin |
|
|
||||||
\*----------------*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
void __attribute__((cdecl)) Reboot();
|
|
||||||
@ -14,3 +14,31 @@ Reboot:
|
|||||||
|
|
||||||
MOV AL, 0xFC
|
MOV AL, 0xFC
|
||||||
OUT 0x64, AL
|
OUT 0x64, AL
|
||||||
|
|
||||||
|
global Read_CR0
|
||||||
|
Read_CR0:
|
||||||
|
mov eax, cr0
|
||||||
|
retn
|
||||||
|
|
||||||
|
global Write_CR0
|
||||||
|
Write_CR0:
|
||||||
|
push ebp
|
||||||
|
mov ebp, esp
|
||||||
|
mov eax, [ebp+8]
|
||||||
|
mov cr0, eax
|
||||||
|
pop ebp
|
||||||
|
retn
|
||||||
|
|
||||||
|
global Read_CR3
|
||||||
|
Read_CR3:
|
||||||
|
mov eax, cr3
|
||||||
|
retn
|
||||||
|
|
||||||
|
global Write_CR3
|
||||||
|
Write_CR3:
|
||||||
|
push ebp
|
||||||
|
mov ebp, esp
|
||||||
|
mov eax, [ebp+8]
|
||||||
|
mov cr3, eax
|
||||||
|
pop ebp
|
||||||
|
retn
|
||||||
@ -3,4 +3,4 @@
|
|||||||
|Copyright (C) 2024|
|
|Copyright (C) 2024|
|
||||||
|Tyler McGurrin |
|
|Tyler McGurrin |
|
||||||
\*----------------*/
|
\*----------------*/
|
||||||
#include "phys_mem.h"
|
#include "util.h"
|
||||||
14
src/kernel/arch/i686/util.h
Normal file
14
src/kernel/arch/i686/util.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*----------------*\
|
||||||
|
|Nanite OS |
|
||||||
|
|Copyright (C) 2024|
|
||||||
|
|Tyler McGurrin |
|
||||||
|
\*----------------*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
void __attribute__((cdecl)) Reboot();
|
||||||
|
void __attribute__((cdecl)) Read_CR0();
|
||||||
|
void __attribute__((cdecl)) Write_CR0(uint8_t value);
|
||||||
|
void __attribute__((cdecl)) Read_CR3();
|
||||||
|
void __attribute__((cdecl)) Write_CR3(uint8_t value);
|
||||||
9
src/kernel/core/memory/page.c
Normal file
9
src/kernel/core/memory/page.c
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/*----------------*\
|
||||||
|
|Nanite OS |
|
||||||
|
|Copyright (C) 2024|
|
||||||
|
|Tyler McGurrin |
|
||||||
|
\*----------------*/
|
||||||
|
#include "page.h"
|
||||||
|
|
||||||
|
unsigned long* Page_Directory = (unsigned long*) 0x9c000;
|
||||||
|
unsigned long* Page_Table = (unsigned long*) 0x9d000
|
||||||
@ -9,7 +9,7 @@
|
|||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <arch/i686/irq.h>
|
#include <arch/i686/irq.h>
|
||||||
#include <arch/i686/io.h>
|
#include <arch/i686/io.h>
|
||||||
#include <arch/i686/basicfunc.h>
|
#include <arch/i686/util.h>
|
||||||
#include <dri/serial.h>
|
#include <dri/serial.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <arch/i686/io.h>
|
#include <arch/i686/io.h>
|
||||||
#include <arch/i686/irq.h>
|
#include <arch/i686/irq.h>
|
||||||
#include <arch/i686/basicfunc.h>
|
#include <arch/i686/util.h>
|
||||||
#include <dri/keyboard.h>
|
#include <dri/keyboard.h>
|
||||||
#include <dri/cmos.h>
|
#include <dri/cmos.h>
|
||||||
#include <dri/serial.h>
|
#include <dri/serial.h>
|
||||||
@ -64,7 +64,7 @@ void __attribute__((section(".entry"))) start(BootParams* bootParams) {
|
|||||||
printf("Initializing Basic Drivers...");
|
printf("Initializing Basic Drivers...");
|
||||||
Serial_Init(DEBUG_COM_PORT, 9600);
|
Serial_Init(DEBUG_COM_PORT, 9600);
|
||||||
Keyboard_Init();
|
Keyboard_Init();
|
||||||
Floppy_Init(); // This should always be last; its slow as fuck
|
// Floppy_Init(); // This should always be last; its slow as fuck
|
||||||
printf("Done!\n");
|
printf("Done!\n");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,5 +6,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define LOGO " _ _____ _ __________________\n / | / / | / | / / _/_ __/ ____/\n / |/ / /| | / |/ // / / / / __/ \n / /| / ___ |/ /| // / / / / /___ \n/_/ |_/_/ |_/_/ |_/___/ /_/ /_____/ \n"
|
#define LOGO " _ _____ _ __________________\n / | / / | / | / / _/_ __/ ____/\n / |/ / /| | / |/ // / / / / __/ \n / /| / ___ |/ /| // / / / / /___ \n/_/ |_/_/ |_/_/ |_/___/ /_/ /_____/ \n"
|
||||||
#define VERSION "RD-00034"
|
#define VERSION "RD-00035"
|
||||||
#define BOOTLOGO " _ ______ ____ ____ ______\n / | / / __ )/ __ \\/ __ /_ __/\n / |/ / __ / / / / / / // / \n / /| / /_/ / /_/ / /_/ // / \n/_/ |_/_____/\\____/\\____//_/ \n"
|
#define BOOTLOGO " _ ______ ____ ____ ______\n / | / / __ )/ __ \\/ __ /_ __/\n / |/ / __ / / / / / / // / \n / /| / /_/ / /_/ / /_/ // / \n/_/ |_/_____/\\____/\\____//_/ \n"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user