Compare commits
4 Commits
547aeb0170
...
2188dc2e1c
Author | SHA1 | Date |
---|---|---|
Bananymous | 2188dc2e1c | |
Bananymous | ff83c52c89 | |
Bananymous | 1cfab4ae04 | |
Bananymous | 2ac28cba6e |
|
@ -148,7 +148,7 @@ target_compile_definitions(kernel PUBLIC __arch=${BANAN_ARCH})
|
||||||
target_compile_options(kernel PUBLIC -O2 -g)
|
target_compile_options(kernel PUBLIC -O2 -g)
|
||||||
target_compile_options(kernel PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-Wno-literal-suffix -fno-rtti -fno-exceptions>)
|
target_compile_options(kernel PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-Wno-literal-suffix -fno-rtti -fno-exceptions>)
|
||||||
target_compile_options(kernel PUBLIC -fmacro-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.)
|
target_compile_options(kernel PUBLIC -fmacro-prefix-map=${CMAKE_CURRENT_SOURCE_DIR}=.)
|
||||||
target_compile_options(kernel PUBLIC -fstack-protector -ffreestanding -Wall -Werror=return-type -Wstack-usage=1024 -fno-omit-frame-pointer -mgeneral-regs-only)
|
target_compile_options(kernel PUBLIC -fstack-protector -ffreestanding -Wall -Wextra -Werror -Wstack-usage=1024 -fno-omit-frame-pointer -mgeneral-regs-only)
|
||||||
|
|
||||||
# This might not work with other toolchains
|
# This might not work with other toolchains
|
||||||
target_compile_options(kernel PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>)
|
target_compile_options(kernel PUBLIC $<$<COMPILE_LANGUAGE:CXX>:-Wno-invalid-offsetof>)
|
||||||
|
@ -167,6 +167,8 @@ endif()
|
||||||
|
|
||||||
target_link_options(kernel PUBLIC -ffreestanding -nostdlib)
|
target_link_options(kernel PUBLIC -ffreestanding -nostdlib)
|
||||||
|
|
||||||
|
set_source_files_properties(${LAI_SOURCES} PROPERTIES COMPILE_FLAGS -Wno-stack-usage)
|
||||||
|
|
||||||
add_custom_target(kernel-headers
|
add_custom_target(kernel-headers
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/lai/include/ ${BANAN_INCLUDE}/
|
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/lai/include/ ${BANAN_INCLUDE}/
|
||||||
|
|
|
@ -233,6 +233,7 @@ namespace Kernel
|
||||||
|
|
||||||
virtual BAN::ErrorOr<BAN::UniqPtr<MemoryRegion>> clone(PageTable& new_page_table) override
|
virtual BAN::ErrorOr<BAN::UniqPtr<MemoryRegion>> clone(PageTable& new_page_table) override
|
||||||
{
|
{
|
||||||
|
(void)new_page_table;
|
||||||
return BAN::Error::from_errno(ENOTSUP);
|
return BAN::Error::from_errno(ENOTSUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ namespace Kernel
|
||||||
LockGuard _(m_lock);
|
LockGuard _(m_lock);
|
||||||
|
|
||||||
size_t result = first_data_page;
|
size_t result = first_data_page;
|
||||||
TRY(for_each_indirect_paddr_allocating(m_data_pages, [&] (paddr_t paddr, bool allocated) {
|
TRY(for_each_indirect_paddr_allocating(m_data_pages, [&] (paddr_t, bool allocated) {
|
||||||
if (allocated)
|
if (allocated)
|
||||||
return BAN::Iteration::Break;
|
return BAN::Iteration::Break;
|
||||||
result++;
|
result++;
|
||||||
|
|
|
@ -194,7 +194,7 @@ namespace Kernel
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
BAN::ErrorOr<BAN::UniqPtr<MemoryRegion>> FileBackedRegion::clone(PageTable& new_page_table)
|
BAN::ErrorOr<BAN::UniqPtr<MemoryRegion>> FileBackedRegion::clone(PageTable&)
|
||||||
{
|
{
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,8 +289,11 @@ static constexpr bool is_power_of_two(size_t value)
|
||||||
return (value & (value - 1)) == 0;
|
return (value & (value - 1)) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* kmalloc(size_t size, size_t align, bool force_indentity_map)
|
void* kmalloc(size_t size, size_t align, bool force_identity_map)
|
||||||
{
|
{
|
||||||
|
// currently kmalloc is always identity mapped
|
||||||
|
(void)force_identity_map;
|
||||||
|
|
||||||
const kmalloc_info& info = s_kmalloc_info;
|
const kmalloc_info& info = s_kmalloc_info;
|
||||||
|
|
||||||
ASSERT(is_power_of_two(align));
|
ASSERT(is_power_of_two(align));
|
||||||
|
|
|
@ -39,6 +39,8 @@ endforeach()
|
||||||
add_custom_target(userspace)
|
add_custom_target(userspace)
|
||||||
add_custom_target(userspace-install DEPENDS userspace)
|
add_custom_target(userspace-install DEPENDS userspace)
|
||||||
|
|
||||||
|
add_subdirectory(aoc2023)
|
||||||
|
|
||||||
foreach(USERSPACE_PROJECT ${USERSPACE_PROJECTS})
|
foreach(USERSPACE_PROJECT ${USERSPACE_PROJECTS})
|
||||||
target_compile_options(${USERSPACE_PROJECT} PRIVATE -g)
|
target_compile_options(${USERSPACE_PROJECT} PRIVATE -g)
|
||||||
add_dependencies(${USERSPACE_PROJECT} libc-install ban-install)
|
add_dependencies(${USERSPACE_PROJECT} libc-install ban-install)
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
cmake_minimum_required(VERSION 3.26)
|
||||||
|
|
||||||
|
project(aoc2023 CXX)
|
||||||
|
|
||||||
|
set(AOC2023_PROJECTS
|
||||||
|
day1
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(AOC2023_PROJECT ${AOC2023_PROJECTS})
|
||||||
|
add_subdirectory(${AOC2023_PROJECT})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
add_custom_target(aoc2023)
|
||||||
|
add_custom_target(aoc2023-install DEPENDS aoc2023)
|
||||||
|
|
||||||
|
foreach(AOC2023_PROJECT ${AOC2023_PROJECTS})
|
||||||
|
target_compile_options(${AOC2023_PROJECT} PRIVATE -g)
|
||||||
|
add_dependencies(${AOC2023_PROJECT} libc-install ban-install )
|
||||||
|
add_dependencies(aoc2023 ${AOC2023_PROJECT})
|
||||||
|
add_dependencies(aoc2023-install ${AOC2023_PROJECT}-install)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
add_dependencies(userspace aoc2023)
|
||||||
|
add_dependencies(userspace-install aoc2023-install)
|
|
@ -0,0 +1,17 @@
|
||||||
|
cmake_minimum_required(VERSION 3.26)
|
||||||
|
|
||||||
|
project(day1 CXX)
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(day1 ${SOURCES})
|
||||||
|
target_compile_options(day1 PUBLIC -O2 -g)
|
||||||
|
target_link_libraries(day1 PUBLIC libc)
|
||||||
|
|
||||||
|
add_custom_target(day1-install
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${BANAN_BIN}/aoc2023
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/day1 ${BANAN_BIN}/aoc2023/
|
||||||
|
DEPENDS day1
|
||||||
|
)
|
|
@ -0,0 +1,6 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
printf("hello world\n");
|
||||||
|
}
|
|
@ -8,6 +8,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <termios.h>
|
||||||
|
|
||||||
void initialize_stdio()
|
void initialize_stdio()
|
||||||
{
|
{
|
||||||
|
@ -26,8 +27,13 @@ int main()
|
||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
|
termios termios;
|
||||||
|
tcgetattr(STDIN_FILENO, &termios);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
tcsetattr(STDIN_FILENO, TCSANOW, &termios);
|
||||||
|
|
||||||
char name_buffer[128];
|
char name_buffer[128];
|
||||||
|
|
||||||
while (!first)
|
while (!first)
|
||||||
|
|
Loading…
Reference in New Issue