Answer the question
In order to leave comments, you need to log in
How to embed C++ into OS kernel?
I have a core in C, and a bunch of libraries for C ++.
How do I embed C++ support into a written kernel?
Assembly code(kernel.asm)
bits 32
section .text
;multiboot spec
align 4
dd 0x1BADB002
dd 0x00
dd - (0x1BADB002 + 0x00)
global start
global keyboard_handler
global read_port
global write_port
global load_idt
extern kmain
extern keyboard_handler_main
read_port:
mov edx, [esp + 4]
in al, dx
ret
write_port:
mov edx, [esp + 4]
mov al, [esp + 4 + 4]
out dx, al
ret
load_idt:
mov edx, [esp + 4]
lidt [edx]
sti
ret
keyboard_handler:
call keyboard_handler_main
iretd
start:
cli
mov esp, stack_space
call kmain
hlt
section .bss
resb 8192; 8KB for stack
stack_space:
Answer the question
In order to leave comments, you need to log in
C++ is a programming language. There is no support for it in any kernel.
The kernel is the part of the operating system that provides the main interface for running processes and system functions that can be used. You can write the kernel in anything, and there is no connection with the supported languages.
And C++ is supported primarily by the compiler, which has nothing to do with the kernel.
A slightly different question is the linker that creates a binary or library, and your kernel, in theory, should be able to run this binary and use the library.
In total, before "connecting C ++ to the kernel", you should clarify how the OS architecture works and ask the right question
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question