aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/CMakeLists.txt2
-rw-r--r--kernel/boot/gdt/gdt.cc (renamed from kernel/boot/gdt/gdt.c)17
-rw-r--r--kernel/include/boot/gdt.h19
-rw-r--r--kernel/kernel/kernel.cc2
4 files changed, 20 insertions, 20 deletions
diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt
index b412365..b1c9ce7 100644
--- a/kernel/CMakeLists.txt
+++ b/kernel/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.21)
project(kernel C ASM)
set(SRC
- boot/gdt/gdt.c
+ boot/gdt/gdt.cc
boot/gdt/gdt.s
boot/init/boot.s
diff --git a/kernel/boot/gdt/gdt.c b/kernel/boot/gdt/gdt.cc
index 182f3d9..e86638a 100644
--- a/kernel/boot/gdt/gdt.c
+++ b/kernel/boot/gdt/gdt.cc
@@ -16,13 +16,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdint.h>
-
+#include <boot/gdt.h>
#include <kernel/io.h>
+#include <stdint.h>
-#include <boot/gdt.h>
+namespace GDT
+{
-GDT_entry_t GDT_entries[] = {
+entry_t entries[] = {
/* NULL Descriptor */
GDT_ENTRY(0, 0, 0, 0),
@@ -42,10 +43,12 @@ GDT_entry_t GDT_entries[] = {
/* TODO: LDT? */
};
-GDT_descriptor_t GDT_descriptor = { sizeof(GDT_entries) - 1, GDT_entries };
+descriptor_t descriptor = { sizeof(entries) - 1, entries };
void
-GDT_load(void)
+load(void)
{
- _GDT_flush(&GDT_descriptor);
+ _GDT_flush(&descriptor);
+}
+
}
diff --git a/kernel/include/boot/gdt.h b/kernel/include/boot/gdt.h
index 607b4e8..ff87981 100644
--- a/kernel/include/boot/gdt.h
+++ b/kernel/include/boot/gdt.h
@@ -87,9 +87,8 @@
((base >> 24) & 0xff) /* base_high */ \
}
-#ifdef __cplusplus
-extern "C" {
-#endif
+namespace GDT
+{
typedef struct {
uint16_t limit_low;
@@ -98,18 +97,16 @@ typedef struct {
uint8_t access_flags;
uint8_t flags_limit_high;
uint8_t base_high;
-} PACKED GDT_entry_t;
+} PACKED entry_t;
typedef struct {
- uint16_t limit; /* sizeof(GDT) - 1 */
- GDT_entry_t *ptr; /* Address of GDT */
-} PACKED GDT_descriptor_t;
+ uint16_t limit; /* sizeof(GDT) - 1 */
+ entry_t *ptr; /* Address of GDT */
+} PACKED descriptor_t;
-extern void _GDT_flush(GDT_descriptor_t *GDT_descriptor);
-void GDT_load(void);
+extern "C" void _GDT_flush(descriptor_t *descriptor);
+void load(void);
-#ifdef __cplusplus
}
-#endif
#endif
diff --git a/kernel/kernel/kernel.cc b/kernel/kernel/kernel.cc
index a86d4e7..ca41a6f 100644
--- a/kernel/kernel/kernel.cc
+++ b/kernel/kernel/kernel.cc
@@ -39,7 +39,7 @@ kernel_main(uint32_t magic, multiboot_info_t *multiboot_info)
halt();
}
- GDT_load();
+ GDT::load();
memory_map_load(multiboot_info);
physical_mm_init();
virtual_mm_initialize();