Skip to content
This repository has been archived by the owner on Jan 23, 2025. It is now read-only.

new changes #84

Closed
wants to merge 13 commits into from
54 changes: 54 additions & 0 deletions build/17_OSGroup/cmake_install.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Install script for directory: /workspaces/2024-ikt218-osdev/src/17_OSGroup

# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")

# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "Debug")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()

# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()

# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "1")
endif()

# Is this installation the result of a crosscompile?
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "FALSE")
endif()

# Set default install directory permissions.
if(NOT DEFINED CMAKE_OBJDUMP)
set(CMAKE_OBJDUMP "/usr/local/bin/i686-elf-objdump")
endif()

if(CMAKE_INSTALL_COMPONENT)
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else()
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
endif()

string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
"${CMAKE_INSTALL_MANIFEST_FILES}")
file(WRITE "/workspaces/2024-ikt218-osdev/build/17_OSGroup/${CMAKE_INSTALL_MANIFEST}"
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
107 changes: 107 additions & 0 deletions build/17_OSGroup/compile_commands.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
[
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/libc/panic.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/libc/panic.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/libc/panic.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/libc/system.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/libc/system.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/libc/system.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/libc/string.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/libc/string.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/libc/string.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/libc/stdio.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/libc/stdio.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/libc/stdio.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/common.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/common.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/common.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/monitor.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/monitor.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/monitor.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/gdt.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/gdt.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/gdt.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/idt.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/idt.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/idt.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/irq.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/irq.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/irq.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/isr.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/isr.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/isr.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/bin/nasm -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -f elf32 -o CMakeFiles/uiaos-kernel.dir/src/isr_asm.asm.o /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/isr_asm.asm",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/isr_asm.asm"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/bin/nasm -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -f elf32 -o CMakeFiles/uiaos-kernel.dir/src/descriptor_table.asm.o /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/descriptor_table.asm",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/descriptor_table.asm"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/bin/nasm -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -f elf32 -o CMakeFiles/uiaos-kernel.dir/src/multiboot2.asm.o /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/multiboot2.asm",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/multiboot2.asm"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/kernel.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/kernel.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/kernel.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-g++ -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -g -Wno-unused-variable -Wno-unused-parameter -std=gnu++20 -o CMakeFiles/uiaos-kernel.dir/src/kernel.cpp.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/kernel.cpp",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/kernel.cpp"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/memory/malloc.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/memory/malloc.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/memory/malloc.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/memory/paging.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/memory/paging.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/memory/paging.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/memory/memutils.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/memory/memutils.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/memory/memutils.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/pit.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/pit.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/pit.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/input.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/input.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/input.c"
},
{
"directory": "/workspaces/2024-ikt218-osdev/build/17_OSGroup",
"command": "/usr/local/bin/i686-elf-gcc -I/workspaces/2024-ikt218-osdev/src/17_OSGroup/include -g -Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g -Wno-unused-variable -Wno-unused-parameter -std=gnu99 -o CMakeFiles/uiaos-kernel.dir/src/apps/song/song.c.o -c /workspaces/2024-ikt218-osdev/src/17_OSGroup/src/apps/song/song.c",
"file": "/workspaces/2024-ikt218-osdev/src/17_OSGroup/src/apps/song/song.c"
}
]
Binary file added build/17_OSGroup/disk.iso
Binary file not shown.
Binary file added build/17_OSGroup/kernel.bin
Binary file not shown.
Binary file added build/17_OSGroup/kernel.iso
Binary file not shown.
155 changes: 155 additions & 0 deletions src/17_OSGroup/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
########################################
# The University of Agder Operating System: UiAOS
# Languages: C, C++, and NASM Assembly
# Tip: Use Ctrl+Shift+P in Visual Studio Code to get started with CMake.
########################################

# Skip compiler self-tests (saves time, avoids errors with some cross compilers)
set(CMAKE_C_COMPILER_WORKS 1)
set(CMAKE_CXX_COMPILER_WORKS 1)

# Minimum required CMake version
cmake_minimum_required(VERSION 3.22.1)

# Project name and languages used
project(UiAOS LANGUAGES C CXX ASM_NASM)

# Create a lock file to prevent parallel runs of CMake
file(LOCK ${CMAKE_SOURCE_DIR} DIRECTORY GUARD FILE)

########################################
# CMake: Import Plugins
########################################
include(FetchContent)

########################################
# UiAOS: Variables
########################################
set(OS_ARCH_TARGET "i386") # x86_64
set(OS_NAME "UiA Operating System")
set(OS_KERNEL_NAME "uiaos")
set(OS_KERNEL_BINARY "kernel.bin")
set(OS_KERNEL_IMAGE "kernel.iso")

########################################
# Compiler Configuration
########################################
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 99)

########################################
# Assembly Configuration
########################################
set(CMAKE_ASM_NASM_SOURCE_FILE_EXTENSIONS "s;S;asm")
if(OS_ARCH_TARGET STREQUAL "i386")
set(CMAKE_ASM_NASM_OBJECT_FORMAT "elf32")
elseif(OS_ARCH_TARGET STREQUAL "x86_64")
set(CMAKE_ASM_NASM_OBJECT_FORMAT "elf64")
endif()

# Command to compile NASM files
set(CMAKE_ASM_NASM_COMPILE_OBJECT
"<CMAKE_ASM_NASM_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -f ${CMAKE_ASM_NASM_OBJECT_FORMAT} -o <OBJECT> <SOURCE>")

########################################
# OS Target
########################################
set(OS_KERNEL_LINKER "${CMAKE_CURRENT_SOURCE_DIR}/src/arch/${OS_ARCH_TARGET}/linker.ld")

# Add executable target for the kernel
add_executable(uiaos-kernel

# Stdlib
src/libc/panic.c
src/libc/system.c
src/libc/string.c
src/libc/stdio.c

src/common.c
src/monitor.c
src/gdt.c
src/idt.c
src/irq.c
src/isr.c
src/isr_asm.asm
src/descriptor_table.asm

src/multiboot2.asm # TODO: Add multiboot2 support
src/kernel.c
src/kernel.cpp

# Memory
src/memory/malloc.c
src/memory/paging.c
src/memory/memutils.c
src/pit.c

# Keyboard
src/input.c

# Apps
src/apps/song/song.c

)

# Include directories for the kernel target
target_include_directories(uiaos-kernel PUBLIC include)

# Specify compile options for C and C++
target_compile_options(uiaos-kernel PRIVATE
$<$<COMPILE_LANGUAGE:C>:-Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -Wno-main -g>
$<$<COMPILE_LANGUAGE:CXX>:-Wall -Wextra -nostdinc -nostdlib -fno-builtin -fno-stack-protector -fno-stack-check -fno-lto -fPIE -m32 -march=i386 -mno-mmx -mno-sse -mno-sse2 -mno-red-zone -g>
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-m32 -march=i386 -Wno-unused-variable -Wno-unused-parameter>
)


# Specify link options for C and C++
target_link_options(uiaos-kernel PUBLIC
$<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-ffreestanding -nostdlib -fno-builtin -static -pie -O0 -T${OS_KERNEL_LINKER} -g>
)


# Set properties for the kernel target
set_target_properties(uiaos-kernel PROPERTIES
OUTPUT_NAME "${OS_KERNEL_BINARY}"
)

########################################
# Create Empty Fat32 Disk Image
########################################
set(DISK_IMAGE "${CMAKE_CURRENT_BINARY_DIR}/disk.iso")

# Custom target to create an empty FAT32 disk image of 32MB
add_custom_target(
create-fat32-disk
COMMAND dd if=/dev/zero of=${DISK_IMAGE} bs=1M count=32
COMMAND mkfs.fat -F 32 ${DISK_IMAGE}
VERBATIM
)

########################################
# OS-Image Target
########################################
set(ISO_DIR ${CMAKE_CURRENT_BINARY_DIR}/iso)
set(LIMINE_CONFIG_DIR ${CMAKE_SOURCE_DIR})
set(LIMINE_DIR /usr/local/limine)
add_custom_target(
uiaos-create-image
COMMAND rm -rf ${ISO_DIR}
COMMAND mkdir -p ${ISO_DIR}
COMMAND cp -v $<TARGET_FILE:uiaos-kernel>
${LIMINE_CONFIG_DIR}/limine.cfg ${LIMINE_DIR}/limine-bios.sys ${LIMINE_DIR}/limine-bios-cd.bin
${LIMINE_DIR}/limine-uefi-cd.bin ${ISO_DIR}/
COMMAND mkdir -p ${ISO_DIR}/EFI/BOOT
COMMAND cp -v ${LIMINE_DIR}/BOOTX64.EFI ${ISO_DIR}/EFI/BOOT/
COMMAND cp -v ${LIMINE_DIR}/BOOTIA32.EFI ${ISO_DIR}/EFI/BOOT/
COMMAND xorriso -as mkisofs -b limine-bios-cd.bin
-no-emul-boot -boot-load-size 4 -boot-info-table
--efi-boot limine-uefi-cd.bin
-efi-boot-part --efi-boot-image --protective-msdos-label
${ISO_DIR} -o ${CMAKE_CURRENT_BINARY_DIR}/kernel.iso
COMMAND ${LIMINE_DIR}/limine bios-install ${CMAKE_CURRENT_BINARY_DIR}/kernel.iso
#COMMAND sudo rm -rf ${ISO_DIR}
DEPENDS create-fat32-disk uiaos-kernel
VERBATIM
)
Empty file added src/17_OSGroup/README.md
Empty file.
12 changes: 12 additions & 0 deletions src/17_OSGroup/include/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef COMMON_H
#define COMMON_H

#include "libc/stdint.h"

// https://wiki.osdev.org/Serial_Ports
void outb(uint16_t port, uint8_t value);
uint8_t inb(uint16_t port);
uint16_t inw(uint16_t port);

#endif

51 changes: 51 additions & 0 deletions src/17_OSGroup/include/descriptor_tables.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef DESCRIPTOR_TABLES_H
#define DESCRIPTOR_TABLES_H
#include "libc/system.h"
#define GDT_ENTRIES 5
#define IDT_ENTRIES 256
// This defines the GDT entry
struct gdt_entry_t {
uint16_t limit_low_part;
uint16_t base_low_part;
uint8_t base_middle_part;
uint8_t access_byte;
uint8_t granularity_byte;
uint8_t base_high_byte;
} __attribute__((packed));

// This defines the IDT entry
struct idt_entry_t {
uint16_t base_low_part;
uint16_t selector_segment;
uint8_t reserved;
uint8_t flags_bits;
uint16_t base_high_part;
} __attribute__((packed));

// Definning both the GDT and IDT pointers
struct gdt_ptr_t {
uint16_t limit;
uint32_t base;
} __attribute__((packed));

struct idt_ptr_t {
uint16_t limit;
uint32_t base;
} __attribute__((packed));

// Initialize the GDT and IDT
void init_gdt();
void init_idt();

// Loading the GDT and IDT
void gdt_load();
void idt_load();

void gdt_set_gate(int32_t num, uint32_t base, uint32_t limit, uint8_t access, uint8_t gran);

static struct idt_entry_t idt[IDT_ENTRIES];
static struct idt_ptr_t idt_ptr;
static struct gdt_entry_t gdt[GDT_ENTRIES];
static struct gdt_ptr_t gdt_ptr;

#endif // DESCRIPTOR_TABLES_H
3 changes: 3 additions & 0 deletions src/17_OSGroup/include/input.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#pragma once

char scancode_to_ascii(unsigned char* scan_code);
Loading
Loading