From 47844a0db257264e7f8c5c38e07745601c884a7e Mon Sep 17 00:00:00 2001 From: Alexey Gavrilov Date: Sun, 20 Aug 2023 20:13:59 +0700 Subject: Edit README, Makefile, ld conf --- kernel/boot.s | 6 ++---- kernel/kernel.c | 22 ++++++++++++++++++++-- kernel/linker.ld | 6 +++++- 3 files changed, 27 insertions(+), 7 deletions(-) (limited to 'kernel') diff --git a/kernel/boot.s b/kernel/boot.s index 2fd1c55..987cb48 100644 --- a/kernel/boot.s +++ b/kernel/boot.s @@ -1,6 +1,4 @@ -MBALIGN equ 1 << 0 -MEMINFO equ 1 << 1 -MBFLAGS equ MBALIGN | MEMINFO +MBFLAGS equ 0 MAGIC equ 0x1BADB002 CHECKSUM equ -(MAGIC + MBFLAGS) @@ -17,10 +15,10 @@ resb 16384 stack_top: section .text +extern main global _start:function (_start.end - _start) _start: mov esp, stack_top - extern main call main cli .hang: hlt diff --git a/kernel/kernel.c b/kernel/kernel.c index 1d734c9..9a901b1 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -1,4 +1,22 @@ -int main() +#ifdef __cplusplus +extern "C" { +#endif + +#include "../arch/x86/io/GlobalObj.h" +#include "../arch/x86/inc/TypeConverter.h" + +void main() { - return 0; + VGADisplay d; + IntConverter conv; + + unsigned int i = 124; + + d << conv.intToChar(i); + d << "Hello, world!\tHello, world!"; + for(int i = 0; i < 10; i++)d << "\tHello!"; }; + +#ifdef __cplusplus +}; +#endif diff --git a/kernel/linker.ld b/kernel/linker.ld index e490e6a..d5ee742 100644 --- a/kernel/linker.ld +++ b/kernel/linker.ld @@ -4,10 +4,14 @@ SECTIONS { . = 1M; + .multiboot : + { + *(.multiboot) + } .text BLOCK(4K) : ALIGN(4K) { - *.(.multiboot) *(.text) + *(.eh_frame) } .rodata BLOCK(4K) : ALIGN(4k) -- cgit v1.2.3