Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions kernel/etc/Console.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ typedef enum {

extern ConsoleT console;

#ifdef __cplusplus
extern "C" {
#endif
void PrintKernelSuccess(const char* str);
void PrintKernelError(const char* str);
void PrintKernelWarning(const char* str);
Expand All @@ -71,6 +74,9 @@ void SerialWriteF(const char* format, ...);
void PrintKernelErrorF(const char* format, ...);
void PrintKernelWarningF(const char* format, ...);
void PrintKernelSuccessF(const char* format, ...);
#ifdef __cplusplus
}
#endif
// save a bit of time
static inline __attribute__((always_inline)) void PrintNewline(void) {
PrintKernel("\n");
Expand Down
5 changes: 3 additions & 2 deletions kernel/etc/Shell.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "Shell.h"

#include "../../drivers/ethernet/realtek/RTL8139.h"
#include "6502/6502.h"
#include "realtek/RTL8139.h"
#include "Cerberus.h"
#include "Console.h"
#include "ELFloader.h"
Expand Down Expand Up @@ -1170,6 +1170,7 @@ static const ShellCommand commands[] = {
{"isocp", IsoCpHandler},
{"setup", CloneSystemFiles},
{"pcbeep", PcBeepHandler},
{"6502", Entry6502},
};

void ExecuteCommand(const char* cmd) {
Expand Down
30 changes: 28 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ project('voidframe', 'c',
)

clang = find_program('clang', required : true)
clangpp = find_program('clang++', required : true)
ld = find_program('ld', required : true)
nasm = find_program('nasm', required : true)
grub_mkrescue = find_program('grub-mkrescue')
Expand Down Expand Up @@ -47,6 +48,13 @@ c_flags = [
'-Wextra',
]

cpp_flags = c_flags + [
'-std=gnu++17',
'-fno-exceptions',
'-fno-rtti',
'-fno-threadsafe-statics',
]

# Assembly flags
asm_flags = ['-f', 'elf64']

Expand Down Expand Up @@ -78,6 +86,8 @@ inc_dirs = [
src_root + '/mm',
src_root + '/mm/trace',
src_root + '/mm/security',
src_root + '/ports/6502',
src_root + '/ports',
arch_root + '/cpu',
arch_root + '/gdt',
arch_root + '/idt',
Expand Down Expand Up @@ -148,6 +158,10 @@ c_sources = [
arch_root + '/cpu/Cpu.c'
]

cpp_sources = [
src_root + '/ports/6502/6502.cpp',
]

obj_sources = [
src_root + '/kernel/etc/objects/splash1.o',
src_root + '/kernel/etc/objects/panic.o',
Expand Down Expand Up @@ -221,11 +235,23 @@ foreach c_file : c_sources
c_objects += c_obj
endforeach

# Compile C files
cpp_objects = []
foreach cpp_file : cpp_sources
obj_name = cpp_file.split('/')[-1].split('.')[0] + '_cpp.o'
cpp_obj = custom_target('cpp_' + obj_name,
input : cpp_file,
output : obj_name,
command : [clangpp.full_path(), cpp_flags, inc_flags, cfg_flags, '-c', '-o', '@OUTPUT@', '@INPUT@']
)
cpp_objects += cpp_obj
endforeach

obj_to_link = []
if exclude_extra_objects
obj_to_link = asm_objects + c_objects
obj_to_link = asm_objects + c_objects + cpp_objects
else
obj_to_link = asm_objects + c_objects + obj_sources
obj_to_link = asm_objects + c_objects + obj_sources + cpp_objects
endif

# Link kernel
Expand Down
Loading