From 10069f8263fb0103d5d9513b742b30532f6cbcfd Mon Sep 17 00:00:00 2001 From: Xircon Date: Sat, 7 Mar 2026 16:07:19 -0500 Subject: [PATCH] Basically I Removed the need for multiboot lol --- CoC.md | 5 +++++ LICENSE | 9 +++++++-- README.md | 3 ++- build.sh | 6 +++--- grub/grub.cfg | 2 -- src/kernel/arch/i686/util.asm | 2 +- src/kernel/arch/i686/util.h | 2 +- src/kernel/core/dma/dma.c | 2 +- src/kernel/core/memory/{allocator.c => alloc.c} | 10 +++++++--- src/kernel/core/memory/{allocator.h => alloc.h} | 2 +- src/kernel/core/memory/page.c | 2 +- src/kernel/core/memory/page.h | 11 +++++++++-- src/kernel/dri/cmos.c | 12 +++++++++++- src/kernel/dri/cmos.h | 4 +++- src/kernel/main.c | 10 +++++----- src/kernel/version.h | 4 ++-- 16 files changed, 59 insertions(+), 27 deletions(-) create mode 100644 CoC.md rename src/kernel/core/memory/{allocator.c => alloc.c} (67%) rename src/kernel/core/memory/{allocator.h => alloc.h} (91%) diff --git a/CoC.md b/CoC.md new file mode 100644 index 0000000..73de11e --- /dev/null +++ b/CoC.md @@ -0,0 +1,5 @@ +# NANITE CODE OF CONDUCT (CoC) +Its simple really... just a few rules. +## Rules +- Don't use AI (For anything, ever. Not code. not translations. NOTHING) +- Be a decent human being (don't be a dick) \ No newline at end of file diff --git a/LICENSE b/LICENSE index 62691da..eb640aa 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ -BSD 3-Clause License +NANITE Licence (Modified BSD 3-Clause) -Copyright (c) 2025, Tyler McGurrin +Copyright (c) 2026, Xircon Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -16,6 +16,11 @@ modification, are permitted provided that the following conditions are met: contributors may be used to endorse or promote products derived from this software without specific prior written permission. +4. This Software Shall NEVER be used For Training an AI Model. + +5. Any device this software ships with MUST allow the user to reinstall the base + version of the software with ZERO RESTRICTIONS on Functionality. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE diff --git a/README.md b/README.md index 893de96..52e83b6 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Note: Kernel is currently under very heavy development. All things are subject to change at any time. ## Building -Run `./build.sh` inside main directory of repo +Run `./build.sh` inside main directory of repo, however you may first need to run `make toolchain` i would DEFINITELY use more than one job (building GCC takes forever) To write to a disk, use `./write.sh` WARNING: **is hard coded to /dev/sdb** (sorry i suck at scripting) @@ -43,6 +43,7 @@ You could also run `make all` but the scripts a bit better tbh, it even automate ## How is Testing Done Testing is mostly done with QEMU These days, but I do sometimes pull out my Dell Latitude D610 to test on real hardware (for anyone wondering its completely maxed out. [2GB of ram Pentium M @ 2.23GHz]) +I Also do some testing on a Dell Dimension 8110 (its at my desk 24/7 and has its serial port hooked to my desktop, lol) ## Thanks! Resources I've Used Throughout the Project diff --git a/build.sh b/build.sh index cb67af8..6c215a1 100755 --- a/build.sh +++ b/build.sh @@ -11,7 +11,7 @@ case $yn in echo Removing Old Build Files...; echo ---------------------------; - make clean; + make -j24 clean; echo -----; echo Done!; echo -----; @@ -26,7 +26,7 @@ echo ------------ echo COMPILING OS echo ------------ -make -s +make -j24 -s echo --------- echo Finished! @@ -87,7 +87,7 @@ case $yn in -audiodev pa,id=speaker \ -machine pcspk-audiodev=speaker \ -hda build/main.img \ - -m size=512M + -m size=16M echo -------- echo Finshed! echo -------- diff --git a/grub/grub.cfg b/grub/grub.cfg index 7267caa..eef97ed 100644 --- a/grub/grub.cfg +++ b/grub/grub.cfg @@ -7,13 +7,11 @@ set root='hd0,1' set gfxmode=800x600 insmod all_video -insmod gfxterm set locale_dir=$prefix/locale set lang=en_CA insmod gettext terminal_input console -terminal_output gfxterm insmod gfxmenu # loadfont /boot/grub/themes/nanite/font10.pf2 diff --git a/src/kernel/arch/i686/util.asm b/src/kernel/arch/i686/util.asm index dabfc5e..9e9c76e 100644 --- a/src/kernel/arch/i686/util.asm +++ b/src/kernel/arch/i686/util.asm @@ -1,6 +1,6 @@ ;/////////////////////; ;Nanite OS ; -;COPYRIGHT (C) 2025 ; +;COPYRIGHT (C) 2026 ; ;Tyler McGurrin ; ;/////////////////////; [bits 32] diff --git a/src/kernel/arch/i686/util.h b/src/kernel/arch/i686/util.h index 7f8db63..a899765 100644 --- a/src/kernel/arch/i686/util.h +++ b/src/kernel/arch/i686/util.h @@ -1,6 +1,6 @@ /*----------------*\ |Nanite OS | -|Copyright (C) 2024| +|Copyright (C) 2026| |Tyler McGurrin | \*----------------*/ #pragma once diff --git a/src/kernel/core/dma/dma.c b/src/kernel/core/dma/dma.c index 376a403..d38c919 100644 --- a/src/kernel/core/dma/dma.c +++ b/src/kernel/core/dma/dma.c @@ -1,6 +1,6 @@ /*----------------*\ |Nanite OS | -|Copyright (C) 2025| +|Copyright (C) 2026| |Tyler McGurrin | \*----------------*/ #include "dma.h" diff --git a/src/kernel/core/memory/allocator.c b/src/kernel/core/memory/alloc.c similarity index 67% rename from src/kernel/core/memory/allocator.c rename to src/kernel/core/memory/alloc.c index dec19a8..3ecfda4 100644 --- a/src/kernel/core/memory/allocator.c +++ b/src/kernel/core/memory/alloc.c @@ -1,9 +1,9 @@ /*----------------*\ |Nanite OS | -|Copyright (C) 2024| +|Copyright (C) 2026| |Tyler McGurrin | \*----------------*/ -#include "allocator.h" +#include "alloc.h" #include #include @@ -11,6 +11,10 @@ extern uint16_t DEBUG_COM_PORT; -void alloc(size_t size) { +void malloc(size_t size) { +} + +void free() { + } \ No newline at end of file diff --git a/src/kernel/core/memory/allocator.h b/src/kernel/core/memory/alloc.h similarity index 91% rename from src/kernel/core/memory/allocator.h rename to src/kernel/core/memory/alloc.h index 4476f21..eaf3309 100644 --- a/src/kernel/core/memory/allocator.h +++ b/src/kernel/core/memory/alloc.h @@ -1,6 +1,6 @@ /*----------------*\ |Nanite OS | -|Copyright (C) 2024| +|Copyright (C) 2026| |Tyler McGurrin | \*----------------*/ #pragma once diff --git a/src/kernel/core/memory/page.c b/src/kernel/core/memory/page.c index 319af8e..cb11332 100644 --- a/src/kernel/core/memory/page.c +++ b/src/kernel/core/memory/page.c @@ -1,6 +1,6 @@ /*----------------*\ |Nanite OS | -|Copyright (C) 2024| +|Copyright (C) 2026| |Tyler McGurrin | \*----------------*/ #include "page.h" diff --git a/src/kernel/core/memory/page.h b/src/kernel/core/memory/page.h index 736dabe..f1a9cd8 100644 --- a/src/kernel/core/memory/page.h +++ b/src/kernel/core/memory/page.h @@ -1,8 +1,15 @@ /*----------------*\ |Nanite OS | -|Copyright (C) 2024| +|Copyright (C) 2026| |Tyler McGurrin | \*----------------*/ #pragma once -void Memory_Page_Init(); \ No newline at end of file +#include + +void Memory_Page_Init(); + +struct page { + char value[4096]; + uint32_t page_number; +}; \ No newline at end of file diff --git a/src/kernel/dri/cmos.c b/src/kernel/dri/cmos.c index 7bf350d..edb6868 100644 --- a/src/kernel/dri/cmos.c +++ b/src/kernel/dri/cmos.c @@ -1,6 +1,6 @@ /*----------------*\ |Nanite OS | -|Copyright (C) 2025| +|Copyright (C) 2026| |Tyler McGurrin | \*----------------*/ #include "cmos.h" @@ -85,3 +85,13 @@ int Slave_FDD_Detect() } return FDDType; } + +// Basic, However Good Enough. Not like i'll ever support UEFI Lol +int Detect_Memory() { + outb(CMOS_ADDPORT, 0x30); + int lowmem = inb(CMOS_DATAPORT); + outb(CMOS_ADDPORT, 0x31); + int highmem = inb(CMOS_DATAPORT); + + return lowmem | highmem << 8; +} \ No newline at end of file diff --git a/src/kernel/dri/cmos.h b/src/kernel/dri/cmos.h index 2d7e89b..eecd114 100644 --- a/src/kernel/dri/cmos.h +++ b/src/kernel/dri/cmos.h @@ -1,6 +1,6 @@ /*----------------*\ |Nanite OS | -|Copyright (C) 2025| +|Copyright (C) 2026| |Tyler McGurrin | \*----------------*/ #pragma once @@ -10,6 +10,8 @@ void CMOS_RTC_Handler(); int Master_FDD_Detect(); int Slave_FDD_Detect(); + +int Detect_Memory(); uint8_t Read_CMOS(uint8_t Register); enum CMOSRegisters diff --git a/src/kernel/main.c b/src/kernel/main.c index c9e648a..7fb80f1 100644 --- a/src/kernel/main.c +++ b/src/kernel/main.c @@ -49,8 +49,10 @@ extern uint8_t __end; extern int uptime; +int Memory; // Amount of Available RAM To OS + uint16_t DEBUG_COM_PORT = COM1_PORT; -void start(unsigned long multiboot_magic, unsigned long multiboot_addr) { +void start() { // Print logo clrscr(); @@ -75,13 +77,11 @@ void start(unsigned long multiboot_magic, unsigned long multiboot_addr) { printf("Done!\n"); printf("Initializing Memory Paging..."); + Memory = Detect_Memory(); + Serial_Printf(DEBUG_COM_PORT, "MEMORY:> There is %dKB of Memory Available\n", Memory); Memory_Page_Init(); printf("Done!\n"); - // Multiboot Debug Info - Serial_Printf(DEBUG_COM_PORT, "Multiboot Magic: %d\n", multiboot_magic); - Serial_Printf(DEBUG_COM_PORT, "Multiboot Address: %d\n", multiboot_addr); - // Finish Up printf("The Current Time and Date Is: %d:%d:%d %d/%d/%d%d\n", BCD2BIN(Read_CMOS(CMOS_RTC_Hours)), diff --git a/src/kernel/version.h b/src/kernel/version.h index 849dc6b..2f895b8 100644 --- a/src/kernel/version.h +++ b/src/kernel/version.h @@ -1,9 +1,9 @@ /*----------------*\ |Nanite OS | -|Copyright (C) 2024| +|Copyright (C) 2026| |Tyler McGurrin | \*----------------*/ #pragma once #define LOGO " _ _____ _ __________________\n / | / / | / | / / _/_ __/ ____/\n / |/ / /| | / |/ // / / / / __/ \n / /| / ___ |/ /| // / / / / /___ \n/_/ |_/_/ |_/_/ |_/___/ /_/ /_____/ \n" -#define VERSION "RD-00052" \ No newline at end of file +#define VERSION "RD-00053" \ No newline at end of file