Compare commits

...

2 Commits

Author SHA1 Message Date
70c6b78e35 Organize source tree 2022-11-19 17:59:49 +01:00
a44e2f41fe Cleanup kernel/CMakeLists.txt 2022-11-19 17:59:39 +01:00
10 changed files with 24 additions and 34 deletions

View File

@ -1,8 +1,8 @@
set(SOURCES set(SOURCES
src/main.cpp src/main.cpp
src/Framebuffer.cpp src/video/Framebuffer.cpp
src/MemoryManager.cpp src/memory/MemoryManager.cpp
src/Init.cpp src/boot/Init.cpp
src/arch/Serial.cpp src/arch/Serial.cpp
) )
@ -16,21 +16,14 @@ set(SOURCES
) )
endif() endif()
set(ASM_SOURCES)
if("${ARCH}" MATCHES "x86_64")
set(ASM_SOURCES
${ASM_SOURCES}
src/arch/x86_64/CPU.asm
)
add_library(moon-asm STATIC ${ASM_SOURCES})
endif()
add_executable(moon ${SOURCES}) add_executable(moon ${SOURCES})
if("${ARCH}" MATCHES "x86_64") if("${ARCH}" MATCHES "x86_64")
target_link_libraries(moon moon-asm) set(ASM_SOURCES
src/arch/x86_64/CPU.asm
)
add_library(moon-asm STATIC ${ASM_SOURCES})
target_link_libraries(moon moon-asm)
endif() endif()
target_link_libraries(moon luna-freestanding) target_link_libraries(moon luna-freestanding)
@ -48,16 +41,13 @@ target_compile_options(moon PRIVATE -fno-asynchronous-unwind-tables -fno-omit-fr
target_compile_options(moon PRIVATE -nostdlib -mcmodel=kernel) target_compile_options(moon PRIVATE -nostdlib -mcmodel=kernel)
if("${ARCH}" MATCHES "x86_64") if("${ARCH}" MATCHES "x86_64")
target_compile_options(moon PRIVATE -mno-red-zone) target_compile_options(moon PRIVATE -mno-red-zone)
target_compile_options(moon PRIVATE -mno-80387 -mno-mmx -mno-sse -mno-sse2) target_compile_options(moon PRIVATE -mno-80387 -mno-mmx -mno-sse -mno-sse2)
target_link_options(moon PRIVATE -mno-red-zone)
endif() endif()
target_link_options(moon PRIVATE -lgcc -Wl,--build-id=none -z max-page-size=0x1000 -mcmodel=kernel) target_link_options(moon PRIVATE -lgcc -Wl,--build-id=none -z max-page-size=0x1000 -mcmodel=kernel)
if("${ARCH}" MATCHES "x86_64")
target_link_options(moon PRIVATE -mno-red-zone)
endif()
set_target_properties(moon PROPERTIES CXX_STANDARD 20) set_target_properties(moon PROPERTIES CXX_STANDARD 20)
target_include_directories(moon PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src) target_include_directories(moon PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src)

View File

@ -1,5 +1,5 @@
#include "arch/MMU.h" #include "arch/MMU.h"
#include "MemoryManager.h" #include "memory/MemoryManager.h"
#include <String.h> #include <String.h>
#define PAGE_SIZE 4096 #define PAGE_SIZE 4096

View File

@ -1,9 +1,9 @@
#include "Init.h" #include "boot/Init.h"
#include "Framebuffer.h"
#include "MemoryManager.h"
#include "arch/CPU.h" #include "arch/CPU.h"
#include "arch/Serial.h" #include "arch/Serial.h"
#include "bootboot.h" #include "boot/bootboot.h"
#include "memory/MemoryManager.h"
#include "video/Framebuffer.h"
#include <String.h> #include <String.h>
extern BOOTBOOT bootboot; extern BOOTBOOT bootboot;

View File

@ -1,5 +1,5 @@
/* /*
* bootboot.h * boot/bootboot.h
* https://gitlab.com/bztsrc/bootboot * https://gitlab.com/bztsrc/bootboot
* *
* Copyright (C) 2017 - 2021 bzt (bztsrc@gitlab) * Copyright (C) 2017 - 2021 bzt (bztsrc@gitlab)

View File

@ -1,9 +1,9 @@
#include "Framebuffer.h"
#include "Init.h"
#include "MemoryManager.h"
#include "arch/CPU.h" #include "arch/CPU.h"
#include "arch/MMU.h" #include "arch/MMU.h"
#include "arch/Serial.h" #include "arch/Serial.h"
#include "boot/Init.h"
#include "memory/MemoryManager.h"
#include "video/Framebuffer.h"
extern u8 fb[1]; extern u8 fb[1];

View File

@ -1,7 +1,7 @@
#include "MemoryManager.h" #include "memory/MemoryManager.h"
#include "arch/MMU.h" #include "arch/MMU.h"
#include "arch/Serial.h" #include "arch/Serial.h"
#include "bootboot.h" #include "boot/bootboot.h"
#include <Alignment.h> #include <Alignment.h>
#include <String.h> #include <String.h>
#include <Types.h> #include <Types.h>

View File

@ -1,5 +1,5 @@
#include "Framebuffer.h" #include "video/Framebuffer.h"
#include "bootboot.h" #include "boot/bootboot.h"
static u8* g_fb_ptr = nullptr; static u8* g_fb_ptr = nullptr;
static u32 g_fb_size; static u32 g_fb_size;