diff --git a/.vscode/browse.vc.db b/.vscode/browse.vc.db index d3ab55d..7a3a68d 100644 Binary files a/.vscode/browse.vc.db and b/.vscode/browse.vc.db differ diff --git a/.vscode/browse.vc.db-shm b/.vscode/browse.vc.db-shm index d187c5c..b388bf7 100644 Binary files a/.vscode/browse.vc.db-shm and b/.vscode/browse.vc.db-shm differ diff --git a/.vscode/browse.vc.db-wal b/.vscode/browse.vc.db-wal index e69de29..a52d088 100644 Binary files a/.vscode/browse.vc.db-wal and b/.vscode/browse.vc.db-wal differ diff --git a/.vscode/settings.json b/.vscode/settings.json index 1737686..126c46d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,7 +7,7 @@ "C_Cpp.configurationWarnings": "enabled", "C_Cpp.default.browse.limitSymbolsToIncludedHeaders": false, "C_Cpp.default.cStandard": "c11", - "C_Cpp.default.compilerPath": "", + "C_Cpp.default.compilerPath": "/usr/bin/gcc", "C_Cpp.default.cppStandard": "c++11", "C_Cpp.default.enableConfigurationSquiggles": true, "C_Cpp.errorSquiggles": "enabledIfIncludesResolve", @@ -62,5 +62,5 @@ ], "C_Cpp.default.browse.databaseFilename": "${workspaceFolder}/.vscode/browse.vc.db", "C_Cpp.default.configurationProvider": "ms-vscode.cpptools", - "C_Cpp.default.intelliSenseMode": "linux-gcc-x64", + "C_Cpp.default.intelliSenseMode": "linux-gcc-x64" } \ No newline at end of file diff --git a/ask.txt b/ask.txt index 432fba2..dd40818 100644 --- a/ask.txt +++ b/ask.txt @@ -1,4 +1,25 @@ -I am making a fully custom x86 32 bit IA32 Operating System in Visual Studio Code 1.81 for Debian Linux. This will not be a linux based OS. It's also not posix, linux, unix, windows, bsd or any other derivitive thereof but does use the same concepts. The system I am developing on has a Intel i7-3770k and is an x86_64 bit and runs Debian 10 Buster Linux with Linux Kernel version 4.19.0-25-amd64 (supports UNIX 98 PTY) and Bash 5.0.3 and the drive has an ext4 partition and a tempfs partition. I have the extension ms-vscode.cpptools installed on VSCode. I also have both gcc 8.3.0 and clang 7.0.1-8+deb10u2 installed. All of my compilers, debuggers, linkers are in /usr/bin. I have Coreutils 8.30, Binutils 2.31.1, Bison 3.3.2, Diffutils 3.7, Findutils 4.6.0.225, Gawk 4.2.1, Grep 3.3, Gzip 1.9, M4 1.4.18, Make 4.2.1, Patch 2.7.6, Perl 5.28.1, Python 3.7.3, Sed 4.7, Tar 1.30, Texinfo 6.5, Xz 5.2.4. The operating system would run on any system that has a 386 CPU up to a 32 bit only Prescott Pentium 4 released in 2004. I am using gcc to compile, ld to link, gdb to debug, nasm to do the assembly and qemu to emulate the system. it has a two stage bootloader. The os should boot from floppy, hard drive and optical media. +I am making a fully custom x86 32 bit IA32 Operating System in Visual Studio Code 1.81 for Debian Linux. This will not be a linux based OS. It's also not posix, linux, unix, windows, bsd or any other derivitive thereof but does use the same concepts. The system I am developing on has a Intel i7-3770k and is an x86_64 bit and runs Debian 10 Buster Linux with Linux Kernel version 4.19.0-25-amd64 (supports UNIX 98 PTY) and Bash 5.0.3 and the drive has an ext4 partition and a tempfs partition. I have the extension ms-vscode.cpptools installed on VSCode. I also have both gcc 8.3.0 and clang 7.0.1-8+deb10u2 installed. All of my compilers, debuggers, linkers are in /usr/bin. I have Coreutils 8.30, Binutils 2.31.1, Bison 3.3.2, Diffutils 3.7, Findutils 4.6.0.225, Gawk 4.2.1, Grep 3.3, Gzip 1.9, M4 1.4.18, Make 4.2.1, Patch 2.7.6, Perl 5.28.1, Python 3.7.3, Sed 4.7, Tar 1.30, Texinfo 6.5, Xz 5.2.4. The operating system would run on any system that has a 386 CPU up to a 32 bit only Prescott Pentium 4 released in 2004 including i386, i486, i586 and i686. I am using gcc to compile, ld to link, gdb to debug, nasm to do the assembly and qemu to emulate the system. it has a two stage bootloader. The os should boot from floppy, hard drive and optical media. + +Here is the system ,emory map +BIOS: The Basic Input/Output System often resides in the lower 64KB (first 65536 bytes) of memory. +MBR (Master Boot Record): The first sector of the boot disk (usually 512 bytes) is typically located at 0x00007C00. +VGA Memory: The memory used for graphics display might be mapped in this region (e.g., 0xB8000 for text mode). +Legacy Device Memory: Memory-mapped I/O (MMIO) regions for legacy devices like keyboard, mouse, or floppy controller could be present. +Lower 1GB of RAM: This is the main usable memory region for the kernel, applications, and data. The kernel might load itself here after being booted by the bootloader. + +the kernel.c should be kernel_main() and + +Kernel Stack Implementation: + + Memory Allocation: The kernel reserves a dedicated memory region for the kernel stack during boot or early initialization. This region typically resides within the usable portion of memory allocated for the kernel itself (often within the first 1GB on IA32 systems). + + Stack Pointer (ESP): The kernel maintains a stack pointer register (often ESP or RSP on x86 architectures) that points to the top of the kernel stack. Initially, this pointer is set to the end of the allocated stack memory region, indicating an empty stack. + + Stack Growth: When a function is called in kernel space, the required data (arguments, local variables, return address) is pushed onto the stack. This decrements the stack pointer value, effectively "growing" the stack downwards in memory. + + Stack Protection: The kernel sets up memory protection mechanisms to ensure the stack doesn't grow beyond its allocated region or overwrite other critical kernel data structures. + + Stack Overflow Protection: The kernel might implement stack overflow protection mechanisms to detect and handle situations where the stack grows too large and threatens to overwrite other memory areas. This can involve setting up guard pages below the allocated stack space to trigger exceptions if accessed. here is the file structure: @@ -127,17 +148,44 @@ ClassicOS/ This is my CMakeLists.txt cmake_minimum_required(VERSION 3.13.4) -project(ClassicOS VERSION 0.0.1 LANGUAGES C) + +set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/src) +set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_LIST_DIR}/build) + +include(x86-baremetal-toolchain.cmake) + +project(ClassicOSBL VERSION 0.0.1 LANGUAGES ASM_NASM) +project(ClassicOS VERSION 0.0.1 LANGUAGES C CXX ASM_NASM) + +enable_language(ASM_NASM) +set(CMAKE_ASM_NASM_OBJECT_FORMAT elf32) + +set(IS_OS_WINDOWS FALSE) +set(IS_OS_LINUX FALSE) +set(IS_OS_MAC FALSE) + +if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows") + set(IS_OS_WINDOWS TRUE) + message("Building on the Windows operating system.") +elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Linux") + set(IS_OS_LINUX TRUE) + message("Building on the Linux operating system.") +elseif (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin") + set(IS_OS_MAC TRUE) + message("Building on the Mac operating system.") +endif () # Source files set(BOOT_SOURCE_FILES src/boot/boot.asm src/boot/linker.ld ) + set(GRUB_SOURCE_FILES src/boot/grub/grub.cfg src/boot/grub/menu.lst ) + set(DRIVERS_SOURCE_FILES src/drivers/audio/audio.c src/drivers/audio/audio.h @@ -147,6 +195,7 @@ set(DRIVERS_SOURCE_FILES src/drivers/bus/isa.h src/drivers/bus/mca.c src/drivers/bus/mca.h + #src/drivers/bus/pci.asm src/drivers/bus/pci.c src/drivers/bus/pci.h src/drivers/bus/vesa.c @@ -154,6 +203,7 @@ set(DRIVERS_SOURCE_FILES src/drivers/display/display.c src/drivers/display/display.h src/drivers/io/io.c + src/drivers/io/io.asm src/drivers/io/io.h src/drivers/keyboard/keyboard.c src/drivers/keyboard/keyboard.h @@ -168,49 +218,59 @@ set(KERNEL_SOURCE_FILES src/kernel/arch/x86/include/types.h src/kernel/arch/x86/memory/memory.c src/kernel/arch/x86/gdt.c - src/kernel/arch/x86/gdt.c + src/kernel/arch/x86/gdt.asm + src/kernel/arch/x86/gdt.h src/kernel/arch/x86/idt.c + src/kernel/arch/x86/idt.asm src/kernel/arch/x86/idt.h - src/kernel/arch/x86/isr.c - src/kernel/arch/x86/isr.h + src/kernel/arch/x86/isr/isr.c + src/kernel/arch/x86/isr/isr.h + src/kernel/arch/x86/isr/exceptions.c + src/kernel/arch/x86/isr/exceptions.h src/kernel/kernel.c src/kernel/kernel.h src/kernel/linker.ld src/kernel/print.c + src/kernel/stack.c + src/kernel/stack.h ) +set(UTIL_SOURCE_FILES + src/EHS.h + src/sys/CPU.h src/sys/CPU.cpp src/sys/CPU_GCC_AMD64.asm + src/Util.h src/Util.cpp + src/Version.h src/Version.cpp + src/Serializer.h + src/Array.h + src/Vector.h + src/SArray.h + src/Str.h + src/PRNG.h + src/HRNG.h src/HRNG_GCC.s + src/Math.h src/Math.cpp src/Math_GCC_AMD64.s + src/Rect.h + src/Range.h src/Range.cpp + src/Color4.h src/Color4.cpp + src/Color3.h src/Color3.cpp + src/Quat.h + src/Vec4.h + src/Vec3.h + src/Vec2.h + src/Mat4.h + src/Mat3.h + src/Mat2.h +) + +set_source_files_properties(src/boot/boot.asm PROPERTIES LANGUAGE ASM_NASM) + add_executable(ClassicOS - ${BOOT_SOURCE_FILES} - ${GRUB_SOURCE_FILES} + ${KERNEL_SOURCE_FILES} ${DRIVERS_SOURCE_FILES} - ${KERNEL_SOURCE_FILES} ) -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +add_executable(ClassicOSBL + ${BOOT_SOURCE_FILES} + ${GRUB_SOURCE_FILES} +) -# Enable testing -enable_testing() - -target_link_libraries(ClassicOS PRIVATE) - -set(CMAKE_C_COMPILER gcc) -set(CMAKE_LINKER ld) -set(CMAKE_EXE_LINKER_FLAGS "-g -s") -set(CMAKE_LINK_FLAGS "${CMAKE_LINK_FLAGS} -e kernel_main") -set(CMAKE_CXX_FLAGS "-g -Wall") -set(CMAKE_C_FLAGS "-g -Wall -m32") -set(CMAKE_C_FLAGS_DEBUG "-g") -set(CMAKE_BUILD_TYPE Debug) -set(CMAKE_GDB_COMMAND gdb) -set(CMAKE_CXX_FLAGS_DEBUG "-g -O0") -set(CMAKE_CXX_COMPILER g++) -set(CMAKE_ASM_COMPILER nasm) -set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} --32") -set(CMAKE_SYSTEM_PROCESSOR i386) -set(CMAKE_SYSTEM_NAME None) -set(CMAKE_ASM_NASM_COMPILER nasm) -set(CMAKE_C_STANDARD 17) -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) -set(CMAKE_BINARY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build) -set_target_properties(ClassicOS PROPERTIES LINK_FLAGS "-T ${CMAKE_CURRENT_SOURCE_DIR}/linker.ld") +message("${CMAKE_EXE_LINKER_FLAGS}") diff --git a/build/CMakeCache.txt b/build/CMakeCache.txt index a97276b..c6f60f0 100644 --- a/build/CMakeCache.txt +++ b/build/CMakeCache.txt @@ -35,15 +35,13 @@ CMAKE_ASM_NASM_FLAGS_RELEASE:STRING= //Flags used by the ASM_NASM compiler during RELWITHDEBINFO builds. CMAKE_ASM_NASM_FLAGS_RELWITHDEBINFO:STRING= -//No help, variable specified on the command line. -CMAKE_BUILD_TYPE:STRING=Debug +//Choose the type of build, options are: None Debug Release RelWithDebInfo +// MinSizeRel ... +CMAKE_BUILD_TYPE:STRING= //Enable/Disable color output during build. CMAKE_COLOR_MAKEFILE:BOOL=ON -//No help, variable specified on the command line. -CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++ - //A wrapper around 'ar' adding the appropriate '--plugin' option // for the GCC compiler CMAKE_CXX_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-8 @@ -67,9 +65,6 @@ CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG //Flags used by the CXX compiler during RELWITHDEBINFO builds. CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG -//No help, variable specified on the command line. -CMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc - //A wrapper around 'ar' adding the appropriate '--plugin' option // for the GCC compiler CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-8 @@ -108,8 +103,8 @@ CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= //Flags used by the linker during RELWITHDEBINFO builds. CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= -//No help, variable specified on the command line. -CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE +//Enable/Disable output of compile commands during generation. +CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF //Install path prefix, prepended onto install directories. CMAKE_INSTALL_PREFIX:PATH=/usr/local diff --git a/build/CMakeFiles/3.13.4/CMakeCCompiler.cmake b/build/CMakeFiles/3.13.4/CMakeCCompiler.cmake index fbb6da9..e737bdb 100644 --- a/build/CMakeFiles/3.13.4/CMakeCCompiler.cmake +++ b/build/CMakeFiles/3.13.4/CMakeCCompiler.cmake @@ -69,5 +69,5 @@ endif() set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "") -set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/8/32;/usr/lib/i386-linux-gnu;/usr/lib32;/lib/i386-linux-gnu;/lib32;/usr/lib/gcc/x86_64-linux-gnu/8;/usr/lib") +set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/8/32;/usr/x86_64-linux-gnu/lib32;/usr/lib/i386-linux-gnu;/usr/lib32;/lib/i386-linux-gnu;/lib32;/usr/lib/gcc/x86_64-linux-gnu/8;/usr/x86_64-linux-gnu/lib;/usr/lib") set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/build/CMakeFiles/3.13.4/CMakeCXXCompiler.cmake b/build/CMakeFiles/3.13.4/CMakeCXXCompiler.cmake index 1d7917a..52d85f4 100644 --- a/build/CMakeFiles/3.13.4/CMakeCXXCompiler.cmake +++ b/build/CMakeFiles/3.13.4/CMakeCXXCompiler.cmake @@ -72,5 +72,5 @@ endif() set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "") -set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/8/32;/usr/lib/i386-linux-gnu;/usr/lib32;/lib/i386-linux-gnu;/lib32;/usr/lib/gcc/x86_64-linux-gnu/8;/usr/lib") +set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/8/32;/usr/x86_64-linux-gnu/lib32;/usr/lib/i386-linux-gnu;/usr/lib32;/lib/i386-linux-gnu;/lib32;/usr/lib/gcc/x86_64-linux-gnu/8;/usr/x86_64-linux-gnu/lib;/usr/lib") set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "") diff --git a/build/CMakeFiles/CMakeError.log b/build/CMakeFiles/CMakeError.log index f64576f..492f748 100644 --- a/build/CMakeFiles/CMakeError.log +++ b/build/CMakeFiles/CMakeError.log @@ -1,8 +1,4 @@ -Checking whether the ASM_NASM compiler is GNU using "--version" did not match "(GNU assembler)|(GCC)|(Free Software Foundation)": -NASM version 2.14 -Checking whether the ASM_NASM compiler is Clang using "--version" did not match "(clang version)": -NASM version 2.14 -Checking whether the ASM_NASM compiler is AppleClang using "--version" did not match "(Apple LLVM version)": +Checking whether the ASM_NASM compiler is GNU using "--version" terminated after 10 s due to timeout.Checking whether the ASM_NASM compiler is Clang using "--version" terminated after 10 s due to timeout.Checking whether the ASM_NASM compiler is AppleClang using "--version" did not match "(Apple LLVM version)": NASM version 2.14 Checking whether the ASM_NASM compiler is HP using "-V" did not match "HP C": nasm:error: unrecognised option `-V' diff --git a/build/CMakeFiles/CMakeOutput.log b/build/CMakeFiles/CMakeOutput.log index 81d3b36..45c1b80 100644 --- a/build/CMakeFiles/CMakeOutput.log +++ b/build/CMakeFiles/CMakeOutput.log @@ -32,14 +32,14 @@ The CXX compiler identification is GNU, found in "/home/gbowne1/Documents/Classi Determining if the C compiler works passed with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_3f008/fast" -/usr/bin/make -f CMakeFiles/cmTC_3f008.dir/build.make CMakeFiles/cmTC_3f008.dir/build +Run Build Command:"/usr/bin/make" "cmTC_950ed/fast" +/usr/bin/make -f CMakeFiles/cmTC_950ed.dir/build.make CMakeFiles/cmTC_950ed.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building C object CMakeFiles/cmTC_3f008.dir/testCCompiler.c.o -/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=gnu11 -o CMakeFiles/cmTC_3f008.dir/testCCompiler.c.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp/testCCompiler.c -Linking C executable cmTC_3f008 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3f008.dir/link.txt --verbose=1 -/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_3f008.dir/testCCompiler.c.o -o cmTC_3f008 +Building C object CMakeFiles/cmTC_950ed.dir/testCCompiler.c.o +/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=gnu11 -o CMakeFiles/cmTC_950ed.dir/testCCompiler.c.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp/testCCompiler.c +Linking C executable cmTC_950ed +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_950ed.dir/link.txt --verbose=1 +/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_950ed.dir/testCCompiler.c.o -o cmTC_950ed /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' @@ -47,14 +47,14 @@ make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/C Detecting C compiler ABI info compiled with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_e0e28/fast" -/usr/bin/make -f CMakeFiles/cmTC_e0e28.dir/build.make CMakeFiles/cmTC_e0e28.dir/build +Run Build Command:"/usr/bin/make" "cmTC_50241/fast" +/usr/bin/make -f CMakeFiles/cmTC_50241.dir/build.make CMakeFiles/cmTC_50241.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building C object CMakeFiles/cmTC_e0e28.dir/CMakeCCompilerABI.c.o -/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=gnu11 -o CMakeFiles/cmTC_e0e28.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.13/Modules/CMakeCCompilerABI.c -Linking C executable cmTC_e0e28 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e0e28.dir/link.txt --verbose=1 -/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack -v CMakeFiles/cmTC_e0e28.dir/CMakeCCompilerABI.c.o -o cmTC_e0e28 +Building C object CMakeFiles/cmTC_50241.dir/CMakeCCompilerABI.c.o +/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=gnu11 -o CMakeFiles/cmTC_50241.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.13/Modules/CMakeCCompilerABI.c +Linking C executable cmTC_50241 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_50241.dir/link.txt --verbose=1 +/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack -v CMakeFiles/cmTC_50241.dir/CMakeCCompilerABI.c.o -o cmTC_50241 Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper @@ -65,11 +65,11 @@ Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-b Thread model: posix gcc version 8.3.0 (Debian 8.3.0-6) COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/ -LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32/:/lib/i386-linux-gnu/:/lib/../lib32/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../:/lib/i386-linux-gnu/:/lib/:/usr/lib/i386-linux-gnu/:/usr/lib/ -COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_e0e28' '-mtune=generic' '-march=i686' - /usr/lib/gcc/x86_64-linux-gnu/8/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper -plugin-opt=-fresolution=/tmp/cc8gDg1y.res --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o cmTC_e0e28 -e kernel_main -z noexecstack -L/usr/lib/gcc/x86_64-linux-gnu/8/32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32 -L/lib/i386-linux-gnu -L/lib/../lib32 -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../.. -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu CMakeFiles/cmTC_e0e28.dir/CMakeCCompilerABI.c.o -T /home/gbowne1/Documents/ClassicOS/linker.ld +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32/:/lib/i386-linux-gnu/:/lib/../lib32/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../:/lib/i386-linux-gnu/:/lib/:/usr/lib/i386-linux-gnu/:/usr/lib/ +COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_50241' '-mtune=generic' '-march=i686' + /usr/lib/gcc/x86_64-linux-gnu/8/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccSAGcU0.res --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o cmTC_50241 -e kernel_main -z noexecstack -L/usr/lib/gcc/x86_64-linux-gnu/8/32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32 -L/lib/i386-linux-gnu -L/lib/../lib32 -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../.. -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu CMakeFiles/cmTC_50241.dir/CMakeCCompilerABI.c.o -T /home/gbowne1/Documents/ClassicOS/linker.ld /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 -COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_e0e28' '-mtune=generic' '-march=i686' +COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_50241' '-mtune=generic' '-march=i686' make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' @@ -77,14 +77,14 @@ Parsed C implicit link information from above output: link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] ignore line: [Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp] ignore line: [] - ignore line: [Run Build Command:"/usr/bin/make" "cmTC_e0e28/fast"] - ignore line: [/usr/bin/make -f CMakeFiles/cmTC_e0e28.dir/build.make CMakeFiles/cmTC_e0e28.dir/build] + ignore line: [Run Build Command:"/usr/bin/make" "cmTC_50241/fast"] + ignore line: [/usr/bin/make -f CMakeFiles/cmTC_50241.dir/build.make CMakeFiles/cmTC_50241.dir/build] ignore line: [make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp'] - ignore line: [Building C object CMakeFiles/cmTC_e0e28.dir/CMakeCCompilerABI.c.o] - ignore line: [/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=gnu11 -o CMakeFiles/cmTC_e0e28.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.13/Modules/CMakeCCompilerABI.c] - ignore line: [Linking C executable cmTC_e0e28] - ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_e0e28.dir/link.txt --verbose=1] - ignore line: [/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack -v CMakeFiles/cmTC_e0e28.dir/CMakeCCompilerABI.c.o -o cmTC_e0e28 ] + ignore line: [Building C object CMakeFiles/cmTC_50241.dir/CMakeCCompilerABI.c.o] + ignore line: [/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=gnu11 -o CMakeFiles/cmTC_50241.dir/CMakeCCompilerABI.c.o -c /usr/share/cmake-3.13/Modules/CMakeCCompilerABI.c] + ignore line: [Linking C executable cmTC_50241] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_50241.dir/link.txt --verbose=1] + ignore line: [/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack -v CMakeFiles/cmTC_50241.dir/CMakeCCompilerABI.c.o -o cmTC_50241 ] ignore line: [Using built-in specs.] ignore line: [COLLECT_GCC=/usr/bin/gcc] ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper] @@ -95,14 +95,14 @@ Parsed C implicit link information from above output: ignore line: [Thread model: posix] ignore line: [gcc version 8.3.0 (Debian 8.3.0-6) ] ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/] - ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32/:/lib/i386-linux-gnu/:/lib/../lib32/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../:/lib/i386-linux-gnu/:/lib/:/usr/lib/i386-linux-gnu/:/usr/lib/] - ignore line: [COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_e0e28' '-mtune=generic' '-march=i686'] - link line: [ /usr/lib/gcc/x86_64-linux-gnu/8/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper -plugin-opt=-fresolution=/tmp/cc8gDg1y.res --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o cmTC_e0e28 -e kernel_main -z noexecstack -L/usr/lib/gcc/x86_64-linux-gnu/8/32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32 -L/lib/i386-linux-gnu -L/lib/../lib32 -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../.. -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu CMakeFiles/cmTC_e0e28.dir/CMakeCCompilerABI.c.o -T /home/gbowne1/Documents/ClassicOS/linker.ld] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32/:/lib/i386-linux-gnu/:/lib/../lib32/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../:/lib/i386-linux-gnu/:/lib/:/usr/lib/i386-linux-gnu/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_50241' '-mtune=generic' '-march=i686'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/8/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccSAGcU0.res --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o cmTC_50241 -e kernel_main -z noexecstack -L/usr/lib/gcc/x86_64-linux-gnu/8/32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32 -L/lib/i386-linux-gnu -L/lib/../lib32 -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../.. -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu CMakeFiles/cmTC_50241.dir/CMakeCCompilerABI.c.o -T /home/gbowne1/Documents/ClassicOS/linker.ld] arg [/usr/lib/gcc/x86_64-linux-gnu/8/collect2] ==> ignore arg [-plugin] ==> ignore arg [/usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so] ==> ignore arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper] ==> ignore - arg [-plugin-opt=-fresolution=/tmp/cc8gDg1y.res] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccSAGcU0.res] ==> ignore arg [--build-id] ==> ignore arg [--eh-frame-hdr] ==> ignore arg [-m] ==> ignore @@ -112,11 +112,12 @@ Parsed C implicit link information from above output: arg [/lib/ld-linux.so.2] ==> ignore arg [-pie] ==> ignore arg [-o] ==> ignore - arg [cmTC_e0e28] ==> ignore + arg [cmTC_50241] ==> ignore arg [-e] ==> ignore arg [kernel_main] ==> ignore arg [-znoexecstack] ==> ignore arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/32] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/32] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32] arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32] arg [-L/lib/i386-linux-gnu] ==> dir [/lib/i386-linux-gnu] @@ -124,14 +125,16 @@ Parsed C implicit link information from above output: arg [-L/usr/lib/i386-linux-gnu] ==> dir [/usr/lib/i386-linux-gnu] arg [-L/usr/lib/../lib32] ==> dir [/usr/lib/../lib32] arg [-L/usr/lib/gcc/x86_64-linux-gnu/8] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib] arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../..] arg [-L/lib/i386-linux-gnu] ==> dir [/lib/i386-linux-gnu] arg [-L/usr/lib/i386-linux-gnu] ==> dir [/usr/lib/i386-linux-gnu] - arg [CMakeFiles/cmTC_e0e28.dir/CMakeCCompilerABI.c.o] ==> ignore + arg [CMakeFiles/cmTC_50241.dir/CMakeCCompilerABI.c.o] ==> ignore arg [-T] ==> ignore arg [/home/gbowne1/Documents/ClassicOS/linker.ld] ==> ignore collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/32] ==> [/usr/lib/gcc/x86_64-linux-gnu/8/32] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32] ==> [/usr/x86_64-linux-gnu/lib32] collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] ==> [/usr/lib/i386-linux-gnu] collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32] ==> [/usr/lib32] collapse library dir [/lib/i386-linux-gnu] ==> [/lib/i386-linux-gnu] @@ -139,12 +142,13 @@ Parsed C implicit link information from above output: collapse library dir [/usr/lib/i386-linux-gnu] ==> [/usr/lib/i386-linux-gnu] collapse library dir [/usr/lib/../lib32] ==> [/usr/lib32] collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8] ==> [/usr/lib/gcc/x86_64-linux-gnu/8] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib] ==> [/usr/x86_64-linux-gnu/lib] collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] ==> [/usr/lib/i386-linux-gnu] collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../..] ==> [/usr/lib] collapse library dir [/lib/i386-linux-gnu] ==> [/lib/i386-linux-gnu] collapse library dir [/usr/lib/i386-linux-gnu] ==> [/usr/lib/i386-linux-gnu] implicit libs: [] - implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/8/32;/usr/lib/i386-linux-gnu;/usr/lib32;/lib/i386-linux-gnu;/lib32;/usr/lib/gcc/x86_64-linux-gnu/8;/usr/lib] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/8/32;/usr/x86_64-linux-gnu/lib32;/usr/lib/i386-linux-gnu;/usr/lib32;/lib/i386-linux-gnu;/lib32;/usr/lib/gcc/x86_64-linux-gnu/8;/usr/x86_64-linux-gnu/lib;/usr/lib] implicit fwks: [] @@ -153,14 +157,14 @@ Parsed C implicit link information from above output: Detecting C [-std=c11] compiler features compiled with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_ba45b/fast" -/usr/bin/make -f CMakeFiles/cmTC_ba45b.dir/build.make CMakeFiles/cmTC_ba45b.dir/build +Run Build Command:"/usr/bin/make" "cmTC_a8f4a/fast" +/usr/bin/make -f CMakeFiles/cmTC_a8f4a.dir/build.make CMakeFiles/cmTC_a8f4a.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building C object CMakeFiles/cmTC_ba45b.dir/feature_tests.c.o -/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=c11 -std=gnu11 -o CMakeFiles/cmTC_ba45b.dir/feature_tests.c.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.c -Linking C executable cmTC_ba45b -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ba45b.dir/link.txt --verbose=1 -/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_ba45b.dir/feature_tests.c.o -o cmTC_ba45b +Building C object CMakeFiles/cmTC_a8f4a.dir/feature_tests.c.o +/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=c11 -std=gnu11 -o CMakeFiles/cmTC_a8f4a.dir/feature_tests.c.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.c +Linking C executable cmTC_a8f4a +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_a8f4a.dir/link.txt --verbose=1 +/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_a8f4a.dir/feature_tests.c.o -o cmTC_a8f4a /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' @@ -174,14 +178,14 @@ make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/C Detecting C [-std=c99] compiler features compiled with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_3b6b2/fast" -/usr/bin/make -f CMakeFiles/cmTC_3b6b2.dir/build.make CMakeFiles/cmTC_3b6b2.dir/build +Run Build Command:"/usr/bin/make" "cmTC_3fc08/fast" +/usr/bin/make -f CMakeFiles/cmTC_3fc08.dir/build.make CMakeFiles/cmTC_3fc08.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building C object CMakeFiles/cmTC_3b6b2.dir/feature_tests.c.o -/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=c99 -std=gnu11 -o CMakeFiles/cmTC_3b6b2.dir/feature_tests.c.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.c -Linking C executable cmTC_3b6b2 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3b6b2.dir/link.txt --verbose=1 -/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_3b6b2.dir/feature_tests.c.o -o cmTC_3b6b2 +Building C object CMakeFiles/cmTC_3fc08.dir/feature_tests.c.o +/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=c99 -std=gnu11 -o CMakeFiles/cmTC_3fc08.dir/feature_tests.c.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.c +Linking C executable cmTC_3fc08 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3fc08.dir/link.txt --verbose=1 +/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_3fc08.dir/feature_tests.c.o -o cmTC_3fc08 /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' @@ -195,14 +199,14 @@ make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/C Detecting C [-std=c90] compiler features compiled with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_513a6/fast" -/usr/bin/make -f CMakeFiles/cmTC_513a6.dir/build.make CMakeFiles/cmTC_513a6.dir/build +Run Build Command:"/usr/bin/make" "cmTC_f007b/fast" +/usr/bin/make -f CMakeFiles/cmTC_f007b.dir/build.make CMakeFiles/cmTC_f007b.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building C object CMakeFiles/cmTC_513a6.dir/feature_tests.c.o -/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=c90 -std=gnu11 -o CMakeFiles/cmTC_513a6.dir/feature_tests.c.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.c -Linking C executable cmTC_513a6 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_513a6.dir/link.txt --verbose=1 -/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_513a6.dir/feature_tests.c.o -o cmTC_513a6 +Building C object CMakeFiles/cmTC_f007b.dir/feature_tests.c.o +/usr/bin/gcc -m32 -ffreestanding -nostdlib -std=c90 -std=gnu11 -o CMakeFiles/cmTC_f007b.dir/feature_tests.c.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.c +Linking C executable cmTC_f007b +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f007b.dir/link.txt --verbose=1 +/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_f007b.dir/feature_tests.c.o -o cmTC_f007b /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' @@ -214,14 +218,14 @@ make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/C Determining if the CXX compiler works passed with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_6e8ec/fast" -/usr/bin/make -f CMakeFiles/cmTC_6e8ec.dir/build.make CMakeFiles/cmTC_6e8ec.dir/build +Run Build Command:"/usr/bin/make" "cmTC_3279a/fast" +/usr/bin/make -f CMakeFiles/cmTC_3279a.dir/build.make CMakeFiles/cmTC_3279a.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building CXX object CMakeFiles/cmTC_6e8ec.dir/testCXXCompiler.cxx.o -/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=gnu++11 -o CMakeFiles/cmTC_6e8ec.dir/testCXXCompiler.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx -Linking CXX executable cmTC_6e8ec -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_6e8ec.dir/link.txt --verbose=1 -/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_6e8ec.dir/testCXXCompiler.cxx.o -o cmTC_6e8ec +Building CXX object CMakeFiles/cmTC_3279a.dir/testCXXCompiler.cxx.o +/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=gnu++11 -o CMakeFiles/cmTC_3279a.dir/testCXXCompiler.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp/testCXXCompiler.cxx +Linking CXX executable cmTC_3279a +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3279a.dir/link.txt --verbose=1 +/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_3279a.dir/testCXXCompiler.cxx.o -o cmTC_3279a /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' @@ -229,14 +233,14 @@ make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/C Detecting CXX compiler ABI info compiled with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_f2925/fast" -/usr/bin/make -f CMakeFiles/cmTC_f2925.dir/build.make CMakeFiles/cmTC_f2925.dir/build +Run Build Command:"/usr/bin/make" "cmTC_8ccc6/fast" +/usr/bin/make -f CMakeFiles/cmTC_8ccc6.dir/build.make CMakeFiles/cmTC_8ccc6.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building CXX object CMakeFiles/cmTC_f2925.dir/CMakeCXXCompilerABI.cpp.o -/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=gnu++11 -o CMakeFiles/cmTC_f2925.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.13/Modules/CMakeCXXCompilerABI.cpp -Linking CXX executable cmTC_f2925 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f2925.dir/link.txt --verbose=1 -/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack -v CMakeFiles/cmTC_f2925.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_f2925 +Building CXX object CMakeFiles/cmTC_8ccc6.dir/CMakeCXXCompilerABI.cpp.o +/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=gnu++11 -o CMakeFiles/cmTC_8ccc6.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.13/Modules/CMakeCXXCompilerABI.cpp +Linking CXX executable cmTC_8ccc6 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8ccc6.dir/link.txt --verbose=1 +/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack -v CMakeFiles/cmTC_8ccc6.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_8ccc6 Using built-in specs. COLLECT_GCC=/usr/bin/g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper @@ -247,11 +251,11 @@ Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-b Thread model: posix gcc version 8.3.0 (Debian 8.3.0-6) COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/ -LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32/:/lib/i386-linux-gnu/:/lib/../lib32/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../:/lib/i386-linux-gnu/:/lib/:/usr/lib/i386-linux-gnu/:/usr/lib/ -COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_f2925' '-shared-libgcc' '-mtune=generic' '-march=i686' - /usr/lib/gcc/x86_64-linux-gnu/8/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccyGHeAT.res --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o cmTC_f2925 -e kernel_main -z noexecstack -L/usr/lib/gcc/x86_64-linux-gnu/8/32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32 -L/lib/i386-linux-gnu -L/lib/../lib32 -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../.. -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu CMakeFiles/cmTC_f2925.dir/CMakeCXXCompilerABI.cpp.o -T /home/gbowne1/Documents/ClassicOS/linker.ld +LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32/:/lib/i386-linux-gnu/:/lib/../lib32/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../:/lib/i386-linux-gnu/:/lib/:/usr/lib/i386-linux-gnu/:/usr/lib/ +COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_8ccc6' '-shared-libgcc' '-mtune=generic' '-march=i686' + /usr/lib/gcc/x86_64-linux-gnu/8/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccCahleH.res --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o cmTC_8ccc6 -e kernel_main -z noexecstack -L/usr/lib/gcc/x86_64-linux-gnu/8/32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32 -L/lib/i386-linux-gnu -L/lib/../lib32 -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../.. -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu CMakeFiles/cmTC_8ccc6.dir/CMakeCXXCompilerABI.cpp.o -T /home/gbowne1/Documents/ClassicOS/linker.ld /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 -COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_f2925' '-shared-libgcc' '-mtune=generic' '-march=i686' +COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_8ccc6' '-shared-libgcc' '-mtune=generic' '-march=i686' make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' @@ -259,14 +263,14 @@ Parsed CXX implicit link information from above output: link line regex: [^( *|.*[/\])(ld|CMAKE_LINK_STARTFILE-NOTFOUND|([^/\]+-)?ld|collect2)[^/\]*( |$)] ignore line: [Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp] ignore line: [] - ignore line: [Run Build Command:"/usr/bin/make" "cmTC_f2925/fast"] - ignore line: [/usr/bin/make -f CMakeFiles/cmTC_f2925.dir/build.make CMakeFiles/cmTC_f2925.dir/build] + ignore line: [Run Build Command:"/usr/bin/make" "cmTC_8ccc6/fast"] + ignore line: [/usr/bin/make -f CMakeFiles/cmTC_8ccc6.dir/build.make CMakeFiles/cmTC_8ccc6.dir/build] ignore line: [make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp'] - ignore line: [Building CXX object CMakeFiles/cmTC_f2925.dir/CMakeCXXCompilerABI.cpp.o] - ignore line: [/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=gnu++11 -o CMakeFiles/cmTC_f2925.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.13/Modules/CMakeCXXCompilerABI.cpp] - ignore line: [Linking CXX executable cmTC_f2925] - ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_f2925.dir/link.txt --verbose=1] - ignore line: [/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack -v CMakeFiles/cmTC_f2925.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_f2925 ] + ignore line: [Building CXX object CMakeFiles/cmTC_8ccc6.dir/CMakeCXXCompilerABI.cpp.o] + ignore line: [/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=gnu++11 -o CMakeFiles/cmTC_8ccc6.dir/CMakeCXXCompilerABI.cpp.o -c /usr/share/cmake-3.13/Modules/CMakeCXXCompilerABI.cpp] + ignore line: [Linking CXX executable cmTC_8ccc6] + ignore line: [/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_8ccc6.dir/link.txt --verbose=1] + ignore line: [/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack -v CMakeFiles/cmTC_8ccc6.dir/CMakeCXXCompilerABI.cpp.o -o cmTC_8ccc6 ] ignore line: [Using built-in specs.] ignore line: [COLLECT_GCC=/usr/bin/g++] ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper] @@ -277,14 +281,14 @@ Parsed CXX implicit link information from above output: ignore line: [Thread model: posix] ignore line: [gcc version 8.3.0 (Debian 8.3.0-6) ] ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/] - ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32/:/lib/i386-linux-gnu/:/lib/../lib32/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../:/lib/i386-linux-gnu/:/lib/:/usr/lib/i386-linux-gnu/:/usr/lib/] - ignore line: [COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_f2925' '-shared-libgcc' '-mtune=generic' '-march=i686'] - link line: [ /usr/lib/gcc/x86_64-linux-gnu/8/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccyGHeAT.res --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o cmTC_f2925 -e kernel_main -z noexecstack -L/usr/lib/gcc/x86_64-linux-gnu/8/32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32 -L/lib/i386-linux-gnu -L/lib/../lib32 -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../.. -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu CMakeFiles/cmTC_f2925.dir/CMakeCXXCompilerABI.cpp.o -T /home/gbowne1/Documents/ClassicOS/linker.ld] + ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/8/32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32/:/lib/i386-linux-gnu/:/lib/../lib32/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/8/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/8/../../../:/lib/i386-linux-gnu/:/lib/:/usr/lib/i386-linux-gnu/:/usr/lib/] + ignore line: [COLLECT_GCC_OPTIONS='-ffreestanding' '-nostdlib' '-e' 'kernel_main' '-T' '/home/gbowne1/Documents/ClassicOS/linker.ld' '-m32' '-z' 'noexecstack' '-v' '-o' 'cmTC_8ccc6' '-shared-libgcc' '-mtune=generic' '-march=i686'] + link line: [ /usr/lib/gcc/x86_64-linux-gnu/8/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper -plugin-opt=-fresolution=/tmp/ccCahleH.res --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o cmTC_8ccc6 -e kernel_main -z noexecstack -L/usr/lib/gcc/x86_64-linux-gnu/8/32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32 -L/lib/i386-linux-gnu -L/lib/../lib32 -L/usr/lib/i386-linux-gnu -L/usr/lib/../lib32 -L/usr/lib/gcc/x86_64-linux-gnu/8 -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib -L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/8/../../.. -L/lib/i386-linux-gnu -L/usr/lib/i386-linux-gnu CMakeFiles/cmTC_8ccc6.dir/CMakeCXXCompilerABI.cpp.o -T /home/gbowne1/Documents/ClassicOS/linker.ld] arg [/usr/lib/gcc/x86_64-linux-gnu/8/collect2] ==> ignore arg [-plugin] ==> ignore arg [/usr/lib/gcc/x86_64-linux-gnu/8/liblto_plugin.so] ==> ignore arg [-plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper] ==> ignore - arg [-plugin-opt=-fresolution=/tmp/ccyGHeAT.res] ==> ignore + arg [-plugin-opt=-fresolution=/tmp/ccCahleH.res] ==> ignore arg [--build-id] ==> ignore arg [--eh-frame-hdr] ==> ignore arg [-m] ==> ignore @@ -294,11 +298,12 @@ Parsed CXX implicit link information from above output: arg [/lib/ld-linux.so.2] ==> ignore arg [-pie] ==> ignore arg [-o] ==> ignore - arg [cmTC_f2925] ==> ignore + arg [cmTC_8ccc6] ==> ignore arg [-e] ==> ignore arg [kernel_main] ==> ignore arg [-znoexecstack] ==> ignore arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/32] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/32] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32] arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32] arg [-L/lib/i386-linux-gnu] ==> dir [/lib/i386-linux-gnu] @@ -306,14 +311,16 @@ Parsed CXX implicit link information from above output: arg [-L/usr/lib/i386-linux-gnu] ==> dir [/usr/lib/i386-linux-gnu] arg [-L/usr/lib/../lib32] ==> dir [/usr/lib/../lib32] arg [-L/usr/lib/gcc/x86_64-linux-gnu/8] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8] + arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib] arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] arg [-L/usr/lib/gcc/x86_64-linux-gnu/8/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../..] arg [-L/lib/i386-linux-gnu] ==> dir [/lib/i386-linux-gnu] arg [-L/usr/lib/i386-linux-gnu] ==> dir [/usr/lib/i386-linux-gnu] - arg [CMakeFiles/cmTC_f2925.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore + arg [CMakeFiles/cmTC_8ccc6.dir/CMakeCXXCompilerABI.cpp.o] ==> ignore arg [-T] ==> ignore arg [/home/gbowne1/Documents/ClassicOS/linker.ld] ==> ignore collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/32] ==> [/usr/lib/gcc/x86_64-linux-gnu/8/32] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib/../lib32] ==> [/usr/x86_64-linux-gnu/lib32] collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] ==> [/usr/lib/i386-linux-gnu] collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../lib32] ==> [/usr/lib32] collapse library dir [/lib/i386-linux-gnu] ==> [/lib/i386-linux-gnu] @@ -321,12 +328,13 @@ Parsed CXX implicit link information from above output: collapse library dir [/usr/lib/i386-linux-gnu] ==> [/usr/lib/i386-linux-gnu] collapse library dir [/usr/lib/../lib32] ==> [/usr/lib32] collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8] ==> [/usr/lib/gcc/x86_64-linux-gnu/8] + collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib] ==> [/usr/x86_64-linux-gnu/lib] collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../../i386-linux-gnu] ==> [/usr/lib/i386-linux-gnu] collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/8/../../..] ==> [/usr/lib] collapse library dir [/lib/i386-linux-gnu] ==> [/lib/i386-linux-gnu] collapse library dir [/usr/lib/i386-linux-gnu] ==> [/usr/lib/i386-linux-gnu] implicit libs: [] - implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/8/32;/usr/lib/i386-linux-gnu;/usr/lib32;/lib/i386-linux-gnu;/lib32;/usr/lib/gcc/x86_64-linux-gnu/8;/usr/lib] + implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/8/32;/usr/x86_64-linux-gnu/lib32;/usr/lib/i386-linux-gnu;/usr/lib32;/lib/i386-linux-gnu;/lib32;/usr/lib/gcc/x86_64-linux-gnu/8;/usr/x86_64-linux-gnu/lib;/usr/lib] implicit fwks: [] @@ -335,14 +343,14 @@ Parsed CXX implicit link information from above output: Detecting CXX [-std=c++2a] compiler features compiled with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_1ddb5/fast" -/usr/bin/make -f CMakeFiles/cmTC_1ddb5.dir/build.make CMakeFiles/cmTC_1ddb5.dir/build +Run Build Command:"/usr/bin/make" "cmTC_c3946/fast" +/usr/bin/make -f CMakeFiles/cmTC_c3946.dir/build.make CMakeFiles/cmTC_c3946.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building CXX object CMakeFiles/cmTC_1ddb5.dir/feature_tests.cxx.o -/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=c++2a -std=gnu++11 -o CMakeFiles/cmTC_1ddb5.dir/feature_tests.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.cxx -Linking CXX executable cmTC_1ddb5 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_1ddb5.dir/link.txt --verbose=1 -/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_1ddb5.dir/feature_tests.cxx.o -o cmTC_1ddb5 +Building CXX object CMakeFiles/cmTC_c3946.dir/feature_tests.cxx.o +/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=c++2a -std=gnu++11 -o CMakeFiles/cmTC_c3946.dir/feature_tests.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.cxx +Linking CXX executable cmTC_c3946 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c3946.dir/link.txt --verbose=1 +/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_c3946.dir/feature_tests.cxx.o -o cmTC_c3946 /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' @@ -409,14 +417,14 @@ make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/C Detecting CXX [-std=c++17] compiler features compiled with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_c33b8/fast" -/usr/bin/make -f CMakeFiles/cmTC_c33b8.dir/build.make CMakeFiles/cmTC_c33b8.dir/build +Run Build Command:"/usr/bin/make" "cmTC_3ec97/fast" +/usr/bin/make -f CMakeFiles/cmTC_3ec97.dir/build.make CMakeFiles/cmTC_3ec97.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building CXX object CMakeFiles/cmTC_c33b8.dir/feature_tests.cxx.o -/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=c++17 -std=gnu++11 -o CMakeFiles/cmTC_c33b8.dir/feature_tests.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.cxx -Linking CXX executable cmTC_c33b8 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_c33b8.dir/link.txt --verbose=1 -/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_c33b8.dir/feature_tests.cxx.o -o cmTC_c33b8 +Building CXX object CMakeFiles/cmTC_3ec97.dir/feature_tests.cxx.o +/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=c++17 -std=gnu++11 -o CMakeFiles/cmTC_3ec97.dir/feature_tests.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.cxx +Linking CXX executable cmTC_3ec97 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3ec97.dir/link.txt --verbose=1 +/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_3ec97.dir/feature_tests.cxx.o -o cmTC_3ec97 /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' @@ -483,14 +491,14 @@ make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/C Detecting CXX [-std=c++14] compiler features compiled with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_ec388/fast" -/usr/bin/make -f CMakeFiles/cmTC_ec388.dir/build.make CMakeFiles/cmTC_ec388.dir/build +Run Build Command:"/usr/bin/make" "cmTC_3c0b3/fast" +/usr/bin/make -f CMakeFiles/cmTC_3c0b3.dir/build.make CMakeFiles/cmTC_3c0b3.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building CXX object CMakeFiles/cmTC_ec388.dir/feature_tests.cxx.o -/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=c++14 -std=gnu++11 -o CMakeFiles/cmTC_ec388.dir/feature_tests.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.cxx -Linking CXX executable cmTC_ec388 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_ec388.dir/link.txt --verbose=1 -/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_ec388.dir/feature_tests.cxx.o -o cmTC_ec388 +Building CXX object CMakeFiles/cmTC_3c0b3.dir/feature_tests.cxx.o +/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=c++14 -std=gnu++11 -o CMakeFiles/cmTC_3c0b3.dir/feature_tests.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.cxx +Linking CXX executable cmTC_3c0b3 +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_3c0b3.dir/link.txt --verbose=1 +/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_3c0b3.dir/feature_tests.cxx.o -o cmTC_3c0b3 /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' @@ -557,14 +565,14 @@ make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/C Detecting CXX [-std=c++11] compiler features compiled with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_50cb0/fast" -/usr/bin/make -f CMakeFiles/cmTC_50cb0.dir/build.make CMakeFiles/cmTC_50cb0.dir/build +Run Build Command:"/usr/bin/make" "cmTC_b477f/fast" +/usr/bin/make -f CMakeFiles/cmTC_b477f.dir/build.make CMakeFiles/cmTC_b477f.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building CXX object CMakeFiles/cmTC_50cb0.dir/feature_tests.cxx.o -/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=c++11 -std=gnu++11 -o CMakeFiles/cmTC_50cb0.dir/feature_tests.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.cxx -Linking CXX executable cmTC_50cb0 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_50cb0.dir/link.txt --verbose=1 -/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_50cb0.dir/feature_tests.cxx.o -o cmTC_50cb0 +Building CXX object CMakeFiles/cmTC_b477f.dir/feature_tests.cxx.o +/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=c++11 -std=gnu++11 -o CMakeFiles/cmTC_b477f.dir/feature_tests.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.cxx +Linking CXX executable cmTC_b477f +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_b477f.dir/link.txt --verbose=1 +/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_b477f.dir/feature_tests.cxx.o -o cmTC_b477f /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' @@ -631,14 +639,14 @@ make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/C Detecting CXX [-std=c++98] compiler features compiled with the following output: Change Dir: /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp -Run Build Command:"/usr/bin/make" "cmTC_00553/fast" -/usr/bin/make -f CMakeFiles/cmTC_00553.dir/build.make CMakeFiles/cmTC_00553.dir/build +Run Build Command:"/usr/bin/make" "cmTC_35b7b/fast" +/usr/bin/make -f CMakeFiles/cmTC_35b7b.dir/build.make CMakeFiles/cmTC_35b7b.dir/build make[1]: Entering directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' -Building CXX object CMakeFiles/cmTC_00553.dir/feature_tests.cxx.o -/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=c++98 -std=gnu++11 -o CMakeFiles/cmTC_00553.dir/feature_tests.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.cxx -Linking CXX executable cmTC_00553 -/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_00553.dir/link.txt --verbose=1 -/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_00553.dir/feature_tests.cxx.o -o cmTC_00553 +Building CXX object CMakeFiles/cmTC_35b7b.dir/feature_tests.cxx.o +/usr/bin/g++ -m32 -ffreestanding -nostdlib -std=c++98 -std=gnu++11 -o CMakeFiles/cmTC_35b7b.dir/feature_tests.cxx.o -c /home/gbowne1/Documents/ClassicOS/build/CMakeFiles/feature_tests.cxx +Linking CXX executable cmTC_35b7b +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_35b7b.dir/link.txt --verbose=1 +/usr/bin/g++ -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/cmTC_35b7b.dir/feature_tests.cxx.o -o cmTC_35b7b /usr/bin/ld: warning: cannot find entry symbol kernel_main; defaulting to 0000000000100000 make[1]: Leaving directory '/home/gbowne1/Documents/ClassicOS/build/CMakeFiles/CMakeTmp' diff --git a/build/CMakeFiles/ClassicOS.dir/C.includecache b/build/CMakeFiles/ClassicOS.dir/C.includecache index 0e68214..9775286 100644 --- a/build/CMakeFiles/ClassicOS.dir/C.includecache +++ b/build/CMakeFiles/ClassicOS.dir/C.includecache @@ -9,24 +9,20 @@ /home/gbowne1/Documents/ClassicOS/src/drivers/audio/audio.c audio.h /home/gbowne1/Documents/ClassicOS/src/drivers/audio/audio.h -stdbool.h -- -stddef.h -- -stdint.h +time.h - /home/gbowne1/Documents/ClassicOS/src/drivers/audio/audio.h -stdbool.h +stdint.h - stddef.h - -stdint.h -- /home/gbowne1/Documents/ClassicOS/src/drivers/bus/eisa.c eisa.h /home/gbowne1/Documents/ClassicOS/src/drivers/bus/eisa.h +stdarg.h +- stdbool.h - stddef.h @@ -45,6 +41,8 @@ stdint.h - stdio.h - +stdarg.h +- /home/gbowne1/Documents/ClassicOS/src/drivers/bus/isa.c isa.h @@ -55,6 +53,12 @@ stddef.h - stdint.h - +stdarg.h +- +stdio.h +- +string.h +- /home/gbowne1/Documents/ClassicOS/src/drivers/bus/isa.h stdbool.h @@ -222,6 +226,28 @@ stdlib.h ./tty.h /home/gbowne1/Documents/ClassicOS/src/drivers/tty/./tty.h +/home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/gdt.h +stdint.h +- +stdbool.h +- + +/home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/idt.h +include/types.h +/home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/include/types.h +stdbool.h +- + +/home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/include/memory.h +stddef.h +- +stdint.h +- + +/home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/include/types.h +stdint.h +- + /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/gdt.c gdt.h /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/gdt.h @@ -249,18 +275,24 @@ sys/cdefs.h /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/gdt.h stdint.h - +stdbool.h +- /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/idt.c idt.h /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/idt.h -isr/isr.h -/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/isr.h ../../../drivers/keyboard/keyboard.h /home/gbowne1/Documents/ClassicOS/src/drivers/keyboard/keyboard.h +isr/isr.h +/home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/isr.h +stdint.h +- /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/idt.h include/types.h /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/include/types.h +stdbool.h +- /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/include/memory.h stddef.h @@ -269,18 +301,36 @@ stdint.h - /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/include/types.h +stdint.h +- /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/exceptions.c exceptions.h /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/exceptions.h +setjmp.h +- +signal.h +- stdio.h - +stdlib.h +- +stdint.h +- /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/exceptions.h +stddef.h +- +stdint.h +- /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/isr.c isr.h /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/isr.h +stdbool.h +- +stdio.h +- /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/isr/isr.h ../include/types.h @@ -297,8 +347,40 @@ string.h /home/gbowne1/Documents/ClassicOS/src/kernel/kernel.c kernel.h /home/gbowne1/Documents/ClassicOS/src/kernel/kernel.h +../kernel/malloc/kmalloc.h +/home/gbowne1/Documents/ClassicOS/src/kernel/malloc/kmalloc.h +../kernel/malloc/malloc.h +/home/gbowne1/Documents/ClassicOS/src/kernel/malloc/malloc.h +./arch/x86/gdt.h +/home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/gdt.h +./arch/x86/idt.h +/home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/idt.h +./arch/x86/include/memory.h +/home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/include/memory.h +stdbool.h +- +stddef.h +- +stdint.h +- +stdio.h +- +string.h +- /home/gbowne1/Documents/ClassicOS/src/kernel/kernel.h +kernel.h +/home/gbowne1/Documents/ClassicOS/src/kernel/kernel.h + +/home/gbowne1/Documents/ClassicOS/src/kernel/malloc/kmalloc.h +stdint.h +- +stddef.h +- + +/home/gbowne1/Documents/ClassicOS/src/kernel/malloc/malloc.h +stddef.h +- /home/gbowne1/Documents/ClassicOS/src/kernel/print.c kernel.h diff --git a/build/CMakeFiles/ClassicOS.dir/depend.internal b/build/CMakeFiles/ClassicOS.dir/depend.internal index 8dd6a80..9e974a9 100644 --- a/build/CMakeFiles/ClassicOS.dir/depend.internal +++ b/build/CMakeFiles/ClassicOS.dir/depend.internal @@ -62,8 +62,14 @@ CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/memory/memory.c.o /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/include/memory.h /home/gbowne1/Documents/ClassicOS/src/kernel/arch/x86/memory/memory.c CMakeFiles/ClassicOS.dir/src/kernel/kernel.c.o + /home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/gdt.h + /home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/idt.h + /home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/include/memory.h + /home/gbowne1/Documents/ClassicOS/src/kernel/./arch/x86/include/types.h /home/gbowne1/Documents/ClassicOS/src/kernel/kernel.c /home/gbowne1/Documents/ClassicOS/src/kernel/kernel.h + /home/gbowne1/Documents/ClassicOS/src/kernel/malloc/kmalloc.h + /home/gbowne1/Documents/ClassicOS/src/kernel/malloc/malloc.h CMakeFiles/ClassicOS.dir/src/kernel/print.c.o /home/gbowne1/Documents/ClassicOS/src/kernel/kernel.h /home/gbowne1/Documents/ClassicOS/src/kernel/print.c diff --git a/build/CMakeFiles/ClassicOS.dir/depend.make b/build/CMakeFiles/ClassicOS.dir/depend.make index 25ab51f..e53fb3b 100644 --- a/build/CMakeFiles/ClassicOS.dir/depend.make +++ b/build/CMakeFiles/ClassicOS.dir/depend.make @@ -61,8 +61,14 @@ CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/isr/isr.c.o: ../src/kernel/arch/x86 CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/memory/memory.c.o: ../src/kernel/arch/x86/include/memory.h CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/memory/memory.c.o: ../src/kernel/arch/x86/memory/memory.c +CMakeFiles/ClassicOS.dir/src/kernel/kernel.c.o: ../src/kernel/./arch/x86/gdt.h +CMakeFiles/ClassicOS.dir/src/kernel/kernel.c.o: ../src/kernel/./arch/x86/idt.h +CMakeFiles/ClassicOS.dir/src/kernel/kernel.c.o: ../src/kernel/./arch/x86/include/memory.h +CMakeFiles/ClassicOS.dir/src/kernel/kernel.c.o: ../src/kernel/./arch/x86/include/types.h CMakeFiles/ClassicOS.dir/src/kernel/kernel.c.o: ../src/kernel/kernel.c CMakeFiles/ClassicOS.dir/src/kernel/kernel.c.o: ../src/kernel/kernel.h +CMakeFiles/ClassicOS.dir/src/kernel/kernel.c.o: ../src/kernel/malloc/kmalloc.h +CMakeFiles/ClassicOS.dir/src/kernel/kernel.c.o: ../src/kernel/malloc/malloc.h CMakeFiles/ClassicOS.dir/src/kernel/print.c.o: ../src/kernel/kernel.h CMakeFiles/ClassicOS.dir/src/kernel/print.c.o: ../src/kernel/print.c diff --git a/build/CMakeFiles/ClassicOS.dir/flags.make b/build/CMakeFiles/ClassicOS.dir/flags.make index 3f4bdec..38bd709 100644 --- a/build/CMakeFiles/ClassicOS.dir/flags.make +++ b/build/CMakeFiles/ClassicOS.dir/flags.make @@ -9,7 +9,7 @@ ASM_NASM_DEFINES = ASM_NASM_INCLUDES = -C_FLAGS = -m32 -ffreestanding -nostdlib -g -std=gnu11 +C_FLAGS = -m32 -ffreestanding -nostdlib -std=gnu11 C_DEFINES = diff --git a/build/CMakeFiles/ClassicOS.dir/link.txt b/build/CMakeFiles/ClassicOS.dir/link.txt index 2808a32..33d68a9 100644 --- a/build/CMakeFiles/ClassicOS.dir/link.txt +++ b/build/CMakeFiles/ClassicOS.dir/link.txt @@ -1 +1 @@ -/usr/bin/gcc -m32 -ffreestanding -nostdlib -g -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/memory/memory.c.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/gdt.c.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/gdt.asm.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/idt.c.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/idt.asm.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/isr/isr.c.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/isr/exceptions.c.o CMakeFiles/ClassicOS.dir/src/kernel/kernel.c.o CMakeFiles/ClassicOS.dir/src/kernel/print.c.o CMakeFiles/ClassicOS.dir/src/kernel/stack.c.o CMakeFiles/ClassicOS.dir/src/drivers/audio/audio.c.o CMakeFiles/ClassicOS.dir/src/drivers/bus/eisa.c.o CMakeFiles/ClassicOS.dir/src/drivers/bus/isa.c.o CMakeFiles/ClassicOS.dir/src/drivers/bus/mca.c.o CMakeFiles/ClassicOS.dir/src/drivers/bus/pci.c.o CMakeFiles/ClassicOS.dir/src/drivers/bus/vesa.c.o CMakeFiles/ClassicOS.dir/src/drivers/display/display.c.o CMakeFiles/ClassicOS.dir/src/drivers/io/io.c.o CMakeFiles/ClassicOS.dir/src/drivers/io/io.asm.o CMakeFiles/ClassicOS.dir/src/drivers/keyboard/keyboard.c.o CMakeFiles/ClassicOS.dir/src/drivers/screen/screen.c.o CMakeFiles/ClassicOS.dir/src/drivers/tty/tty.c.o -o ClassicOS +/usr/bin/gcc -m32 -ffreestanding -nostdlib -e kernel_main -T/home/gbowne1/Documents/ClassicOS/linker.ld -m32 -z noexecstack CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/memory/memory.c.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/gdt.c.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/gdt.asm.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/idt.c.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/idt.asm.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/isr/isr.c.o CMakeFiles/ClassicOS.dir/src/kernel/arch/x86/isr/exceptions.c.o CMakeFiles/ClassicOS.dir/src/kernel/kernel.c.o CMakeFiles/ClassicOS.dir/src/kernel/print.c.o CMakeFiles/ClassicOS.dir/src/kernel/stack.c.o CMakeFiles/ClassicOS.dir/src/drivers/audio/audio.c.o CMakeFiles/ClassicOS.dir/src/drivers/bus/eisa.c.o CMakeFiles/ClassicOS.dir/src/drivers/bus/isa.c.o CMakeFiles/ClassicOS.dir/src/drivers/bus/mca.c.o CMakeFiles/ClassicOS.dir/src/drivers/bus/pci.c.o CMakeFiles/ClassicOS.dir/src/drivers/bus/vesa.c.o CMakeFiles/ClassicOS.dir/src/drivers/display/display.c.o CMakeFiles/ClassicOS.dir/src/drivers/io/io.c.o CMakeFiles/ClassicOS.dir/src/drivers/io/io.asm.o CMakeFiles/ClassicOS.dir/src/drivers/keyboard/keyboard.c.o CMakeFiles/ClassicOS.dir/src/drivers/screen/screen.c.o CMakeFiles/ClassicOS.dir/src/drivers/tty/tty.c.o -o ClassicOS diff --git a/build/CMakeFiles/ClassicOSBL.dir/depend.internal b/build/CMakeFiles/ClassicOSBL.dir/depend.internal deleted file mode 100644 index 4d9bd6a..0000000 --- a/build/CMakeFiles/ClassicOSBL.dir/depend.internal +++ /dev/null @@ -1,3 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.13 - diff --git a/build/CMakeFiles/ClassicOSBL.dir/depend.make b/build/CMakeFiles/ClassicOSBL.dir/depend.make index 4d9bd6a..d78adc3 100644 --- a/build/CMakeFiles/ClassicOSBL.dir/depend.make +++ b/build/CMakeFiles/ClassicOSBL.dir/depend.make @@ -1,3 +1,2 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "Unix Makefiles" Generator, CMake Version 3.13 - +# Empty dependencies file for ClassicOSBL. +# This may be replaced when dependencies are built. diff --git a/build/CMakeFiles/Makefile.cmake b/build/CMakeFiles/Makefile.cmake index 1bbeed4..9292d79 100644 --- a/build/CMakeFiles/Makefile.cmake +++ b/build/CMakeFiles/Makefile.cmake @@ -12,21 +12,93 @@ set(CMAKE_MAKEFILE_DEPENDS "CMakeFiles/3.13.4/CMakeCCompiler.cmake" "CMakeFiles/3.13.4/CMakeCXXCompiler.cmake" "CMakeFiles/3.13.4/CMakeSystem.cmake" + "CMakeFiles/feature_tests.c" + "CMakeFiles/feature_tests.cxx" "../x86-baremetal-toolchain.cmake" + "/usr/share/cmake-3.13/Modules/CMakeASMCompiler.cmake.in" "/usr/share/cmake-3.13/Modules/CMakeASMInformation.cmake" "/usr/share/cmake-3.13/Modules/CMakeASM_NASMInformation.cmake" + "/usr/share/cmake-3.13/Modules/CMakeCCompiler.cmake.in" + "/usr/share/cmake-3.13/Modules/CMakeCCompilerABI.c" "/usr/share/cmake-3.13/Modules/CMakeCInformation.cmake" + "/usr/share/cmake-3.13/Modules/CMakeCXXCompiler.cmake.in" + "/usr/share/cmake-3.13/Modules/CMakeCXXCompilerABI.cpp" "/usr/share/cmake-3.13/Modules/CMakeCXXInformation.cmake" "/usr/share/cmake-3.13/Modules/CMakeCommonLanguageInclude.cmake" + "/usr/share/cmake-3.13/Modules/CMakeCompilerIdDetection.cmake" + "/usr/share/cmake-3.13/Modules/CMakeDetermineASMCompiler.cmake" + "/usr/share/cmake-3.13/Modules/CMakeDetermineASM_NASMCompiler.cmake" + "/usr/share/cmake-3.13/Modules/CMakeDetermineCCompiler.cmake" + "/usr/share/cmake-3.13/Modules/CMakeDetermineCXXCompiler.cmake" + "/usr/share/cmake-3.13/Modules/CMakeDetermineCompileFeatures.cmake" + "/usr/share/cmake-3.13/Modules/CMakeDetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/CMakeDetermineCompilerABI.cmake" + "/usr/share/cmake-3.13/Modules/CMakeDetermineCompilerId.cmake" + "/usr/share/cmake-3.13/Modules/CMakeDetermineSystem.cmake" + "/usr/share/cmake-3.13/Modules/CMakeFindBinUtils.cmake" "/usr/share/cmake-3.13/Modules/CMakeGenericSystem.cmake" "/usr/share/cmake-3.13/Modules/CMakeInitializeConfigs.cmake" "/usr/share/cmake-3.13/Modules/CMakeLanguageInformation.cmake" + "/usr/share/cmake-3.13/Modules/CMakeParseImplicitLinkInfo.cmake" + "/usr/share/cmake-3.13/Modules/CMakeSystem.cmake.in" "/usr/share/cmake-3.13/Modules/CMakeSystemSpecificInformation.cmake" "/usr/share/cmake-3.13/Modules/CMakeSystemSpecificInitialize.cmake" + "/usr/share/cmake-3.13/Modules/CMakeTestASMCompiler.cmake" + "/usr/share/cmake-3.13/Modules/CMakeTestASM_NASMCompiler.cmake" + "/usr/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake" + "/usr/share/cmake-3.13/Modules/CMakeTestCXXCompiler.cmake" + "/usr/share/cmake-3.13/Modules/CMakeTestCompilerCommon.cmake" + "/usr/share/cmake-3.13/Modules/CMakeUnixFindMake.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/ADSP-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/ARMCC-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/AppleClang-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Borland-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Bruce-C-DetermineCompiler.cmake" "/usr/share/cmake-3.13/Modules/Compiler/CMakeCommonCompilerMacros.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Clang-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Clang-DetermineCompilerInternal.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Compaq-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Cray-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Embarcadero-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Fujitsu-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/GHS-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/GNU-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/GNU-C-FeatureTests.cmake" "/usr/share/cmake-3.13/Modules/Compiler/GNU-C.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/GNU-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/GNU-CXX-FeatureTests.cmake" "/usr/share/cmake-3.13/Modules/Compiler/GNU-CXX.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/GNU-FindBinUtils.cmake" "/usr/share/cmake-3.13/Modules/Compiler/GNU.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/HP-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/HP-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/IAR-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Intel-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/MIPSpro-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/MSVC-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/NVIDIA-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/PGI-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/PathScale-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/SCO-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/SDCC-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/SunPro-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/TI-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/VisualAge-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/Watcom-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/XL-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/XL-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/zOS-C-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Compiler/zOS-CXX-DetermineCompiler.cmake" + "/usr/share/cmake-3.13/Modules/Internal/FeatureTesting.cmake" + "/usr/share/cmake-3.13/Modules/Platform/Linux-Determine-CXX.cmake" "/usr/share/cmake-3.13/Modules/Platform/Linux-GNU-C.cmake" "/usr/share/cmake-3.13/Modules/Platform/Linux-GNU-CXX.cmake" "/usr/share/cmake-3.13/Modules/Platform/Linux-GNU.cmake" @@ -42,6 +114,12 @@ set(CMAKE_MAKEFILE_OUTPUTS # Byproducts of CMake generate step: set(CMAKE_MAKEFILE_PRODUCTS + "CMakeFiles/3.13.4/CMakeSystem.cmake" + "CMakeFiles/3.13.4/CMakeASM_NASMCompiler.cmake" + "CMakeFiles/3.13.4/CMakeCCompiler.cmake" + "CMakeFiles/3.13.4/CMakeCXXCompiler.cmake" + "CMakeFiles/3.13.4/CMakeCCompiler.cmake" + "CMakeFiles/3.13.4/CMakeCXXCompiler.cmake" "CMakeFiles/CMakeDirectoryInformation.cmake" ) diff --git a/build/CMakeFiles/Progress/10 b/build/CMakeFiles/Progress/10 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/10 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/11 b/build/CMakeFiles/Progress/11 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/11 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/12 b/build/CMakeFiles/Progress/12 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/12 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/13 b/build/CMakeFiles/Progress/13 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/13 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/14 b/build/CMakeFiles/Progress/14 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/14 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/15 b/build/CMakeFiles/Progress/15 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/15 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/16 b/build/CMakeFiles/Progress/16 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/16 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/17 b/build/CMakeFiles/Progress/17 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/17 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/18 b/build/CMakeFiles/Progress/18 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/18 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/19 b/build/CMakeFiles/Progress/19 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/19 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/20 b/build/CMakeFiles/Progress/20 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/20 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/21 b/build/CMakeFiles/Progress/21 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/21 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/22 b/build/CMakeFiles/Progress/22 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/22 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/23 b/build/CMakeFiles/Progress/23 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/23 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/24 b/build/CMakeFiles/Progress/24 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/24 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/3 b/build/CMakeFiles/Progress/3 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/3 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/4 b/build/CMakeFiles/Progress/4 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/4 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/5 b/build/CMakeFiles/Progress/5 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/5 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/6 b/build/CMakeFiles/Progress/6 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/6 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/7 b/build/CMakeFiles/Progress/7 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/7 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/8 b/build/CMakeFiles/Progress/8 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/8 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/CMakeFiles/Progress/9 b/build/CMakeFiles/Progress/9 deleted file mode 100644 index 7b4d68d..0000000 --- a/build/CMakeFiles/Progress/9 +++ /dev/null @@ -1 +0,0 @@ -empty \ No newline at end of file diff --git a/build/cmake_install.cmake b/build/cmake_install.cmake index 52eef28..1a3097d 100644 --- a/build/cmake_install.cmake +++ b/build/cmake_install.cmake @@ -12,7 +12,7 @@ if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME) string(REGEX REPLACE "^[^A-Za-z0-9_]+" "" CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}") else() - set(CMAKE_INSTALL_CONFIG_NAME "Debug") + set(CMAKE_INSTALL_CONFIG_NAME "") endif() message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"") endif() diff --git a/src/boot/boot.asm b/src/boot/boot.asm index 41f43c6..a902a22 100644 --- a/src/boot/boot.asm +++ b/src/boot/boot.asm @@ -20,46 +20,48 @@ start: ;Enable A20 Gate EnableA20Gate: call TestA20 - cmp ax, 1 - je A20Enabled + cmp ax, 1 + jne A20Disabled + + ; A20 is already enabled, skip further checks + jmp A20Enabled tryUsingBIOS: mov ax, 0x2401 - int 0x15 - call TestA20 - cmp ax, 1 - je A20Enabled + int 0x15 + call TestA20 + cmp ax, 1 + jne A20Disabled tryUsingKeyboardController: cli - call WaitCommand - mov al, 0xAD ;Disable the keyboard - out 0x64, al + call WaitCommand + mov al, 0xAD + out 0x64, al - call WaitCommand - mov al, 0xD0 ;Read from input - out 0x64, al + call WaitCommand + mov al, 0xD0 + out 0x64, al - call WaitData - in al, 0x60 ;Read input from keyboard - push ax ;Save it + call WaitData + in al, 0x60 + push ax - call WaitCommand - mov al, 0xD1 ;Write to output - out 0x64, al + call WaitCommand + mov al, 0xD1 + out 0x64, al - call WaitCommand - pop ax ;Write to input back with bit #2 set - or al, 2 - out 0x60, al + call WaitCommand + pop ax + or al, 2 + out 0x60, al - call WaitCommand - mov al, 0xAE ;Enable Keyboard - out 0x64, al + call WaitCommand + mov al, 0xAE + out 0x64, al - call WaitCommand - sti - jmp A20KeyboardCheck + sti + jmp A20KeyboardCheck WaitCommand: in al, 0x64 @@ -75,16 +77,16 @@ WaitData: A20KeyboardCheck: call TestA20 - cmp ax, 1 - je A20Enabled + cmp ax, 1 + jne A20Disabled UseFastA20Method: in al, 0x92 - or al, 2 - out 0x92, al - call TestA20 - cmp ax, 1 - je A20Enabled + or al, 2 + out 0x92, al + call TestA20 + cmp ax, 1 + jne A20Disabled ;Else bail out, A20 cannot be enabled, maybe :) A20Error: @@ -96,36 +98,44 @@ A20Error: int 19h jmp $ + +A20Disabled: + jmp A20Error ;If we ever get here, A20 is enabled! A20Enabled: + LoadSecondStage: push es - mov ax, 0x7e0 - mov es, ax + mov ax, 0x7E0 + mov es, ax - stc - mov dh, 0 - mov ah, 0x02 - mov al, 2 ;load 2 sectors - mov ch, 0 - mov cl, 2 + stc + mov dh, 0 + mov ah, 0x02 + mov al, 2 + mov ch, 0 + mov cl, 2 - mov dl, [bootdev] + mov dl, [bootdev] - xor bx, bx ; [es:bx] = 0x07e0:0x0000 - int 13h + xor bx, bx + int 13h - jnc load_success + jc disk_error + + pop es + mov dl, [bootdev] + jmp 0x7E0:0x0000 disk_error: mov si, disk_read_error_msg - call print - xor ax, ax - int 16h - xor ax, ax - int 19h + call print + xor ax, ax + int 16h + xor ax, ax + int 19h -jmp $ + jmp $ load_success: pop es @@ -206,8 +216,8 @@ A20Exit: ;;;;;;End of function;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -disk_read_error_msg db 'Error Reading disk. Press any key to reboot. Code : 0x01', 0 -A20_error_msg db 'An Internal error occured. Press any key to reboot. Code: 0x02', 0 +disk_read_error_msg db 'Disk read error. Boot failed.', 0 +A20_error_msg db 'Failed to enable A20 line. Boot aborted.', 0 bootdev db 0 times 442 - ($-$$) db 0 diff --git a/src/cpu/cpu b/src/cpu/cpu new file mode 100755 index 0000000..487a6f8 Binary files /dev/null and b/src/cpu/cpu differ diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 40b9a8e..256460d 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -1,83 +1,46 @@ #include "cpu.h" +#include +#include -// Function to read a 32-bit value from a CPU register -uint32_t read_register(uint8_t reg) { - uint32_t value; - __asm__ volatile("mov %0, %%" : "+r"(value) : "c"(reg)); - return value; -} +// Existing functions +uint32_t read_register(uint8_t reg) { /*...*/ } +void write_register(uint8_t reg, uint32_t value) { /*...*/ } +void switch_to_protected_mode() { /*...*/ } -// Function to write a 32-bit value to a CPU register -void write_register(uint8_t reg, uint32_t value) { - __asm__ volatile("mov %0, %%" : : "c"(reg), "r"(value)); -} - -// Function to read the value of the CR0 register -uint32_t read_cr0() +// Integrated cpuid function +/*void cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) { - uint32_t value; - __asm__ volatile("mov %%cr0, %0" : "=r"(value)); - return value; + asm volatile( + "cpuid" + : "=a"(*eax), + "=b"(*ebx), + "=c"(*ecx), + "=d"(*edx) + : "a"(function)); +} +*/ + +// Optionally, integrate identify_cpu function +void identify_cpu() +{ + uint32_t max_leaf; + uint32_t vendor_id[4]; + uint32_t eax, ebx, ecx, edx; + + cpuid(0, &eax, &ebx, &ecx, &edx); + max_leaf = eax; + + cpuid(0x80000000, &eax, &ebx, &ecx, &edx); + vendor_id[0] = eax; + vendor_id[1] = ebx; + vendor_id[2] = ecx; + vendor_id[3] = edx; + + printf("Vendor ID: %.4s%.4s\n", (char *)&vendor_id[0], (char *)&vendor_id[1]); + printf("Maximum leaf value: %u\n", max_leaf); } -// Function to write a value to the CR0 register -void write_cr0(uint32_t value) -{ - __asm__ volatile("mov %0, %%cr0" : : "r"(value)); -} - -// Function to switch from real mode to protected mode -void switch_to_protected_mode() -{ - uint32_t cr0 = read_cr0(); - cr0 |= 0x1; // Set the PE bit to switch to protected mode - write_cr0(cr0); -} - -// Write a byte to a port -void outb(uint16_t port, uint8_t value) -{ - __asm__ volatile ("outb %0, %1" : : "a"(value), "Nd"(port)); -} - -// Read a byte from a port -uint8_t inb(uint16_t port) -{ - uint8_t value; - __asm__ volatile ("inb %1, %0" : "=a"(value) : "Nd"(port)); - return value; -} - -// Write a word to a port -void outw(uint16_t port, uint16_t value) -{ - __asm__ volatile ("outw %0, %1" : : "a"(value), "Nd"(port)); -} - -// Read a word from a port -uint16_t inw(uint16_t port) -{ - uint16_t value; - __asm__ volatile ("inw %1, %0" : "=a"(value) : "Nd"(port)); - return value; -} - -// Write a double word to a port -void outl(uint16_t port, uint32_t value) -{ - __asm__ volatile ("outl %0, %1" : : "a"(value), "Nd"(port)); -} - -// Read a double word from a port -uint32_t inl(uint16_t port) -{ - uint32_t value; - __asm__ volatile ("inl %1, %0" : "=a"(value) : "Nd"(port)); - return value; -} - -// Execute the CPUID instruction -void cpuid(uint32_t code, uint32_t *a, uint32_t *d) -{ - __asm__ volatile ("cpuid" : "=a"(*a), "=d"(*d) : "a"(code) : "ecx", "ebx"); +int main() { + identify_cpu(); + return 0; } diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index c6801e0..c15f511 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -1,32 +1,14 @@ -#ifndef CPU_H -#define CPU_H - -#include - -// Function to read a 32-bit value from a CPU register -uint32_t read_register(uint8_t reg); - -// Function to write a 32-bit value to a CPU register -void write_register(uint8_t reg, uint32_t value); - -// Function to read the value of the CR0 register -uint32_t read_cr0(); - -// Function to write a value to the CR0 register -void write_cr0(uint32_t value); - -// Function to switch from real mode to protected mode -void switch_to_protected_mode(); - -void outb(uint16_t port, uint8_t value); -uint8_t inb(uint16_t port); - -void outw(uint16_t port, uint16_t value); -uint16_t inw(uint16_t port); - -void outl(uint16_t port, uint32_t value); -uint32_t inl(uint16_t port); - -void cpuid(uint32_t code, uint32_t *a, uint32_t *d); - -#endif \ No newline at end of file +#ifndef CPU_H +#define CPU_H + +#include + +// Existing declarations +uint32_t read_register(uint8_t reg); +void write_register(uint8_t reg, uint32_t value); +void switch_to_protected_mode(); + +// New declaration for cpuid +void cpuid(uint32_t function, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx); + +#endif // CPU_H diff --git a/src/cpu/cpuid.S b/src/cpu/cpuid.S new file mode 100644 index 0000000..6c84d6e --- /dev/null +++ b/src/cpu/cpuid.S @@ -0,0 +1,14 @@ +.global cpuid +.type cpuid, @function +cpuid: + push %rbp + mov %rsp, %rbp + sub $16, %rsp + mov %rdi, %rax + cpuid + mov %rax, 8(%rbp) + mov %rbx, 12(%rbp) + mov %rcx, 16(%rbp) + mov %rdx, 20(%rbp) + leave + ret diff --git a/src/cpu/cpuid.asm b/src/cpu/cpuid.asm deleted file mode 100644 index 213d83e..0000000 --- a/src/cpu/cpuid.asm +++ /dev/null @@ -1,32 +0,0 @@ -[bits 32] - -global cpuid - -cpuid: - ; Save registers - push ebp - mov ebp, esp - push ebx - push edi - push esi - - ; Input parameter in EAX register - mov eax, [ebp + 8] ; Assuming the input is passed on the stack - - ; Call CPUID instruction (clobbers EAX, EBX, ECX, EDX) - cpuid - - ; Move output values to the appropriate registers - mov esi, eax ; Output EAX - mov edi, ebx ; Output EBX - mov ecx, ecx ; Output ECX - mov edx, edx ; Output EDX - - ; Restore registers and clean up the stack - pop esi - pop edi - pop ebx - mov esp, ebp - pop ebp - - ret \ No newline at end of file diff --git a/src/cpu/cpuid.c b/src/cpu/cpuid.c deleted file mode 100644 index cdf6b86..0000000 --- a/src/cpu/cpuid.c +++ /dev/null @@ -1,36 +0,0 @@ -#include "cpuid.h" -#include - -void cpuid(uint32_t code, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) { - asm volatile ("cpuid" : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx) : "a" (code)); -} - -void identify_cpu() { - uint32_t max_leaf; - uint32_t vendor_id[4]; - uint32_t eax, ebx, ecx, edx; - - // Get the maximum supported leaf value (CPUID function) - cpuid(0, &eax, &ebx, &ecx, &edx); - max_leaf = eax; - - // Get the vendor ID string - cpuid(0x80000000, &eax, &ebx, &ecx, &edx); - vendor_id[0] = eax; - vendor_id[1] = ebx; - vendor_id[2] = ecx; - vendor_id[3] = edx; - - // Print the vendor ID string (assuming ASCII characters) - printf("Vendor ID: %.4s%.4s\n", (char *)&vendor_id[0], (char *)&vendor_id[1]); - - // Identify basic features based on CPUID information (optional, needs further logic) - // ... (code to check specific CPU features using max_leaf and additional CPUID calls) ... - - printf("Maximum leaf value: %u\n", max_leaf); -} - -int main() { - identify_cpu(); - return 0; -} diff --git a/src/cpu/cpuid.h b/src/cpu/cpuid.h deleted file mode 100644 index 162ba74..0000000 --- a/src/cpu/cpuid.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef CPUID_H -#define CPUID_H - -// Function prototypes for CPUID instruction -void cpuid(uint32_t code, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx); - -#endif diff --git a/src/drivers/audio/audio.c b/src/drivers/audio/audio.c index e12c523..c7a98d8 100644 --- a/src/drivers/audio/audio.c +++ b/src/drivers/audio/audio.c @@ -1,32 +1,83 @@ #include "audio.h" - -#include -#include -#include +#include // Audio controller base address #define AUDIO_BASE_ADDRESS 0x0000 -// Audio controller data port +// Audio controller register offsets #define AUDIO_DATA_PORT 0x00 - -// Audio controller command port #define AUDIO_COMMAND_PORT 0x01 +#define AUDIO_STATUS_PORT 0x02 +#define AUDIO_VOLUME_PORT 0x03 -// Initialize the audio driver -void audio_init() -{ - // Add any necessary initialization code here +#define AUDIO_REG(offset) (*((volatile uint32_t *)(AUDIO_BASE_ADDRESS + (offset)))) +#define AUDIO_TIMEOUT_MS 1000 +#define AUDIO_READY_BIT 0x01 + +static audio_status_t audio_wait_for_ready() { + clock_t start = clock(); + while (!(AUDIO_REG(AUDIO_STATUS_PORT) & AUDIO_READY_BIT)) { + if ((clock() - start) * 1000 / CLOCKS_PER_SEC > AUDIO_TIMEOUT_MS) { + return AUDIO_ERROR_TIMEOUT; + } + } + return AUDIO_OK; } -// Play audio from a buffer -void audio_play(const uint8_t *buffer, size_t size) -{ - // Add any necessary code to play audio from the buffer here +audio_status_t audio_init(const audio_config_t *config) { + if (config == NULL) { + return AUDIO_ERROR_INIT; + } + + // Reset the audio controller + AUDIO_REG(AUDIO_COMMAND_PORT) = 0x12345678; // Placeholder reset command + + // Set sample rate + AUDIO_REG(AUDIO_COMMAND_PORT) = config->sample_rate; + + // Set bit depth and channels + uint32_t format = (config->bit_depth << 8) | config->channels; + AUDIO_REG(AUDIO_COMMAND_PORT) = format; + + // Enable audio interrupt (placeholder) + AUDIO_REG(AUDIO_COMMAND_PORT) = 0x87654321; + + return audio_wait_for_ready(); } -// Stop audio playback -void audio_stop() -{ - // Add any necessary code to stop audio playback here +audio_status_t audio_play(const uint8_t *buffer, size_t size) { + if (buffer == NULL || size == 0) { + return AUDIO_ERROR_PLAY; + } + + // Set buffer address and size + AUDIO_REG(AUDIO_DATA_PORT) = (uint32_t)buffer; + AUDIO_REG(AUDIO_DATA_PORT + 4) = size; + + // Start playback + AUDIO_REG(AUDIO_COMMAND_PORT) = 0xABCD1234; // Placeholder play command + + return audio_wait_for_ready(); +} + +audio_status_t audio_stop() { + AUDIO_REG(AUDIO_COMMAND_PORT) = 0x87654321; // Placeholder stop command + return audio_wait_for_ready(); +} + +// Implement the rest of the functions here... + +void audio_interrupt_handler() { + // Handle various interrupt scenarios (e.g., buffer underrun, playback complete) + uint32_t status = AUDIO_REG(AUDIO_STATUS_PORT); + + if (status & 0x01) { // Example: Buffer underrun + // Handle buffer underrun + } + if (status & 0x02) { // Example: Playback complete + // Handle playback complete + } + + // Clear interrupt flags + AUDIO_REG(AUDIO_STATUS_PORT) = status; } diff --git a/src/drivers/audio/audio.h b/src/drivers/audio/audio.h index 5d9610e..bf1c874 100644 --- a/src/drivers/audio/audio.h +++ b/src/drivers/audio/audio.h @@ -1,17 +1,30 @@ -#ifndef AUDIO_H -#define AUDIO_H - -#include -#include -#include - -// Initialize the audio driver -void audio_init(); - -// Play audio from a buffer -void audio_play(const uint8_t* buffer, size_t size); - -// Stop audio playback -void audio_stop(); - -#endif \ No newline at end of file +#ifndef AUDIO_H +#define AUDIO_H + +#include +#include + +typedef enum { + AUDIO_OK, + AUDIO_ERROR_INIT, + AUDIO_ERROR_PLAY, + AUDIO_ERROR_STOP, + AUDIO_ERROR_TIMEOUT +} audio_status_t; + +typedef struct { + uint32_t sample_rate; + uint8_t bit_depth; + uint8_t channels; +} audio_config_t; + +audio_status_t audio_init(const audio_config_t *config); +audio_status_t audio_play(const uint8_t *buffer, size_t size); +audio_status_t audio_stop(); +audio_status_t audio_queue_buffer(const uint8_t *buffer, size_t size); +audio_status_t audio_get_buffer_status(size_t *remaining_bytes); +audio_status_t audio_set_volume(uint8_t volume); +audio_status_t audio_get_volume(uint8_t *volume); +void audio_interrupt_handler(); + +#endif // AUDIO_H diff --git a/src/drivers/bus/eisa.c b/src/drivers/bus/eisa.c index c05f040..fc83246 100644 --- a/src/drivers/bus/eisa.c +++ b/src/drivers/bus/eisa.c @@ -1,12 +1,13 @@ #include "eisa.h" +#include #include #include #include #include -#define MY_DEVICE_VENDOR_ID 0x1234 -#define MY_DEVICE_DEVICE_ID 0x5678 +#define MY_DEVICE_VENDOR_ID 0x1234 +#define MY_DEVICE_DEVICE_ID 0x5678 #define MY_DEVICE_CLASS_CODE 0x90AB // EISA bus controller base address @@ -18,120 +19,149 @@ // EISA bus controller command port #define EISA_COMMAND_PORT 0x01 +// EISA bus controller interrupt control port +#define EISA_INTERRUPT_CONTROL_PORT 0x03 // Placeholder, replace with actual address + +// EISA bus controller DMA channel configuration port +#define EISA_DMA_CHANNEL_CONFIG_PORT 0x04 // Placeholder, replace with actual address + // Initialize the EISA bus void eisa_init() { - // Add any necessary initialization code here + // Reset the EISA bus controller (if supported) + eisa_write(EISA_COMMAND_PORT, 0xFF); // Example: Send a reset command + + // Configure base address registers (if needed) + eisa_write(EISA_BASE_ADDRESS + 1, 0x0000); // Example: Set base address register + eisa_write(EISA_BASE_ADDRESS + 2, 0x0000); // Example: Set another base address register + + // Set up interrupts (example) + eisa_write(EISA_INTERRUPT_CONTROL_PORT, 0x00); // Enable/disable interrupts + + // Configure DMA channels (example) + eisa_write(EISA_DMA_CHANNEL_CONFIG_PORT, 0x00); // Configure DMA channels + // Other hardware-specific initialization... +} + +void log_error(const char *format, ...) +{ + va_list args; + va_start(args, format); + vprintf(format, args); + va_end(args); } // Detect and configure EISA devices void eisa_detect_devices() { - uint32_t bus, slot, func; - uint16_t vendor_id, device_id, class_code; + uint32_t bus, slot, func; + uint16_t vendor_id, device_id, class_code; + uint8_t dma_channel; - for (bus = 0; bus < 256; bus++) - { - for (slot = 0; slot < 32; slot++) - { - for (func = 0; func < 8; func++) - { - uint32_t address = (bus << 16) | (slot << 11) | (func << 8); - uint32_t id = eisa_read_config_dword(address, 0); - vendor_id = id & 0xFFFF; - device_id = (id >> 16) & 0xFFFF; - class_code = eisa_read_config_word(address, 10); - if (vendor_id != 0xFFFF) - { - // Device detected, do something with it - if (vendor_id == MY_DEVICE_VENDOR_ID && - device_id == MY_DEVICE_DEVICE_ID && - class_code == MY_DEVICE_CLASS_CODE) - { - // This is my device, configure it - uint32_t config1 = eisa_read_config_dword(address, 4); + for (bus = 0; bus < 256; bus++) + { + for (slot = 0; slot < 32; slot++) + { + for (func = 0; func < 8; func++) + { + uint32_t address = (bus << 16) | (slot << 11) | (func << 8); + uint32_t id = eisa_read_config_dword(address, 0); + vendor_id = id & 0xFFFF; + device_id = (id >> 16) & 0xFFFF; + class_code = eisa_read_config_word(address, 10); + + if (vendor_id != 0xFFFF) + { + if (vendor_id == MY_DEVICE_VENDOR_ID && + device_id == MY_DEVICE_DEVICE_ID && + class_code == MY_DEVICE_CLASS_CODE) + { + uint32_t config1 = eisa_read_config_dword(address, 4); uint32_t config2 = eisa_read_config_dword(address, 8); - //printf("Config1: %u\n", config1); - //printf("Config2: %u\n", config2); - // Do something with the configuration data - - // Check for specific bits in config1 - if (config1 & 0x00000001) { - // Enable feature 1 based on bit 0 of config1 - eisa_write(0xspecific_port_1, 0xvalue_to_enable_feature_1); + if ((config1 & 0x00000010) == 0) + { + dma_channel = (config1 >> 4) & 0x03; + // Replace 0xspecific_port_2 with the actual port number + eisa_write(0x02, dma_channel); // Example: Assuming 0x02 is the correct port number + log_error("Failed to enable feature 1"); } - if (config1 & 0x00000010) { - // Set DMA channel based on bits 4-5 of config1 - uint8_t dma_channel = (config1 >> 4) & 0x03; - eisa_write(0xspecific_port_2, dma_channel); + if (!dma_channel) + { + log_error("Failed to set DMA channel"); } - - // Check for specific bits in config2 - if (config2 & 0x00000001) { - // Configure interrupt line based on bit 0 of config2 - eisa_write(0xspecific_port_3, 0xinterrupt_line_number); + if (!(config2 & 0x00000001)) + { + log_error("Failed to configure interrupt line"); } - } - } - } - } - } + } + else + { + log_error("Unknown device detected at address: 0x%04X", address); + } + } + else + { + log_error("No device found at address: 0x%04X", address); + } + } + } + } } // Read a double word (32 bits) from an EISA device's configuration space uint32_t eisa_read_config_dword(uint32_t address, uint8_t offset) { - // Set the EISA bus controller base address - eisa_write(EISA_BASE_ADDRESS, address); + // Set the EISA bus controller base address + eisa_write(EISA_BASE_ADDRESS, address); - // Set the EISA bus controller command port to read configuration data - eisa_write(EISA_COMMAND_PORT, 0x80 | (offset & 0x03)); + // Set the EISA bus controller command port to read configuration data + eisa_write(EISA_COMMAND_PORT, 0x80 | (offset & 0x03)); - // Read the double word from the EISA bus controller data port - uint32_t value = 0; - for (int i = 0; i < 4; i++) - { - value |= (eisa_read(EISA_DATA_PORT) << (i * 8)); - } + // Read the double word from the EISA bus controller data port + uint32_t value = 0; + for (int i = 0; i < 4; i++) + { + value |= (eisa_read(EISA_DATA_PORT) << (i * 8)); + } - return value; + return value; } // Read a word (16 bits) from an EISA device's configuration space uint16_t eisa_read_config_word(uint32_t address, uint8_t offset) { - // Set the EISA bus controller base address - eisa_write(EISA_BASE_ADDRESS, address); + // Set the EISA bus controller base address + eisa_write(EISA_BASE_ADDRESS, address); - // Set the EISA bus controller command port to read configuration data - eisa_write(EISA_COMMAND_PORT, 0x80 | (offset & 0x03)); + // Set the EISA bus controller command port to read configuration data + eisa_write(EISA_COMMAND_PORT, 0x80 | (offset & 0x03)); - // Read the word from the EISA bus controller data port - uint16_t value = 0; - for (int i = 0; i < 2; i++) - { - value |= (eisa_read(EISA_DATA_PORT) << (i * 8)); - } + // Read the word from the EISA bus controller data port + uint16_t value = 0; + for (int i = 0; i < 2; i++) + { + value |= (eisa_read(EISA_DATA_PORT) << (i * 8)); + } - return value; + return value; } // Read from an EISA device uint8_t eisa_read(uint16_t port) { - uint8_t value; + uint8_t value; - // Read from the specified port - __asm__ volatile("inb %1, %0" : "=a"(value) : "dN"(port)); + // Read from the specified port + __asm__ volatile("inb %1, %0" : "=a"(value) : "dN"(port)); - return value; + return value; } // Write to an EISA device void eisa_write(uint16_t port, uint8_t value) { - // Write the specified value to the specified port - __asm__ volatile("outb %0, %1" : : "a"(value), "dN"(port)); + // Write the specified value to the specified port + __asm__ volatile("outb %0, %1" : : "a"(value), "dN"(port)); } diff --git a/src/drivers/bus/eisa.h b/src/drivers/bus/eisa.h index 81a7d56..4a841ec 100644 --- a/src/drivers/bus/eisa.h +++ b/src/drivers/bus/eisa.h @@ -1,27 +1,28 @@ -#ifndef EISA_H -#define EISA_H - -#include -#include -#include -#include - -// Initialize the EISA bus -void eisa_init(); - -// Detect and configure EISA devices -void eisa_detect_devices(); - -// Read a double word (32 bits) from an EISA device's configuration space -uint32_t eisa_read_config_dword(uint32_t address, uint8_t offset); - -// Read a word (16 bits) from an EISA device's configuration space -uint16_t eisa_read_config_word(uint32_t address, uint8_t offset); - -// Read from an EISA device -uint8_t eisa_read(uint16_t port); - -// Write to an EISA device -void eisa_write(uint16_t port, uint8_t value); - -#endif \ No newline at end of file +#ifndef EISA_H +#define EISA_H + +#include +#include +#include +#include +#include + +// Initialize the EISA bus +void eisa_init(); + +// Detect and configure EISA devices +void eisa_detect_devices(); + +// Read a double word (32 bits) from an EISA device's configuration space +uint32_t eisa_read_config_dword(uint32_t address, uint8_t offset); + +// Read a word (16 bits) from an EISA device's configuration space +uint16_t eisa_read_config_word(uint32_t address, uint8_t offset); + +// Read from an EISA device +uint8_t eisa_read(uint16_t port); + +// Write to an EISA device +void eisa_write(uint16_t port, uint8_t value); + +#endif diff --git a/src/drivers/bus/isa.c b/src/drivers/bus/isa.c index c5b741c..ed8ec97 100644 --- a/src/drivers/bus/isa.c +++ b/src/drivers/bus/isa.c @@ -1,44 +1,82 @@ -#include "isa.h" - -#include -#include -#include - -// ISA bus controller base address -#define ISA_BASE_ADDRESS 0x0000 - -// ISA bus controller data port -#define ISA_DATA_PORT 0x00 - -// ISA bus controller command port -#define ISA_COMMAND_PORT 0x01 - -// Initialize the ISA bus -void isa_init() -{ - // Add any necessary initialization code here -} - -// Detect and configure ISA devices -void isa_detect_devices() -{ - // Add any necessary device detection and configuration code here -} - -// Read from an ISA device -uint8_t isa_read(uint16_t port) -{ - uint8_t value; - - // Read from the specified port - __asm__ volatile("inb %1, %0" : "=a"(value) : "dN"(port)); - - return value; -} - -// Write to an ISA device -void isa_write(uint16_t port, uint8_t value) -{ - // Write the specified value to the specified port - __asm__ volatile("outb %0, %1" : : "a"(value), "dN"(port)); -} \ No newline at end of file +#include "isa.h" +#include +#include +#include +#include // Include for va_list and related functions +#include +#include + +// ISA bus controller base address +#define ISA_BASE_ADDRESS 0x0000 + +// ISA bus controller data port +#define ISA_DATA_PORT 0x00 + +// ISA bus controller command port +#define ISA_COMMAND_PORT 0x01 + +// Initialize the ISA bus +void isa_init() +{ + // Add any necessary initialization code here +} + +// Detect and configure ISA devices +void isa_detect_devices() +{ + // Add any necessary device detection and configuration code here +} + +// Read from an ISA device +uint8_t isa_read(uint16_t port) +{ + uint8_t value; + + // Check for invalid port + if (port > 0xFF) + { + // Prepare a buffer to hold the formatted string + char buffer[64]; + va_list args; + va_start(args, port); + vsnprintf(buffer, sizeof(buffer), "Invalid port address: 0x%x\n", port); + va_end(args); + + // Use vfprintf to print the contents of the buffer to stderr + vfprintf(stderr, buffer, NULL); + return 0xFF; // Indicate error + } + + // Read from the specified port with improved assembly attributes + __asm__ volatile("inb %1, %0" + : "=r"(value) + : "Nd"(port) + : "memory"); + + return value; +} + +// Write to an ISA device +void isa_write(uint16_t port, uint8_t value) +{ + // Check for invalid port + if (port > 0xFF) + { + // Prepare a buffer to hold the formatted string + char buffer[64]; + va_list args; + va_start(args, port); + vsnprintf(buffer, sizeof(buffer), "Invalid port address: 0x%x\n", port); + va_end(args); + + // Use vfprintf to print the contents of the buffer to stderr + vfprintf(stderr, buffer, NULL); + return; + } + + // Write to the specified port with improved assembly attributes + __asm__ volatile("outb %0, %1" + : + : "r"(value), "Nd"(port) + : "memory"); +} diff --git a/src/drivers/io/io.h b/src/drivers/io/io.h index 8290eee..328ec5a 100644 --- a/src/drivers/io/io.h +++ b/src/drivers/io/io.h @@ -3,6 +3,17 @@ #include +// Inline assembly implementations for I/O operations +static inline void outb(uint16_t port, uint8_t val) { + asm volatile ("outb %0, %1" : : "a"(val), "Nd"(port)); +} + +static inline uint8_t inb(uint16_t port) { + uint8_t ret; + asm volatile ("inb %1, %0" : "=a"(ret) : "Nd"(port)); + return ret; +} + // Function to initialize the COM and LPT ports void io_init(uint16_t port); @@ -18,11 +29,7 @@ char io_read_lpt(); // Function to write to the LPT port void io_write_lpt(char data); -// Function declarations for keyboard.c -extern uint8_t inb(uint16_t port); - -extern void outb(uint16_t port, uint8_t data); - +// Function declaration for interrupt handler installation void install_interrupt_handler(uint8_t interrupt, void (*handler)(void)); #endif /* IO_H */ diff --git a/src/drivers/io/serial.c b/src/drivers/io/serial.c index 021be05..d513220 100644 --- a/src/drivers/io/serial.c +++ b/src/drivers/io/serial.c @@ -1,4 +1,5 @@ #include "serial.h" +#include "io.h" // Include the new I/O header #include #include @@ -43,4 +44,4 @@ void write_serial(uint16_t com, char a) { while (is_transmit_empty(com) == 0); outb(port, a); -} \ No newline at end of file +} diff --git a/src/drivers/io/serial.h b/src/drivers/io/serial.h index 0e85626..f9e8cae 100644 --- a/src/drivers/io/serial.h +++ b/src/drivers/io/serial.h @@ -3,10 +3,11 @@ #include +// Function prototypes void init_serial(uint16_t com); int serial_received(uint16_t com); char read_serial(uint16_t com); int is_transmit_empty(uint16_t com); void write_serial(uint16_t com, char a); -#endif +#endif // SERIAL_H \ No newline at end of file diff --git a/src/drivers/keyboard/keyboard.c b/src/drivers/keyboard/keyboard.c index f45071f..8e82cf9 100644 --- a/src/drivers/keyboard/keyboard.c +++ b/src/drivers/keyboard/keyboard.c @@ -3,6 +3,7 @@ #include #include #include +#include // Keyboard input buffer #define KEYBOARD_BUFFER_SIZE 32 @@ -14,6 +15,98 @@ #define KEYBOARD_ACKNOWLEDGE_SCANCODE 0xFA #define KEYCODE_UNKNOWN 0xFF #define KEYCODE_C 0x03 +#define KEYCODE_ESC 0x01 +#define KEYCODE_1 0x02 +#define KEYCODE_2 0x03 +#define KEYCODE_3 0x04 +#define KEYCODE_4 0x05 +#define KEYCODE_5 0x06 +#define KEYCODE_6 0x07 +#define KEYCODE_7 0x08 +#define KEYCODE_8 0x09 +#define KEYCODE_9 0x0A +#define KEYCODE_0 0x0B +#define KEYCODE_MINUS 0x0C +#define KEYCODE_EQUALS 0x0D +#define KEYCODE_BACKSPACE 0x0E +#define KEYCODE_TAB 0x0F +#define KEYCODE_Q 0x10 +#define KEYCODE_W 0x11 +#define KEYCODE_E 0x12 +#define KEYCODE_R 0x13 +#define KEYCODE_T 0x14 +#define KEYCODE_Y 0x15 +#define KEYCODE_U 0x16 +#define KEYCODE_I 0x17 +#define KEYCODE_O 0x18 +#define KEYCODE_P 0x19 +#define KEYCODE_LEFT_BRACKET 0x1A +#define KEYCODE_RIGHT_BRACKET 0x1B +#define KEYCODE_ENTER 0x1C +#define KEYCODE_LEFT_CTRL 0x1D +#define KEYCODE_A 0x1E +#define KEYCODE_S 0x1F +#define KEYCODE_D 0x20 +#define KEYCODE_F 0x21 +#define KEYCODE_G 0x22 +#define KEYCODE_H 0x23 +#define KEYCODE_J 0x24 +#define KEYCODE_K 0x25 +#define KEYCODE_L 0x26 +#define KEYCODE_SEMICOLON 0x27 +#define KEYCODE_APOSTROPHE 0x28 +#define KEYCODE_GRAVE_ACCENT 0x29 +#define KEYCODE_LEFT_SHIFT 0x2A +#define KEYCODE_BACKSLASH 0x2B +#define KEYCODE_Z 0x2C +#define KEYCODE_X 0x2D +#define KEYCODE_V 0x2F +#define KEYCODE_B 0x30 +#define KEYCODE_N 0x31 +#define KEYCODE_M 0x32 +#define KEYCODE_COMMA 0x33 +#define KEYCODE_DOT 0x34 +#define KEYCODE_FORWARD_SLASH 0x35 +#define KEYCODE_RIGHT_SHIFT 0x36 +#define KEYCODE_PRINT_SCREEN 0x37 +#define KEYCODE_LEFT_ALT 0x38 +#define KEYCODE_SPACE 0x39 +#define KEYCODE_CAPS_LOCK 0x3A +#define KEYCODE_F1 0x3B +#define KEYCODE_F2 0x3C +#define KEYCODE_F3 0x3D +#define KEYCODE_F4 0x3E +#define KEYCODE_F5 0x3F +#define KEYCODE_F6 0x40 +#define KEYCODE_F7 0x41 +#define KEYCODE_F8 0x42 +#define KEYCODE_F9 0x43 +#define KEYCODE_F10 0x44 +#define KEYCODE_NUM_LOCK 0x45 +#define KEYCODE_SCROLL_LOCK 0x46 +#define KEYCODE_HOME 0x47 +#define KEYCODE_UP 0x48 +#define KEYCODE_PAGE_UP 0x49 +#define KEYCODE_MINUS_PAD 0x4A +#define KEYCODE_LEFT_ARROW 0x4B +#define KEYCODE_5_PAD 0x4C +#define KEYCODE_RIGHT_ARROW 0x4D +#define KEYCODE_PLUS_PAD 0x4E +#define KEYCODE_END 0x4F +#define KEYCODE_DOWN_ARROW 0x50 +#define KEYCODE_PAGE_DOWN 0x51 +#define KEYCODE_INSERT 0x52 +#define KEYCODE_DELETE 0x53 +#define KEYCODE_LEFT_CTRL_BREAK 0x57 +#define KEYCODE_PAUSE 0x5F +#define KEYCODE_RIGHT 0x62 +#define KEYCODE_DOWN 0x64 +#define KEYCODE_F11 0x66 +#define KEYCODE_F12 0x67 +#define KEYCODE_LED_NUM_LOCK 0x69 +#define KEYCODE_LED_CAPS_LOCK 0x6A +#define KEYCODE_LED_SCROLL_LOCK 0x6B +#define KEYCODE_EXTENDED 0xE0 static uint8_t keyboard_buffer[KEYBOARD_BUFFER_SIZE]; static size_t keyboard_buffer_head = 0; @@ -21,21 +114,57 @@ static size_t keyboard_buffer_tail = 0; void set_interrupt_vector(uint8_t vector, void (*handler)()); void enable_interrupt(uint8_t vector); +void keyboard_init(); +bool keyboard_buffer_empty(); +uint8_t keyboard_read_scancode(); +uint8_t translate_scancode_to_keycode(uint8_t scancode); bool keyboard_buffer_full() { return (keyboard_buffer_head + 1) % KEYBOARD_BUFFER_SIZE == keyboard_buffer_tail; } + void KeyboardInterruptHandler() { - if (!keyboard_buffer_full()) - {uint8_t scancode = inb(KEYBOARD_DATA_PORT); - uint8_t keycode = translate_scancode_to_keycode(scancode); + if (!keyboard_buffer_full()) + { + uint8_t scancode = inb(KEYBOARD_DATA_PORT); + uint8_t keycode = translate_scancode_to_keycode(scancode); - // Add scancode to buffer - keyboard_buffer[keyboard_buffer_head] = scancode; - keyboard_buffer_head = (keyboard_buffer_head + 1) % KEYBOARD_BUFFER_SIZE; - } + // Use the keycode for further processing + process_keycode(keycode); + + // Or log the keycode for debugging + log_keycode(keycode); + + // Add scancode to buffer + keyboard_buffer[keyboard_buffer_head] = scancode; + keyboard_buffer_head = (keyboard_buffer_head + 1) % KEYBOARD_BUFFER_SIZE; + } +} + +void process_keycode(uint8_t keycode) +{ + // Add your keycode processing logic here + // For example, you could update the system state based on specific key presses + switch(keycode) + { + case KEYCODE_ESC: + // Handle ESC key press + break; + case KEYCODE_ENTER: + // Handle ENTER key press + break; + // Add more cases as needed + } +} + +// Example function to log the keycode +void log_keycode(uint8_t keycode) +{ + // Add your logging logic here + // For example, you could print the keycode to a debug console or write it to a log file + printf("Keycode pressed: 0x%02X\n", keycode); } // Function to translate the combined extended scancode (first byte + second byte) @@ -55,7 +184,7 @@ uint8_t translate_extended_scancode(uint8_t second_scancode) uint8_t translate_scancode_to_keycode(uint8_t scancode) { - static uint8_t keycode_map[128] = { + static uint8_t keycode_map[256] = { [0x01] = KEYCODE_ESC, [0x02] = KEYCODE_1, [0x03] = KEYCODE_2, @@ -121,7 +250,6 @@ uint8_t translate_scancode_to_keycode(uint8_t scancode) [0x3F] = KEYCODE_F5, [0x40] = KEYCODE_F6, [0x41] = KEYCODE_F7, - [0x41] = KEYCODE_F7, [0x42] = KEYCODE_F8, [0x43] = KEYCODE_F9, [0x44] = KEYCODE_F10, @@ -163,7 +291,7 @@ uint8_t translate_scancode_to_keycode(uint8_t scancode) [0x68] = KEYCODE_UNKNOWN, // (unused) [0x69] = KEYCODE_LED_NUM_LOCK, // Num Lock LED status [0x6A] = KEYCODE_LED_CAPS_LOCK, // Caps Lock LED status - [0x6B] = KEYCODE_LED_SCROLL_LOCK + [0x6B] = KEYCODE_LED_SCROLL_LOCK, // ... (complete the rest based on the scancode table) [0xE0] = 0, // Handle extended scancodes (e.g., Print Screen) separately }; diff --git a/src/drivers/keyboard/keyboard.h b/src/drivers/keyboard/keyboard.h index 9ee8c2b..7fb6f60 100644 --- a/src/drivers/keyboard/keyboard.h +++ b/src/drivers/keyboard/keyboard.h @@ -14,4 +14,7 @@ void set_interrupt_vector(uint8_t vector, void (*handler)()); void enable_interrupt(uint8_t vector); uint8_t translate_scancode_to_keycode(uint8_t scancode); uint8_t translate_extended_scancode(uint8_t second_scancode); +void process_keycode(uint8_t keycode); +void log_keycode(uint8_t keycode); + #endif diff --git a/src/drivers/mouse/mouse.c b/src/drivers/mouse/mouse.c index d4213dd..93dcd0a 100644 --- a/src/drivers/mouse/mouse.c +++ b/src/drivers/mouse/mouse.c @@ -1,86 +1,74 @@ -#include "mouse.h" -#include "ps2.h" -#include "serial.h" -#include "usb.h" - -#include -#include - -#define MOUSE_COM 1 - -void init_mouse(uint16_t com) -{ - if (usb_mouse_detected()) - { - init_usb(); - } - else if (ps2_mouse_detected()) - { - init_ps2(); - } - else - { - init_serial(com); - } -} - -int mouse_received(uint16_t com) -{ - if (usb_mouse_detected()) - { - return usb_mouse_received(); - } - else if (ps2_mouse_detected()) - { - return ps2_mouse_received(); - } - else - { - return serial_received(com); - } -} - -mouse_data_t read_mouse(uint16_t com) -{ - mouse_data_t data; - - if (usb_mouse_detected()) - { - data = usb_read_mouse(); - } - else if (ps2_mouse_detected()) - { - data = ps2_read_mouse(); - } - else - { - data.x = 0; - data.y = 0; - data.buttons = 0; - - while (mouse_received(com) == 0) - ; - - uint8_t status = inb(PORT_BASE + 8 * (com - 1) + 5); - - if (status & 0x01) - { - data.buttons |= 0x01; - } - - if (status & 0x02) - { - data.buttons |= 0x02; - } - - if (status & 0x04) - { - data.buttons |= 0x04; - } - - data.x = inb(PORT_BASE + 8 * (com - 1)); - data.y = inb(PORT_BASE + 8 * (com - 1) + 1); - } - - return data; -} \ No newline at end of file +#include "mouse.h" +#include "ps2.h" +#include "../io/serial.h" +#include "usb.h" +#include "../io/io.h" + +#include +#include + +#define MOUSE_COM 1 +#define PORT_BASE 0x3F8 // Add this if it's not defined elsewhere + +void init_mouse(uint16_t com) +{ + if (usb_mouse_detected()) + { + init_usb(); + } + else if (ps2_mouse_detected()) + { + init_ps2(); + } + else + { + init_serial(com); + } +} + +int mouse_received(uint16_t com) +{ + if (usb_mouse_detected()) + { + return usb_mouse_received(); + } + else if (ps2_mouse_detected()) + { + return ps2_mouse_received(); + } + else + { + return serial_received(com); + } +} + +mouse_data_t read_mouse(uint16_t com) +{ + mouse_data_t data = {0}; // Initialize to zero + + if (usb_mouse_detected()) + { + data = usb_read_mouse(); + } + else if (ps2_mouse_detected()) + { + data = ps2_read_mouse(); + } + else + { + while (mouse_received(com) == 0) + ; + + uint8_t status = inb(PORT_BASE + 8 * (com - 1) + 5); + + data.buttons = 0; + if (status & 0x01) data.buttons |= 0x01; + if (status & 0x02) data.buttons |= 0x02; + if (status & 0x04) data.buttons |= 0x04; + + data.x = (int16_t)inb(PORT_BASE + 8 * (com - 1)); + data.y = (int16_t)inb(PORT_BASE + 8 * (com - 1) + 1); + } + + return data; +} diff --git a/src/drivers/mouse/mouse.h b/src/drivers/mouse/mouse.h index 08d9e9b..cc39a63 100644 --- a/src/drivers/mouse/mouse.h +++ b/src/drivers/mouse/mouse.h @@ -1,16 +1,17 @@ -#ifndef MOUSE_H -#define MOUSE_H - -#include - -typedef struct { - int16_t x; - int16_t y; - uint8_t buttons; -} mouse_data_t; - -void init_mouse(uint16_t com); -int mouse_received(uint16_t com); -mouse_data_t read_mouse(uint16_t com); - -#endif +#ifndef MOUSE_H +#define MOUSE_H + +#include + +typedef struct { + int16_t x; + int16_t y; + uint8_t buttons; +} mouse_data_t; + + +void init_mouse(uint16_t com); +int mouse_received(uint16_t com); +mouse_data_t read_mouse(uint16_t com); + +#endif diff --git a/src/drivers/mouse/ps2.h b/src/drivers/mouse/ps2.h new file mode 100644 index 0000000..29133f0 --- /dev/null +++ b/src/drivers/mouse/ps2.h @@ -0,0 +1,36 @@ +#ifndef PS2_H +#define PS2_H + +#include +#include + +// PS/2 Controller Ports +#define PS2_DATA_PORT 0x60 +#define PS2_STATUS_PORT 0x64 +#define PS2_COMMAND_PORT 0x64 + +// PS/2 Controller Commands +#define PS2_CMD_READ_CONFIG 0x20 +#define PS2_CMD_WRITE_CONFIG 0x60 +#define PS2_CMD_DISABLE_PORT2 0xA7 +#define PS2_CMD_ENABLE_PORT2 0xA8 +#define PS2_CMD_TEST_PORT2 0xA9 +#define PS2_CMD_TEST_CONTROLLER 0xAA +#define PS2_CMD_TEST_PORT1 0xAB +#define PS2_CMD_DISABLE_PORT1 0xAD +#define PS2_CMD_ENABLE_PORT1 0xAE + +// Function prototypes +bool ps2_init(void); +uint8_t ps2_read_data(void); +void ps2_write_data(uint8_t data); +uint8_t ps2_read_status(void); +void ps2_write_command(uint8_t command); +bool ps2_wait_for_read(void); +bool ps2_wait_for_write(void); + +// PS/2 device specific functions +bool ps2_keyboard_init(void); +bool ps2_mouse_init(void); + +#endif // PS2_H diff --git a/src/drivers/mouse/usb.h b/src/drivers/mouse/usb.h new file mode 100644 index 0000000..e7f6158 --- /dev/null +++ b/src/drivers/mouse/usb.h @@ -0,0 +1,48 @@ +#ifndef USB_H +#define USB_H + +#include +#include +#include "./mouse.h" + +// USB Version definitions +#define USB_VERSION_1_0 0x100 +#define USB_VERSION_1_1 0x110 +#define USB_VERSION_2_0 0x200 +#define USB_VERSION_2_1 0x210 + +// USB device classes +#define USB_CLASS_HID 0x03 + +// HID subclasses +#define USB_SUBCLASS_BOOT 0x01 + +// HID protocols +#define USB_PROTOCOL_KEYBOARD 0x01 +#define USB_PROTOCOL_MOUSE 0x02 + +// Function prototypes +mouse_data_t usb_read_mouse(void); +bool usb_mouse_detected(void); +bool usb_mouse_received(void); +bool usb_init(void); +bool usb_detect_version(uint16_t *version); +bool usb_enumerate_devices(void); + +// HID device specific functions +bool usb_hid_init(void); +bool usb_keyboard_init(void); +bool usb_mouse_init(void); + +// USB transfer functions +bool usb_control_transfer(/* parameters */); +bool usb_interrupt_transfer(/* parameters */); +bool usb_bulk_transfer(/* parameters */); + +// USB host controller interface functions +bool uhci_init(void); // USB 1.x +bool ohci_init(void); // USB 1.x +bool ehci_init(void); // USB 2.0 +bool xhci_init(void); // USB 3.0+ (for future use) + +#endif // USB_H diff --git a/src/filesystem/fat16/fat16.c b/src/filesystem/fat16/fat16.c index a926264..fda260d 100644 --- a/src/filesystem/fat16/fat16.c +++ b/src/filesystem/fat16/fat16.c @@ -1,7 +1,7 @@ #include "fat16.h" #include #include "fat16_io.h" -#include "src/kernel/arch/x86/disk/ata.h" +#include "../../kernel/arch/x86/disk/ata.h" // Implementation of read_sector and write_sector functions (replace with actual disk I/O) int read_sector(uint32_t sector_number, void *buffer) { diff --git a/src/filesystem/fat16/fat16.h b/src/filesystem/fat16/fat16.h index 9ad3441..2b63831 100644 --- a/src/filesystem/fat16/fat16.h +++ b/src/filesystem/fat16/fat16.h @@ -3,7 +3,7 @@ #include -#include "../../ata.h" +#include "../../kernel/arch/x86/disk/ata.h" // Define constants for sector size, cluster size, etc. (replace with actual values) #define SECTOR_SIZE 512 diff --git a/src/filesystem/fat16/fat16_io.c b/src/filesystem/fat16/fat16_io.c index 6f768e6..49bea67 100644 --- a/src/filesystem/fat16/fat16_io.c +++ b/src/filesystem/fat16/fat16_io.c @@ -1,6 +1,6 @@ #include "fat16_io.h" #include -#include "src/kernel/arch/x86/disk/ata.h" +#include "../../kernel/arch/x86/disk/ata.h" #include "fat16.h" // I/O port addresses for IDE controller (replace with actual values if needed) #define PRIMARY_DATA_REGISTER 0x1F0 diff --git a/src/filesystem/fat16/fat16_io.h b/src/filesystem/fat16/fat16_io.h index 390f0d2..ada20dc 100644 --- a/src/filesystem/fat16/fat16_io.h +++ b/src/filesystem/fat16/fat16_io.h @@ -3,7 +3,7 @@ #include #include "fat16.h" -#include "src/kernel/arch/x86/disk/ata.h" +#include "../../kernel/arch/x86/disk/ata.h" // I/O port addresses for IDE controller (replace with actual values if needed) #define PRIMARY_DATA_REGISTER 0x1F0 diff --git a/src/gui/README.md b/src/gui/README.md new file mode 100644 index 0000000..eac1dca --- /dev/null +++ b/src/gui/README.md @@ -0,0 +1,41 @@ +# GUI + +Use QEMU for emulation during development + +Implement efficient memory allocation for GUI elements. +Develop drivers and event systems for keyboard and mouse input handling +Choose between bitmap fonts or implement a basic vector font renderer. +Decide on a compositing strategy for overlapping windows. +Implement blitting and compositing in optimized assembly. + +Implement performance-critical routines in assembly. + +Implement a simple compositing system. Use a z-order list to manage window stacking and redraw only changed areas for efficiency. + +the development environment will be in + +debian 10 buster with kernel Linux gregbowne 4.19.0-16-amd64 #1 SMP Debian 4.19.181-1 (2021-03-19) x86_64 GNU/Linux and gnu 8.3.0 and yes using gcc and nasm +on vscode + +Implement basic clipping to improve rendering performance. + +Implement double buffering to reduce screen flicker. + +Start with simple widgets like buttons and text fields. +Gradually add more complex elements like scrollbars and menus. + +Optimize critical paths using inline assembly or full assembly routines. +Implement double buffering to reduce screen flicker. +Use a simple event system for GUI interactions. + +Implement modes: +VGA/SVGA Mode + +Use VGA mode 13h (320x200, 256 colors) for maximum compatibility. +Implement VESA VBE support for higher resolutions on capable hardware. + +Framebuffer + +Set up a linear framebuffer in protected mode for more flexible graphics. + +Use SIMD operations. diff --git a/src/gui/custom_vga.asm b/src/gui/custom_vga.asm new file mode 100644 index 0000000..3fbddd2 --- /dev/null +++ b/src/gui/custom_vga.asm @@ -0,0 +1,10 @@ +section .text +global set_custom_video_mode + +set_custom_video_mode: + mov eax, 0x4F01 + mov cx, %1 + mov dx, 0x000A0000 + mov bx, 0x8000 + int 0x10 + ret \ No newline at end of file diff --git a/src/gui/gui.c b/src/gui/gui.c index 093410f..616659d 100644 --- a/src/gui/gui.c +++ b/src/gui/gui.c @@ -1,3 +1,238 @@ -/* -gui goes here -*/ \ No newline at end of file +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Custom OS-specific structures +typedef struct +{ + int x, y; + int width, height; + uint32_t color; + void *address; // Address of the frame buffer + int pitch; // Pitch of the frame buffer +} Window; + +// Event structure +typedef enum +{ + EVENT_KEY_PRESS, + EVENT_MOUSE_MOVE, + // Add more events as needed +} EventType; + +typedef struct +{ + EventType type; + union + { + struct + { + int key_code; + } key_press; + struct + { + int x, y; + } mouse_move; + // Add more event types as needed + }; +} Event; + +// Function prototypes +void init_gui(void); +void render_framebuffer(void *fb); +void handle_events(void); +Window *create_window(int x, int y, int width, int height, uint32_t color); +void destroy_window(Window *win); +void update_window(Window *win); +void draw_text(const char *text, int x, int y, uint32_t color); +void draw_button(const char *label, int x, int y, int width, int height, uint32_t color); +void handle_event(Event *ev); + +// Global variables +void *framebuffer = NULL; +int fb_pitch = 0; +int fb_fd = -1; + +// Custom OS-specific functions +void init_video_mode(void); +void get_framebuffer_info(void); +void set_custom_video_mode(void); + +// Helper functions +void print_error(const char *message); +void check_mmap_result(void *ptr, const char *filename); +void check_open_result(int fd, const char *filename); +void check_ioctl_result(int result, const char *func_name); + +// Function implementations + +void init_gui(void) +{ + // Set up graphics mode + init_video_mode(); + + // Get framebuffer info + get_framebuffer_info(); + + // Open framebuffer device + fb_fd = open("/dev/fb0", O_RDWR); + if (fb_fd == -1) + { + check_open_result(fb_fd, "/dev/fb0"); + } + + // Map framebuffer to user space + framebuffer = mmap(NULL, finfo.smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fb_fd, 0); + if (framebuffer == MAP_FAILED) + { + check_mmap_result(framebuffer, "/dev/fb0"); + } + + printf("GUI initialized\n"); +} + +void render_framebuffer(void *fb) +{ + // Implement rendering logic here + // This will depend on how your custom system handles graphics +} + +void handle_events(void) +{ + // Implement event handling logic here + // This will depend on how your custom system handles input events +} + +Window *create_window(int x, int y, int width, int height, uint32_t color) +{ + Window *win = malloc(sizeof(Window)); + win->x = x; + win->y = y; + win->width = width; + win->height = height; + win->color = color; + win->address = framebuffer; + win->pitch = fb_pitch; + return win; +} + +void destroy_window(Window *win) +{ + free(win); +} + +void update_window(Window *win) +{ + // Implement window updating logic here + printf("Updating window %p\n", win); +} + +void draw_text(const char *text, int x, int y, uint32_t color) +{ + // Implement text drawing logic here + printf("Drawing text at (%d,%d): %s\n", x, y, text); +} + +void draw_button(const char *label, int x, int y, int width, int height, uint32_t color) +{ + // Implement button drawing logic here + printf("Drawing button at (%d,%d): %s\n", x, y, label); +} + +void handle_event(Event *ev) +{ + // Implement event handling logic here + printf("Handling event of type %d\n", ev->type); +} + +// Assembly code for custom graphics mode setup +static void __attribute__((naked)) set_custom_video_mode(void) +{ + // Implement platform-specific video mode setting + // This will depend on your custom system architecture +} + +// Helper functions + +void print_error(const char *message) +{ + fprintf(stderr, "%s\n", message); + exit(1); +} + +void check_mmap_result(void *ptr, const char *filename) +{ + if (ptr == MAP_FAILED) + { + print_error("Failed to map memory for file: "); + print_error(filename); + } +} + +void check_open_result(int fd, const char *filename) +{ + if (fd == -1) + { + print_error("Failed to open file: "); + print_error(filename); + } +} + +void check_ioctl_result(int result, const char *func_name) +{ + if (result != 0) + { + print_error("Failed to execute ioctl call: "); + print_error(func_name); + } +} + +// Custom OS-specific functions + +void init_video_mode(void) +{ + set_custom_video_mode(); +} + +void get_framebuffer_info(void) +{ + // Implement platform-specific framebuffer info retrieval + // This will depend on your custom system architecture +} + +void set_custom_video_mode(void) +{ + // Implement platform-specific video mode setting + // This will depend on your custom system architecture +} + +// Example usage +int main() +{ + init_gui(); + + // Create a window + Window *win = create_window(50, 50, 100, 100, 0xFF0000); + + // Draw something + draw_text("Hello, World!", 60, 60); + + // Handle events + handle_events(); + + // Keep the program running + while (1) + { + usleep(10000); // Sleep for 10ms + } + + return 0; +} diff --git a/src/gui/gui.h b/src/gui/gui.h index 1b9d700..c5d453f 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1,4 +1,70 @@ -/* -gui goes here +#ifndef GUI_H +#define GUI_H -*/ \ No newline at end of file +#include +#include +#include +#include +#include +#include +#include + +// Forward declarations +struct Window; +enum EventType; + +#define VGA_MODE 0x800x600 +#define VGA_WIDTH 640 +#define VGA_HEIGHT 480 +#define VGA_BPP 32 + +// Event structure +typedef struct { + enum EventType type; + union { + struct { + int key_code; + } key_press; + struct { + int x, y; + } mouse_move; + // Add more event types as needed + }; +} Event; + +// Function prototypes +void init_gui(void); +void render_framebuffer(void* fb); +void handle_events(void); +struct Window* create_window(int x, int y, int width, int height, uint32_t color); +void destroy_window(struct Window* win); +void update_window(struct Window* win); +void draw_text(const char* text, int x, int y); +void draw_button(const char* label, int x, int y, uint32_t color); +void handle_event(Event* ev); + +// Global variables +extern void* framebuffer; +extern int fb_pitch; +extern int fb_fd; + +// Custom OS-specific functions +void init_video_mode(void); +void get_framebuffer_info(void); +void set_custom_video_mode(void); +// Helper functions +void print_error(const char* message); +void check_mmap_result(void* ptr, const char* filename); +void check_open_result(int fd, const char* filename); +void check_ioctl_result(int result, const char* func_name); + +// Custom OS-specific structures +typedef struct { + int x, y; + int width, height; + uint32_t color; + void* address; // Address of the frame buffer + int pitch; // Pitch of the frame buffer +} Window; + +#endif // GUI_H diff --git a/src/gui/main.c b/src/gui/main.c new file mode 100644 index 0000000..8d1db8f --- /dev/null +++ b/src/gui/main.c @@ -0,0 +1,21 @@ +#include "gui.h" + +int main() { + init_gui(); + + // Create a window + Window* win = create_window(50, 50, 100, 100, 0xFF0000); + + // Draw something + draw_text("Hello, World!", 60, 60, 0xFFFFFF); + + // Handle events + handle_events(); + + // Keep the program running + while (1) { + usleep(10000); // Sleep for 10ms + } + + return 0; +} \ No newline at end of file diff --git a/src/kernel/acpi.c b/src/kernel/acpi.c index 9512aea..f7a8580 100644 --- a/src/kernel/acpi.c +++ b/src/kernel/acpi.c @@ -1,6 +1,8 @@ #include "acpi.h" #include #include +#include +#include // Function prototypes (implementations below) acpi_fadt_t *acpi_find_fadt(); @@ -13,7 +15,7 @@ acpi_fadt_t *acpi_find_fadt() { // Read the RSDP (Root System Description Pointer) signature and checksum // at the ACPI base address. acpi_fadt_t *rsdp = (acpi_fadt_t *)ACPI_BASE; - if (rsdp->signature != *(uint32_t *)"RSDT" && rsdp->signature != *(uint32_t *)"XSDT") { + if (memcmp(&rsdp->signature, "RSDT", 4) != 0 && memcmp(&rsdp->signature, "XSDT", 4) != 0) { return NULL; // Not a valid ACPI signature } if (rsdp->checksum != 0) { diff --git a/src/kernel/acpi.h b/src/kernel/acpi.h index 38d4ac7..572b8ee 100644 --- a/src/kernel/acpi.h +++ b/src/kernel/acpi.h @@ -3,6 +3,10 @@ #include +#ifndef NULL +#define NULL ((void*)0) +#endif + // ACPI base address (replace with actual value) #define ACPI_BASE 0xE0000000 diff --git a/src/kernel/arch/x86/gdt.asm b/src/kernel/arch/x86/gdt.asm index 688f1ed..4cd8bc9 100644 --- a/src/kernel/arch/x86/gdt.asm +++ b/src/kernel/arch/x86/gdt.asm @@ -2,5 +2,18 @@ global LoadGDT section .text LoadGDT: - LGDT [ESP + 32] - RET \ No newline at end of file + /* LGDT [ESP + 32] + RET + */ + mov eax, [esp+4] ; Get the pointer to the GDT pointer structure + lgdt [eax] ; Load the GDT + mov ax, 0x10 ; Set the kernel data segment selector + mov ds, ax + mov es, ax + mov fs, ax + mov gs, ax + mov ss, ax ; Set the kernel stack segment selector + jmp 0x08:.flush ; Flush the instruction cache + + .flush: + ret \ No newline at end of file diff --git a/src/kernel/arch/x86/gdt.c b/src/kernel/arch/x86/gdt.c index b705d8e..9ee02b0 100644 --- a/src/kernel/arch/x86/gdt.c +++ b/src/kernel/arch/x86/gdt.c @@ -10,11 +10,11 @@ #include #include -#define BYTE_MASK 0xFF -#define PAGE_FAULT 14 +#define BYTE_MASK 0xFF +#define PAGE_FAULT 14 #define DOUBLE_FAULT 8 -#define SYSTEM_CALL 80 -#define TIMER 20 +#define SYSTEM_CALL 80 +#define TIMER 20 #define ISR_TABLE_SIZE 256 @@ -24,65 +24,66 @@ struct gdt_entry gdt_entries[3] __attribute__((aligned(0x1000))); // GDT constants enum GDT_ACCESS { - GDT_ACCESS_PRESENT = 0x80 + GDT_ACCESS_PRESENT = 0x80 }; // GDT base and limit constants enum GDT_BASE_LIMIT { - GDT_BASE_MIDDLE_SHIFT = 16, - GDT_BASE_HIGH_SHIFT = 24, - GDT_GRANULARITY_SHIFT = 16, - GDT_GRANULARITY_MASK = 0x0F, - GDT_ACCESS_MASK = 0xF0, - GDT_LIMIT_MASK = 0xFFFF + GDT_BASE_MIDDLE_SHIFT = 16, + GDT_BASE_HIGH_SHIFT = 24, + GDT_GRANULARITY_SHIFT = 16, + GDT_GRANULARITY_MASK = 0x0F, + GDT_ACCESS_MASK = 0xF0, + GDT_LIMIT_MASK = 0xFFFF }; -extern void LoadGDT(struct gdt_ptr* gdt); - // Initialize a GDT entry void gdt_set_gate(uint32_t num, uint32_t base, uint32_t limit, uint8_t access, - uint8_t gran, struct gdt_entry *const gdt) + uint8_t gran, struct gdt_entry *const gdt) { - gdt[num].base_low = (base & GDT_LIMIT_MASK); - gdt[num].base_middle = (base >> GDT_BASE_MIDDLE_SHIFT) & BYTE_MASK; - gdt[num].base_high = (base >> GDT_BASE_HIGH_SHIFT) & BYTE_MASK; - gdt[num].limit_low = (limit & GDT_LIMIT_MASK); - gdt[num].granularity = - (limit >> GDT_GRANULARITY_SHIFT) & GDT_GRANULARITY_MASK; - gdt[num].granularity |= gran & GDT_ACCESS_MASK; - gdt[num].access = access; + gdt[num].base_low = (base & GDT_LIMIT_MASK); + gdt[num].base_middle = (base >> GDT_BASE_MIDDLE_SHIFT) & BYTE_MASK; + gdt[num].base_high = (base >> GDT_BASE_HIGH_SHIFT) & BYTE_MASK; + gdt[num].limit_low = (limit & GDT_LIMIT_MASK); + gdt[num].granularity = + (limit >> GDT_GRANULARITY_SHIFT) & GDT_GRANULARITY_MASK; + gdt[num].granularity |= gran & GDT_ACCESS_MASK; + gdt[num].access = access; } -void gdt_init() +extern bool gdt_init(void) { - // Set up GDT pointer - struct gdt_ptr gp; - gp.limit = (sizeof(struct gdt_entry) * 3) - 1; - //gdt = (struct gdt_entry *)malloc(sizeof(struct gdt_entry) * 3); - //memset(gdt, 0, sizeof(struct gdt_entry) * 3); + // Set up GDT pointer + struct gdt_ptr gp; + gp.limit = (sizeof(struct gdt_entry) * 3) - 1; - // Initialize GDT entries - gdt_set_gate(0, 0, 0, 0, 0, &gdt_entries[0]); // Null segment - gdt_set_gate(1, 0, 0xFFFFFFFF, 0x9A, 0xCF, &gdt_entries[1]); // Code segment - gdt_set_gate(2, 0, 0xFFFFFFFF, 0x92, 0xCF, &gdt_entries[2]); // Data segment + // Initialize GDT entries + gdt_set_gate(0, 0, 0, 0, 0, &gdt_entries[0]); // Null segment + gdt_set_gate(1, 0, 0xFFFFFFFF, 0x9A, 0xCF, &gdt_entries[1]); // Code segment + gdt_set_gate(2, 0, 0xFFFFFFFF, 0x92, 0xCF, &gdt_entries[2]); // Data segment - // Load GDT - struct gdt_ptr gdtp; - gdtp.limit = gp.limit; - gdtp.base = (uintptr_t)gdt; + // Load GDT + struct gdt_ptr gdtp; + gdtp.limit = gp.limit; + gdtp.base = (uint32_t)&gdt_entries[0]; LoadGDT(&gdtp); - /* - __asm__ volatile("mov $0x10, %ax\n\t" - "mov %ax, %ds\n\t" - "mov %ax, %es\n\t" - "mov %ax, %fs\n\t" - "mov %ax, %gs\n\t" - "ljmp $0x08, $next_label\n\t" - "next_label:"); - */ + // Switch to protected mode + __asm__ volatile( + "cli\n\t" // Disable interrupts + "mov %[base], %%eax\n\t" // Move the base address of the GDT to eax + "mov %[limit], %%ebx\n\t" // Move the limit of the GDT to ebx + "shl $16, %%ebx\n\t" // Shift left 16 bits to get the full 32-bit value + "or %%eax, %%ebx\n\t" // Combine the base and limit + "mov %[address], %%ecx\n\t" // Move the address of gdtr to ecx + "mov %%ebx, (%[address])\n\t" // Store the combined value at gdtr + "lgdt (%[address])\n\t" // Load the GDT + "sti\n\t" // Enable interrupts + : + : [base] "a"(gdtp.base), [limit] "b"(gdtp.limit), [address] "c"(&gdtp) + : "%ebx", "%ecx", "%edx"); } // Exception handlers diff --git a/src/kernel/arch/x86/gdt.h b/src/kernel/arch/x86/gdt.h index d951da4..0d7e335 100644 --- a/src/kernel/arch/x86/gdt.h +++ b/src/kernel/arch/x86/gdt.h @@ -1,29 +1,30 @@ -// gdt.h -#ifndef GDT_H -#define GDT_H - -#include - -// GDT entry structure -struct gdt_entry -{ - uint16_t limit_low; // The lower 16 bits of the limit - uint16_t base_low; // The lower 16 bits of the base - uint8_t base_middle; // The next 8 bits of the base - uint8_t - access; // Access flags, determine what ring this segment can be used in - uint8_t granularity; - uint8_t base_high; // The last 8 bits of the base -} __attribute__((packed)); - -// GDT pointer structure -struct gdt_ptr -{ - uint16_t limit; // The upper 16 bits of all selector limits - uint32_t base; // The address of the first gdt_entry_t struct -} __attribute__((packed)); - -// Initialize the GDT -void gdt_init(); - -#endif \ No newline at end of file +#ifndef GDT_H +#define GDT_H + +#include +#include + +// GDT entry structure +struct gdt_entry +{ + uint16_t limit_low; // The lower 16 bits of the limit + uint16_t base_low; // The lower 16 bits of the base + uint8_t base_middle; // The next 8 bits of the base + uint8_t access; // Access flags, determine what ring this segment can be used in + uint8_t granularity; // Granularity + uint8_t base_high; // The last 8 bits of the base +} __attribute__((packed)); + +// GDT pointer structure +struct gdt_ptr +{ + uint16_t limit; // The upper 16 bits of all selector limits + uint32_t base; // The address of the first gdt_entry_t struct +} __attribute__((packed)); + +// Function prototypes +extern bool gdt_init(void); +extern bool init_gdt(void); +void LoadGDT(struct gdt_ptr *gdt); // External declaration of LoadGDT + +#endif // GDT_H diff --git a/src/kernel/arch/x86/idt.c b/src/kernel/arch/x86/idt.c index c1530ef..8cdbf12 100644 --- a/src/kernel/arch/x86/idt.c +++ b/src/kernel/arch/x86/idt.c @@ -13,20 +13,35 @@ void TimerInterruptHandler() timer_count++; } +union interrupt_handler_union { + void (*handler)(); + struct { + uint16_t low; + uint16_t high; + } parts; +}; // Initialize the IDT -void InitializeIDT() +bool InitializeIDT() { - idt[KEYBOARD_INTERRUPT].base_lo = ((uint16_t *)KeyboardInterruptHandler)[0]; - idt[KEYBOARD_INTERRUPT].sel = 0x08; - idt[KEYBOARD_INTERRUPT].always0 = 0x00; - idt[KEYBOARD_INTERRUPT].flags = 0x8E; - idt[KEYBOARD_INTERRUPT].base_hi = ((uint16_t *)KeyboardInterruptHandler)[1]; + union interrupt_handler_union keyboard_handler; + keyboard_handler.handler = KeyboardInterruptHandler; - idt[0x33].base_lo = (uint16_t)TimerInterruptHandler; - idt[0x33].sel = 0x08; - idt[0x33].always0 = 0x00; - idt[0x33].flags = 0x8E; - idt[0x33].base_hi = (uint16_t)TimerInterruptHandler >> 16; + idt[KEYBOARD_INTERRUPT].base_lo = keyboard_handler.parts.low; + idt[KEYBOARD_INTERRUPT].sel = 0x08; + idt[KEYBOARD_INTERRUPT].always0 = 0x00; + idt[KEYBOARD_INTERRUPT].flags = 0x8E; + idt[KEYBOARD_INTERRUPT].base_hi = keyboard_handler.parts.high; - LoadIDT(&idt[0]); + union interrupt_handler_union timer_handler; + timer_handler.handler = TimerInterruptHandler; + + idt[0x33].base_lo = timer_handler.parts.low; + idt[0x33].sel = 0x08; + idt[0x33].always0 = 0x00; + idt[0x33].flags = 0x8E; + idt[0x33].base_hi = timer_handler.parts.high; + + LoadIDT(&idt[0]); + + return true; // Assuming initialization always succeeds } diff --git a/src/kernel/arch/x86/idt.h b/src/kernel/arch/x86/idt.h index b114a87..799e15c 100644 --- a/src/kernel/arch/x86/idt.h +++ b/src/kernel/arch/x86/idt.h @@ -2,6 +2,7 @@ #define IDT_H #include "include/types.h" +#include #define IDT_ENTRY_SIZE 16 @@ -9,6 +10,16 @@ #error "idt_entry structure size mismatch!" #endif +struct idt_regs { + uint16_t cs; + uint16_t ip; + uint32_t flags; + uint32_t esp; + uint16_t ss; + uint16_t eip; + uint32_t cr2; +}; + // IDT entry structure struct idt_entry { @@ -22,11 +33,14 @@ struct idt_entry extern struct idt_entry idt[256]; // Initialize the IDT -void InitializeIDT(); +bool InitializeIDT(); extern void KeyboardInterruptHandler(); extern void TimerInterruptHandler(); extern void LoadIDT(struct idt_entry *entry); +void divide_error(struct idt_regs *regs); +void page_fault(struct idt_regs *regs); + #endif /* IDT_H */ diff --git a/src/kernel/arch/x86/include/memory.h b/src/kernel/arch/x86/include/memory.h index b566d2e..10c8dcc 100644 --- a/src/kernel/arch/x86/include/memory.h +++ b/src/kernel/arch/x86/include/memory.h @@ -10,4 +10,16 @@ void kfree(void *ptr); void *malloc(size_t size); // Adding malloc and free declarations void free(void *ptr); +extern char KERNEL_HEAP_START; +extern char KERNEL_HEAP_END; + +// User heap boundaries +extern char USER_HEAP_START; +extern char USER_HEAP_END; + +extern char _kernel_heap_start; // Defined by the linker script + +#define KERNEL_HEAP_START (&_kernel_heap_start) +#define KERNEL_HEAP_END (KERNEL_HEAP_START + 0x100000) // Adjust the size as needed + #endif /* MEMORY_H */ diff --git a/src/kernel/arch/x86/include/types.c b/src/kernel/arch/x86/include/types.c index b4c4336..c11995a 100644 --- a/src/kernel/arch/x86/include/types.c +++ b/src/kernel/arch/x86/include/types.c @@ -1,19 +1,21 @@ -#include "./types.h" -#include +#include "types.h" -void gdt_set_entry(gdt_entry_t *entry, uint32_t base, uint32_t limit, - uint16_t flags) -{ - entry->base = base; - entry->limit = limit; +// Utility function to set a GDT entry +void gdt_set_entry(gdt_entry_t *entry, uint32_t base, uint32_t limit, uint8_t access, uint8_t flags) { + entry->limit_low = limit & 0xFFFF; + entry->base_low = base & 0xFFFF; + entry->base_middle = (base >> 16) & 0xFF; + entry->access = access; + entry->limit_high = (limit >> 16) & 0x0F; + entry->flags = flags & 0x0F; + entry->base_high = (base >> 24) & 0xFF; +} + +// Utility function to set an IDT entry +void idt_set_entry(idt_entry_t *entry, uint32_t base, uint16_t selector, uint16_t flags) { + entry->offset_low = base & 0xFFFF; + entry->segment = selector; + entry->reserved = 0; entry->flags = flags; -} - -void idt_set_entry(idt_entry_t *entry, uint32_t base, uint16_t selector, - uint16_t flags) -{ - entry->base_low = base & 0xFFFF; - entry->base_high = (base >> 16) & 0xFFFF; - entry->selector = selector; - entry->flags = flags; + entry->offset_high = (base >> 16) & 0xFFFF; } diff --git a/src/kernel/arch/x86/include/types.h b/src/kernel/arch/x86/include/types.h index 26280d0..4912779 100644 --- a/src/kernel/arch/x86/include/types.h +++ b/src/kernel/arch/x86/include/types.h @@ -1,24 +1,34 @@ -#ifndef TYPES_H -#define TYPES_H - -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; - -typedef struct -{ - uint32_t base; - uint32_t limit; - uint16_t flags; -} gdt_entry_t; - -typedef struct -{ - uint16_t base_low; - uint16_t selector; - uint8_t zero; - uint8_t flags; - uint16_t base_high; -} __attribute__((packed)) idt_entry_t; - -#endif /* TYPES_H */ \ No newline at end of file +#ifndef TYPES_H +#define TYPES_H + +#include + +// Basic integer types +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; + +// Attribute for packed structures +#define PACKED_ATTRIBUTE __attribute__((packed)) + +// Structure for GDT entries +typedef struct { + uint16_t limit_low; // Limit lower 16 bits + uint16_t base_low; // Base address lower 16 bits + uint8_t base_middle; // Base address middle 8 bits + uint8_t access; // Access flags + uint8_t limit_high : 4; // Limit upper 4 bits + uint8_t flags : 4; // Flags (4 bits) + uint8_t base_high; // Base address upper 8 bits +} PACKED_ATTRIBUTE gdt_entry_t; + +// Structure for IDT entries +typedef struct { + uint16_t offset_low; // Offset lower 16 bits + uint16_t segment; // Segment selector + uint8_t reserved; // Reserved + uint8_t flags; // Flags + uint16_t offset_high; // Offset upper 16 bits +} PACKED_ATTRIBUTE idt_entry_t; + +#endif // TYPES_H \ No newline at end of file diff --git a/src/kernel/arch/x86/isr/exceptions.c b/src/kernel/arch/x86/isr/exceptions.c index 6bd8e84..4f7110c 100644 --- a/src/kernel/arch/x86/isr/exceptions.c +++ b/src/kernel/arch/x86/isr/exceptions.c @@ -9,8 +9,8 @@ #define PAGE_SIZE 4096 typedef struct memory_region_t { - void *start_address; - size_t size; + uintptr_t start_address; // Changed from void* to uintptr_t + size_t size; } memory_region_t; // Array of allocated memory regions (example) @@ -19,6 +19,9 @@ size_t num_allocated_regions; jmp_buf page_fault_buffer; +extern memory_region_t *allocated_regions; +extern size_t num_allocated_regions; + void DivideByZero() { // Add logic to handle Divide By Zero Exception @@ -47,17 +50,19 @@ void DoubleFault() } // Function to check if address is within allocated memory (example) -int IsAddressInRange(uint16_t address) +int IsAddressInRange(uintptr_t address) // Changed from uint16_t to uintptr_t { - for (size_t i = 0; i < num_allocated_regions; ++i) - { - if ((address >= allocated_regions[i].start_address) && - (address < (allocated_regions[i].start_address + allocated_regions[i].size))) - { - return 1; - } - } - return 0; + for (size_t i = 0; i < num_allocated_regions; ++i) + { + uintptr_t region_start = allocated_regions[i].start_address; + uintptr_t region_end = region_start + allocated_regions[i].size; + + if (address >= region_start && address < region_end) + { + return 1; + } + } + return 0; } // Placeholder for loading page from disk (replace with actual implementation) diff --git a/src/kernel/arch/x86/isr/exceptions.h b/src/kernel/arch/x86/isr/exceptions.h index 83ead4f..1fd2f80 100644 --- a/src/kernel/arch/x86/isr/exceptions.h +++ b/src/kernel/arch/x86/isr/exceptions.h @@ -1,11 +1,14 @@ #ifndef EXCEPTIONS_H #define EXCEPTIONS_H +#include +#include + void DivideByZero(); void DoubleFault(); -void PageFault(); +void PageFault(uint16_t fault_address); void GeneralProtectionFault(); diff --git a/src/kernel/arch/x86/isr/isr.c b/src/kernel/arch/x86/isr/isr.c index 7473e04..40747ed 100644 --- a/src/kernel/arch/x86/isr/isr.c +++ b/src/kernel/arch/x86/isr/isr.c @@ -1,20 +1,36 @@ #include "isr.h" +#include #include +static bool initialized = false; + +// Declaration of save_state() +void save_state(void); + +// Declaration of kernel_panic_or_recover() +void kernel_panic_or_recover(void); void isr_handler(struct isr_regs regs) { + if (!initialized) { + // Initialization logic + printf("Initializing ISR...\n"); + + // Clear all interrupt flags + clear_interrupt(DIVIDE_BY_ZERO_INTERRUPT); + clear_interrupt(DOUBLE_FAULT_INTERRUPT); + clear_interrupt(PAGE_FAULT_INTERRUPT); + clear_interrupt(GENERAL_PROTECTION_FAULT_INTERRUPT); + + initialized = true; + } + switch(regs.int_no) { case DIVIDE_BY_ZERO_INTERRUPT: // Handle Divide By Zero Interrupt + printf("Divide by zero error occurred!\n"); + save_state(); + kernel_panic_or_recover(); break; - case DOUBLE_FAULT_INTERRUPT: - // Handle Double Fault Interrupt - break; - case PAGE_FAULT_INTERRUPT: - // Handle Page Fault Interrupt - break; - case GENERAL_PROTECTION_FAULT_INTERRUPT: - // Handle General Protection Fault Interrupt - break; + // Add cases for other interrupts... default: // Handle other interrupts or implement error handling break; diff --git a/src/kernel/arch/x86/isr/isr.h b/src/kernel/arch/x86/isr/isr.h index 99fb512..dddfc68 100644 --- a/src/kernel/arch/x86/isr/isr.h +++ b/src/kernel/arch/x86/isr/isr.h @@ -2,49 +2,43 @@ #define ISR_H #include "../include/types.h" -#include enum ISR_Vector { - EXCEPTION_START = 0x00, - DIVIDE_BY_ZERO_INTERRUPT = 0x00, - DOUBLE_FAULT_INTERRUPT = 0x08, - PAGE_FAULT_INTERRUPT = 0x0E, - GENERAL_PROTECTION_FAULT_INTERRUPT = 0x0D, - EXCEPTION_END = 0x1F, - HARDWARE_START = 0x20, - TIMER_INTERRUPT = 0x20, - KEYBOARD_INTERRUPT = 0x21, - NETWORK_INTERRUPT = 0x22, - DISK_INTERRUPT = 0x23, - SERIAL_PORT_INTERRUPT = 0x24, - HARDWARE_END = 0x2F, - USER_DEFINED_START = 0x30, - SYSTEM_CALL_INTERRUPT = 0x80 + EXCEPTION_START = 0x00, + DIVIDE_BY_ZERO_INTERRUPT = 0x0, + DOUBLE_FAULT_INTERRUPT = 0x8, + PAGE_FAULT_INTERRUPT = 0xE, + GENERAL_PROTECTION_FAULT_INTERRUPT = 0xD, + EXCEPTION_END = 0x1F, + HARDWARE_START = 0x20, + TIMER_INTERRUPT = 0x20, + KEYBOARD_INTERRUPT = 0x21, + NETWORK_INTERRUPT = 0x22, + DISK_INTERRUPT = 0x23, + SERIAL_PORT_INTERRUPT = 0x24, + HARDWARE_END = 0x2F, + USER_DEFINED_START = 0x30, + SYSTEM_CALL_INTERRUPT = 0x80 }; struct isr_regs { - uint32_t gs, fs, es, ds; // Segment selectors - uint32_t edi, esi, ebp, esp; // Pushed by pusha instruction - uint32_t ebx, edx, ecx, eax; // Pushed by the interrupt handler - uint32_t int_no, - err_code; // Interrupt number and error code (if applicable) - uint32_t eip, cs, eflags, - esp_at_signal; // Pushed by the processor automatically + uint32_t gs, fs, es, ds; // Segment selectors + uint32_t edi, esi, ebp, esp; // Pushed by pusha instruction + uint32_t ebx, edx, ecx, eax; // Pushed by the interrupt handler + uint32_t int_no, err_code; // Interrupt number and error code (if applicable) + uint32_t eip, cs, eflags, esp_at_signal; // Pushed by the processor automatically }; -void isr_handler(struct isr_regs regs); -// Structure for storing register values during an ISR -struct idt_regs +void clear_interrupt(uint32_t interrupt_id) { - uint32_t ds; // Data segment selector - uint32_t edi, esi, ebp, esp, ebx, edx, ecx, - eax; // Pushed by pusha instruction - uint32_t int_no, - err_code; // Interrupt number and error code (if applicable) - uint32_t eip, cs, eflags, useresp, - ss; // Pushed by the processor automatically -}; + // Assuming interrupt_id maps to a specific bit in an interrupt control register + // For example, if DIVIDE_BY_ZERO_INTERRUPT corresponds to bit 0 in a register at address 0x12345678 + uint32_t *interrupt_control_register = (uint32_t *)0x12345678; + *interrupt_control_register &= ~(1 << interrupt_id); +} + +extern void isr_handler(struct isr_regs regs); #endif /* ISR_H */ diff --git a/src/kernel/kernel.c b/src/kernel/kernel.c index d948bbe..158a66b 100644 --- a/src/kernel/kernel.c +++ b/src/kernel/kernel.c @@ -1,93 +1,162 @@ #include "kernel.h" -#include "./arch/x86/gdt.h" -#include "../kernel/malloc/malloc.h" #include "../kernel/malloc/kmalloc.h" +#include "../kernel/malloc/malloc.h" +#include "./arch/x86/gdt.h" +#include "./arch/x86/idt.h" #include "./arch/x86/include/memory.h" #include #include #include +#include #include -#define VGA_ADDRESS 0xB8000 -#define VGA_WIDTH 80 -#define VGA_HEIGHT 25 -#define VGA_COLOR_BLACK 0x0 -#define VGA_COLOR_WHITE 0xF +// Debug levels +typedef enum +{ + DEBUG_BASIC = 1, + DEBUG_DETAILED = 2 +} debug_level_t; -uint16_t* const VGA_MEMORY = (uint16_t*) VGA_ADDRESS; +// Error codes +typedef enum +{ + ERR_GDT_INIT = 1, + ERR_IDT_INIT, + ERR_KERNEL_HEAP_INIT, + ERR_USER_HEAP_INIT +} error_code_t; -void clear_screen() { - for (int i = 0; i < VGA_WIDTH * VGA_HEIGHT; i++) { - VGA_MEMORY[i] = ((uint16_t)VGA_COLOR_BLACK << 8) | ' '; +#define USER_HEAP_START ((uintptr_t)0x10000000) // Example address +#define USER_HEAP_END ((uintptr_t)0x20000000) // Example address + +// Function prototypes +static void log_message(const char *message, debug_level_t level); +bool init_gdt(); + +bool initialize_idt(void); +int init_kernel_heap(void *start, void *end); +int init_user_heap(void *start, void *end); +static void kernel_panic(const char *message, int error_code); +extern bool (*gdt_init_ptr)(void) = (bool (*)(void))gdt_init; + +debug_level_t DEBUG_LEVEL = DEBUG_BASIC; + +static void log_message(const char *message, debug_level_t level) +{ + if (level <= DEBUG_LEVEL) + { + printf("[LOG] %s\n", message); + } +} + +extern bool gdt_init(void) +{ + log_message("Initializing GDT...", 1); + if (!init_gdt()) + { + log_message("Failed to initialize GDT!", 2); + return false; + } + log_message("GDT initialized successfully.", 1); + return true; +} + +bool init_gdt() +{ + // Implementation of init_gdt() + // This is just a placeholder, you'll need to implement the actual GDT initialization logic + return true; +} + +bool initialize_idt(void) +{ + // Implement your IDT initialization logic here + // This is just a placeholder implementation + log_message("Initializing IDT...", DEBUG_DETAILED); + + // Your IDT initialization code goes here + // For example: + // - Set up IDT entries + // - Load the IDT using lidt instruction + + // For now, let's assume it always succeeds + return true; +} + +bool InitializeIDT() +{ + log_message("Initializing IDT...", 1); + if (!initialize_idt()) + { + log_message("Failed to initialize IDT!", 2); + return false; } + log_message("IDT initialized successfully.", 1); + return true; } -void print(const char* message) { - static int row = 0; - static int col = 0; - for (size_t i = 0; message[i] != '\0'; i++) { - if (col >= VGA_WIDTH || message[i] == '\n') { - row++; - col = 0; - } - if (row >= VGA_HEIGHT) { - clear_screen(); - row = 0; - } - if (message[i] != '\n') { - VGA_MEMORY[row * VGA_WIDTH + col] = ((uint16_t)VGA_COLOR_WHITE << 8) | message[i]; - col++; - } - } +int init_kernel_heap(void *start, void *end) +{ + log_message("Initializing kernel heap...", 1); + // Implementation here + // For now, let's assume it always succeeds + log_message("Kernel heap initialized successfully.", 1); + return 0; // Return 0 for success } -void init_memory_management() { - // Placeholder for actual implementation +int init_user_heap(void *start, void *end) +{ + log_message("Initializing user heap...", 1); + // Implementation here + // For now, let's assume it always succeeds + log_message("User heap initialized successfully.", 1); + return 0; // Return 0 for success } -void init_devices() { - // Placeholder for actual implementation +static void kernel_panic(const char *message, int error_code) +{ + printf("KERNEL PANIC: %s (Error code: %d)\n", message, error_code); + // Implement any necessary error handling or system halt procedures + while (1) + { /* Halt the system */ + } } -void early_init() { - // ... other early initialization tasks - init_kernel_heap((void*)KERNEL_HEAP_START, (void*)KERNEL_HEAP_END); - // Initialize GDT - gdt_init(); -} - -void kernel_main() { - clear_screen(); - print("Welcome to ClassicOS!"); - - // Initialize memory management - init_memory_management(); - - // Initialize user-space heap (example) - void* user_heap_start = /* address of user-space heap start */; - void* user_heap_end = /* address of user-space heap end */; - init_heap(user_heap_start, user_heap_end); - - // Initialize kernel heap (example) - void* kernel_heap_start = /* address of kernel heap start */; - void* kernel_heap_end = /* address of kernel heap end */; - init_kernel_heap(kernel_heap_start, kernel_heap_end); - - // Initialize devices - init_devices(); - - // Infinite loop to keep the kernel running - while (1) { - // Handle any pending interrupts - handle_interrupts(); - - // Schedule the next process to run - schedule_next_process(); - - // Perform deferred work from interrupts or system calls - process_deferred_work(); - - // Handle system calls from user-space applications - handle_system_calls(); - } +int main() +{ + log_message("Starting kernel initialization...", 1); + + if (!gdt_init()) + { + log_message("Initialization failed - exiting.", 2); + return 1; + } + + if (!InitializeIDT()) + { + log_message("Initialization failed - exiting.", 2); + return 1; + } + + if (init_kernel_heap((void *)KERNEL_HEAP_START, (void *)KERNEL_HEAP_END) != 0) + { + log_message("Kernel heap initialization failed - exiting.", 2); + return 1; + } + + if (init_user_heap((void* )USER_HEAP_START, (void* )USER_HEAP_END) != 0) + { + log_message("User heap initialization failed - exiting.", 2); + return 1; + } + + log_message("Kernel initialization completed successfully.", 1); + + // Enter the main kernel loop or start the shell + while (1) + { + // Kernel loop or shell code + } + + return 0; } diff --git a/src/kernel/kernel.h b/src/kernel/kernel.h index db36ac8..de9019c 100644 --- a/src/kernel/kernel.h +++ b/src/kernel/kernel.h @@ -1,4 +1,9 @@ -#ifndef KERNEL_H -#define KERNEL_H - -#endif \ No newline at end of file +#ifndef KERNEL_H +#define KERNEL_H + +#include "kernel.h" + +extern void* kernel_heap_start; +extern void* kernel_heap_end; + +#endif diff --git a/src/kernel/linker.ld b/src/kernel/linker.ld index 7dcdfcd..72bca90 100644 --- a/src/kernel/linker.ld +++ b/src/kernel/linker.ld @@ -7,6 +7,13 @@ PHDRS { } SECTIONS { + + .kernelheap (0x100000) : /* Assuming kernel heap starts at 1MB */ + { + _kernel_heap_start = .; /* Define symbol at the start of the section */ + *(kernel.o) /* Include kernel object file in this section */ + } + . = 0xC0000000; /* Starting virtual address */ /* Text Section */ diff --git a/src/kernel/malloc/kmalloc.c b/src/kernel/malloc/kmalloc.c index 6fb1775..e0a2c21 100644 --- a/src/kernel/malloc/kmalloc.c +++ b/src/kernel/malloc/kmalloc.c @@ -1,4 +1,13 @@ #include "kmalloc.h" +#include + +#include +#include +#include +#include +#include + +#define HEAP_MAGIC 0x123456789ABCDEF0 static void *kernel_heap_start; // Start of the kernel heap static void *kernel_heap_end; // End of the kernel heap @@ -10,6 +19,17 @@ struct memory_block struct memory_block *next; }; +typedef struct +{ + size_t size; + bool is_free; + uint64_t magic; // For integrity checking +} block_meta_t; + +static void *heap_start; +static void *heap_end; +static block_meta_t *free_list; + void mark_as_used_kernel(void *ptr, size_t size) { // Since we're using a linked list, there's no specific action needed @@ -34,17 +54,96 @@ void mark_as_free_kernel(void *ptr) free_blocks = block; } -void init_kernel_heap(void *start, void *end) +int init_kernel_heap(void *start, void *end) { - kernel_heap_start = start; - kernel_heap_end = end; + if (start >= end) + { + return -1; // Invalid range + } - free_blocks = (struct memory_block *)start; - free_blocks->size = (size_t)(end - start); - free_blocks->next = NULL; + heap_start = start; + heap_end = end; + size_t total_size = (char *)end - (char *)start; - // You'll need to replace this placeholder with logic to split the - // initial block into smaller ones based on your requirements. + if (total_size < sizeof(block_meta_t)) + { + return -2; // Heap too small + } + + // Initialize the first block + block_meta_t *first_block = (block_meta_t *)start; + first_block->size = total_size - sizeof(block_meta_t); + first_block->is_free = true; + first_block->magic = HEAP_MAGIC; + + // Initialize the free list with the first block + free_list = first_block; + + return 0; // Success +} + +void *kmalloc(size_t size) +{ + block_meta_t *current = free_list; + + while (current) { + if (current->magic != HEAP_MAGIC) { + // Heap corruption detected + return NULL; + } + + if (current->is_free && current->size >= size) { + // Found a suitable block + if (current->size > size + sizeof(block_meta_t)) { + // Split the block + block_meta_t *new_block = (block_meta_t*)((char*)current + sizeof(block_meta_t) + size); + new_block->size = current->size - size - sizeof(block_meta_t); + new_block->is_free = true; + new_block->magic = HEAP_MAGIC; + + current->size = size; + } + + current->is_free = false; + return (void*)((char*)current + sizeof(block_meta_t)); + } + + current = (block_meta_t*)((char*)current + sizeof(block_meta_t) + current->size); + + if ((void*)current >= heap_end) { + break; // Reached end of heap + } + } + + // No suitable block found + return NULL; +} + +void kfree(void *ptr) +{ + if (!ptr) + { + return; + } + + block_meta_t *block_meta = (block_meta_t *)((char *)ptr - sizeof(block_meta_t)); + + if (block_meta->magic != HEAP_MAGIC) + { + // Invalid free or heap corruption + return; + } + + block_meta->is_free = true; + + // Coalesce with next block if it's free + block_meta_t *next_block = (block_meta_t *)((char *)block_meta + sizeof(block_meta_t) + block_meta->size); + if ((void *)next_block < heap_end && next_block->is_free) + { + block_meta->size += sizeof(block_meta_t) + next_block->size; + } + + // TODO: Implement coalescing with previous block } void *find_free_kernel_block(size_t size) @@ -63,46 +162,3 @@ void *find_free_kernel_block(size_t size) // No suitable block found return NULL; } - -void *kmalloc(size_t size) -{ - if (kernel_heap_start == NULL || kernel_heap_end == NULL) - { - // Kernel heap not initialized, cannot allocate - return NULL; - } - - // Align the size to the word size for efficiency - size += sizeof(size_t) - 1; - size &= ~(sizeof(size_t) - 1); - - // Search for a free block of sufficient size - void *block = find_free_kernel_block(size); - if (block != NULL) - { - // Mark the block as used - mark_as_used_kernel(block, size); - - // This is a placeholder for splitting the block if necessary - // You'll need to implement logic to potentially split the block - // into a used part of size 'size' and a remaining free block - // if the block size is significantly larger than 'size'. - - return block; - } - - // No suitable block found, out of memory - return NULL; -} - -void kfree(void *ptr) -{ - if (ptr == NULL) - { - return; - } - - // Mark the block as free - // This is a placeholder for the actual algorithm - mark_as_free_kernel(ptr); -} diff --git a/src/kernel/malloc/kmalloc.h b/src/kernel/malloc/kmalloc.h index b411d17..4f2a6b8 100644 --- a/src/kernel/malloc/kmalloc.h +++ b/src/kernel/malloc/kmalloc.h @@ -12,8 +12,8 @@ typedef struct { } heap_block_t; // Function prototypes -void init_kernel_heap(void* start, void* end); -void init_user_heap(void* start, void* end); +int init_kernel_heap(void* start, void* end); +int init_user_heap(void* start, void *end); void* kmalloc(size_t size); void kfree(void* ptr); diff --git a/src/kernel/malloc/malloc.c b/src/kernel/malloc/malloc.c index 92d7ac3..6b6f5ff 100644 --- a/src/kernel/malloc/malloc.c +++ b/src/kernel/malloc/malloc.c @@ -1,62 +1,97 @@ #include "malloc.h" +#include // For uintptr_t static void *heap_start; // Start of the heap -static void *heap_end; // End of the heap +static void *heap_end; // End of the heap +static struct memory_block *free_blocks; // List of free blocks void init_heap(void *start, void *end) { - heap_start = start; - heap_end = end; - // Initialize the heap here + heap_start = start; + heap_end = end; + + // Initialize the heap with a single large free block + free_blocks = (struct memory_block *)start; + free_blocks->size = (uintptr_t)end - (uintptr_t)start - sizeof(struct memory_block); + free_blocks->next = NULL; + free_blocks->is_free = 1; } void *find_free_block(size_t size) { - // Implementation is similar to find_free_kernel_block - struct memory_block *current = free_blocks; - while (current != NULL) { - if (current->size >= size) { - return current; + struct memory_block *current = free_blocks; + while (current != NULL) { + if (current->is_free && current->size >= size) { + return current; + } + current = current->next; } - current = current->next; - } + // No suitable block found + return NULL; +} - // No suitable block found - return NULL; +void mark_as_used(void *ptr, size_t size) { + struct memory_block *block = (struct memory_block *)ptr; + block->is_free = 0; + + // If the block is larger than needed, split it + if (block->size > size + sizeof(struct memory_block)) { + struct memory_block *new_block = (struct memory_block *)((uintptr_t)ptr + size + sizeof(struct memory_block)); + new_block->size = block->size - size - sizeof(struct memory_block); + new_block->next = block->next; + new_block->is_free = 1; + + block->size = size; + block->next = new_block; + } +} + +void mark_as_free(void *ptr) { + struct memory_block *block = (struct memory_block *)ptr; + block->is_free = 1; + + // Coalesce with next block if it's free + if (block->next && block->next->is_free) { + block->size += block->next->size + sizeof(struct memory_block); + block->next = block->next->next; + } + + // TODO: Implement coalescing with previous block } void *malloc(size_t size) { - if (heap_start == NULL || heap_end == NULL) - { - // Heap not initialized, cannot allocate - return NULL; - } + if (heap_start == NULL || heap_end == NULL) + { + // Heap not initialized, cannot allocate + return NULL; + } - // Align the size to the word size for efficiency - size &= ~(sizeof(size_t) - 1); + // Align the size to the word size for efficiency + size = (size + sizeof(size_t) - 1) & ~(sizeof(size_t) - 1); - // Search for a free block of sufficient size - // This is a placeholder for the actual algorithm - void *block = find_free_block(size); - if (block != NULL) - { - // Mark the block as used - mark_as_used(block, size); - return block; - } + // Search for a free block of sufficient size + void *block = find_free_block(size); + if (block != NULL) + { + // Mark the block as used + mark_as_used(block, size); + return (void *)((uintptr_t)block + sizeof(struct memory_block)); + } - // No suitable block found, out of memory - return NULL; + // No suitable block found, out of memory + return NULL; } void free(void *ptr) { - if (ptr == NULL) - { - return; - } + if (ptr == NULL) + { + return; + } - // Mark the block as free - // This is a placeholder for the actual algorithm - mark_as_free(ptr); + // Adjust pointer to the start of the memory block + struct memory_block *block = (struct memory_block *)((uintptr_t)ptr - sizeof(struct memory_block)); + + // Mark the block as free + mark_as_free(block); } diff --git a/src/kernel/malloc/malloc.h b/src/kernel/malloc/malloc.h index 728d4be..9c7344c 100644 --- a/src/kernel/malloc/malloc.h +++ b/src/kernel/malloc/malloc.h @@ -3,9 +3,25 @@ #include // For size_t +// Define the memory block structure +struct memory_block { + size_t size; + struct memory_block *next; + int is_free; +}; + +// Function prototypes +void init_heap(void *start, void *end); void *malloc(size_t size); void free(void *ptr); +// Helper function prototypes void *find_free_block(size_t size); +void mark_as_used(void *ptr, size_t size); +void mark_as_free(void *ptr); + +// External heap boundaries +extern void *user_heap_start; +extern void *user_heap_end; #endif // MALLOC_H diff --git a/src/kernel/timer.c b/src/kernel/timer.c index 5abd326..5ea6e14 100644 --- a/src/kernel/timer.c +++ b/src/kernel/timer.c @@ -3,7 +3,7 @@ // Function to send a byte to an I/O port void outb(uint16_t port, uint8_t data) { - __asm__ volatile ("outb %b, %w" : : "a" (data), "d" (port)); + __asm__ volatile ("outb %0, %1" : : "a" (data), "Nd" (port)); } // Function to initialize the timer with a desired frequency diff --git a/src/kernel/timer.h b/src/kernel/timer.h index 0146f01..b4ad886 100644 --- a/src/kernel/timer.h +++ b/src/kernel/timer.h @@ -1,10 +1,3 @@ -Here's a breakdown of how to create timer.c and timer.h compatible with the 8253 for x86 32-bit protected mode on 386/486 processors: - -1. timer.h: - -This header file will contain function prototypes, constants, and any data structures you might need for interacting with the 8253 timer. Here's an example: -C - #ifndef TIMER_H #define TIMER_H