From 84ce7ff4fa82444d876a170497a01f577e4247f9 Mon Sep 17 00:00:00 2001 From: Justin Miller Date: Mon, 9 Oct 2023 14:55:32 -0700 Subject: [PATCH] [TEST_KERNEL][BOOT] make a test kernel for the sake of doing paging right --- CMakeLists.txt | 1 + boot/bootdata/livecd.ini | 45 ------------------------------------- sdk/cmake/CMakeMacros.cmake | 4 ++-- test_kernel/CMakeLists.txt | 32 ++++++++++++++++++++++++++ test_kernel/main.c | 41 +++++++++++++++++++++++++++++++++ test_kernel/testkernel.rc | 5 +++++ test_kernel/testkernel.spec | 0 7 files changed, 81 insertions(+), 47 deletions(-) delete mode 100644 boot/bootdata/livecd.ini create mode 100644 test_kernel/CMakeLists.txt create mode 100644 test_kernel/main.c create mode 100644 test_kernel/testkernel.rc create mode 100644 test_kernel/testkernel.spec diff --git a/CMakeLists.txt b/CMakeLists.txt index 18de28a3ec8..cfd1d44df39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -367,6 +367,7 @@ Enable this if the module uses typeid or dynamic_cast. You will probably need to add_subdirectory(media) add_subdirectory(modules) add_subdirectory(ntoskrnl) + add_subdirectory(test_kernel) add_subdirectory(subsystems) add_subdirectory(sdk/tools/wpp) add_subdirectory(win32ss) diff --git a/boot/bootdata/livecd.ini b/boot/bootdata/livecd.ini deleted file mode 100644 index 0b034df9b1a..00000000000 --- a/boot/bootdata/livecd.ini +++ /dev/null @@ -1,45 +0,0 @@ -[FREELOADER] -DefaultOS=LiveCD_Debug -TimeOut=5 - -[Display] -TitleText=ReactOS LiveCD -MinimalUI=Yes - -[Operating Systems] -LiveCD="LiveCD" -LiveCD_Debug="LiveCD (Debug)" -LiveCD_Aacpi="LiveCD ACPI APIC (Debug)" -LiveCD_VBoxDebug="LiveCD (VBox Debug)" -LiveCD_Screen="LiveCD (Screen)" -LiveCD_LogFile="LiveCD (Log file)" - -[LiveCD] -BootType=Windows2003 -SystemPath=\reactos -Options=/MININT - -[LiveCD_Debug] -BootType=Windows2003 -SystemPath=\reactos -Options=/DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT - -[LiveCD_Aacpi] -BootType=Windows2003 -SystemPath=\reactos -Options=/HAL=halaacpi.dll /DEBUG /DEBUGPORT=COM1 /BAUDRATE=115200 /SOS /MININT - -[LiveCD_VBoxDebug] -BootType=Windows2003 -SystemPath=\reactos -Options=/DEBUG /DEBUGPORT=VBOX /SOS /MININT - -[LiveCD_Screen] -BootType=Windows2003 -SystemPath=\reactos -Options=/DEBUG /DEBUGPORT=SCREEN /SOS /MININT - -[LiveCD_LogFile] -BootType=Windows2003 -SystemPath=\reactos -Options=/DEBUG /DEBUGPORT=FILE:\Device\HarddiskX\PartitionY\debug.log /SOS /MININT diff --git a/sdk/cmake/CMakeMacros.cmake b/sdk/cmake/CMakeMacros.cmake index 8a49eebe6f3..1f74b13e456 100644 --- a/sdk/cmake/CMakeMacros.cmake +++ b/sdk/cmake/CMakeMacros.cmake @@ -654,9 +654,9 @@ function(set_module_type MODULE TYPE) if (ARCH STREQUAL "arm64") # special case for kernel if (TYPE STREQUAL kernel) - set_image_base(${MODULE} 0x80000000) + set_image_base(${MODULE} 0x400000000) else() - set_image_base(${MODULE} 0x40000000) + set_image_base(${MODULE} 0x400000000) endif() else() # special case for kernel diff --git a/test_kernel/CMakeLists.txt b/test_kernel/CMakeLists.txt new file mode 100644 index 00000000000..62c9a352a8c --- /dev/null +++ b/test_kernel/CMakeLists.txt @@ -0,0 +1,32 @@ +PROJECT(NTOS) + +if (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang") + # Enable this again. CORE-17637 + add_compile_options(-Wunused-result) +endif() + +spec2def(testkernel.exe testkernel.spec ADD_IMPORTLIB) + +# Embed RTC libs +if (STACK_PROTECTOR) + target_sources(testkernel PRIVATE $) +endif() + +if(CMAKE_C_COMPILER_ID STREQUAL "Clang") + # Clang optimises strcmp calls to memcmp. + target_sources(testkernel PRIVATE $) +endif() + +list(APPEND PCH_SKIP_SOURCE + guid.c) + +add_executable(testkernel + main.c + testkernel.rc + ${CMAKE_CURRENT_BINARY_DIR}/testkernel.def) +set_module_type(testkernel kernel) + + + +target_link_libraries(testkernel cportlib csq cmlib ntlsalib ${ROSSYM_LIB} libcntpr wdmguid ioevent) +add_dependencies(testkernel psdk asm) \ No newline at end of file diff --git a/test_kernel/main.c b/test_kernel/main.c new file mode 100644 index 00000000000..42e748d487a --- /dev/null +++ b/test_kernel/main.c @@ -0,0 +1,41 @@ +/* INCLUDES ******************************************************************/ + +/* C Headers */ +#include + +/* WDK HAL Compilation hack */ +#include +#include +#ifndef _MINIHAL_ +#undef NTSYSAPI +#define NTSYSAPI __declspec(dllimport) +#else +#undef NTSYSAPI +#define NTSYSAPI +#endif + + + +/* IFS/DDK/NDK Headers */ +#include +#include + +#include +#include +#include +#include +#include +#include + + +CODE_SEG("INIT") +DECLSPEC_NORETURN +VOID +NTAPI +KiSystemStartup(IN PLOADER_PARAMETER_BLOCK LoaderBlock) +{ + for(;;) + { + + } +} diff --git a/test_kernel/testkernel.rc b/test_kernel/testkernel.rc new file mode 100644 index 00000000000..da875db3607 --- /dev/null +++ b/test_kernel/testkernel.rc @@ -0,0 +1,5 @@ +#define REACTOS_VERSION_DLL +#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Kernel tetL" +#define REACTOS_STR_INTERNAL_NAME "testkernel" +#define REACTOS_STR_ORIGINAL_FILENAME "testkernel.exe" +#include \ No newline at end of file diff --git a/test_kernel/testkernel.spec b/test_kernel/testkernel.spec new file mode 100644 index 00000000000..e69de29bb2d