diff options
| author | Alexey Gavrilov <rebovas@yahoo.com> | 2023-11-04 10:09:44 +0700 |
|---|---|---|
| committer | Alexey Gavrilov <rebovas@yahoo.com> | 2023-11-04 10:09:44 +0700 |
| commit | c18781e37e6bfe153e7c0f2bc8b04df0aecf151d (patch) | |
| tree | 42bb0e00e58ccf85aa3b93c20347d4939464066e /kernel | |
| parent | a93807ad337dd982c49f898cd5205d2b028f365d (diff) | |
Support for GDT has been written + add makefile debug mode
Diffstat (limited to 'kernel')
| -rwxr-xr-x | kernel/GlobalConstruct.cpp | 14 | ||||
| -rwxr-xr-x | kernel/GlobalConstruct.h | 14 | ||||
| -rw-r--r-- | kernel/kernel.c | 17 | ||||
| -rw-r--r-- | kernel/linker.ld | 1 |
4 files changed, 33 insertions, 13 deletions
diff --git a/kernel/GlobalConstruct.cpp b/kernel/GlobalConstruct.cpp new file mode 100755 index 0000000..dc0a83a --- /dev/null +++ b/kernel/GlobalConstruct.cpp @@ -0,0 +1,14 @@ +#include "GlobalConstruct.h" + +void GlobalConstruct::terminalInit() +{ + display = VGADisplay(); +}; + +void GlobalConstruct::gdtInit() +{ + mngGdtInit(); + mngGdt.addDescriptor(DescSeg32::flatCodeKernel()); + mngGdt.addDescriptor(DescSeg32::flatDataKernel()); + mngGdt.loadGdt(); +}; diff --git a/kernel/GlobalConstruct.h b/kernel/GlobalConstruct.h new file mode 100755 index 0000000..2b0a675 --- /dev/null +++ b/kernel/GlobalConstruct.h @@ -0,0 +1,14 @@ +#ifndef GLOBALCONSTRUCT_H +#define GLOBALCONSTRUCT_H + +#include "../arch/x86/io/GlobalObj.h" +#include "../arch/x86/gdt/GlobalObj.h" + +class GlobalConstruct +{ + public: + static void terminalInit(); + static void gdtInit(); +}; + +#endif diff --git a/kernel/kernel.c b/kernel/kernel.c index 9a901b1..59caf0a 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -1,22 +1,13 @@ -#ifdef __cplusplus -extern "C" { -#endif - +#include "GlobalConstruct.h" #include "../arch/x86/io/GlobalObj.h" #include "../arch/x86/inc/TypeConverter.h" void main() { - VGADisplay d; - IntConverter conv; + GlobalConstruct::terminalInit(); + GlobalConstruct::gdtInit(); - unsigned int i = 124; + display << "Hello, World!"; - 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 d5ee742..ae4d98d 100644 --- a/kernel/linker.ld +++ b/kernel/linker.ld @@ -12,6 +12,7 @@ SECTIONS { *(.text) *(.eh_frame) + *(.ctors) } .rodata BLOCK(4K) : ALIGN(4k) |
