summaryrefslogtreecommitdiffstats
path: root/arch/x86
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/PrimaryInit.cpp16
-rw-r--r--arch/x86/PrimaryInit.h12
-rwxr-xr-xarch/x86/gdt/Gdt.cpp2
-rw-r--r--arch/x86/gdt/GlobalObj.cpp6
-rw-r--r--arch/x86/gdt/GlobalObj.h11
-rw-r--r--arch/x86/gdt/GoToGdtMemSeg.s13
-rw-r--r--arch/x86/io/GlobalObj.cpp3
-rw-r--r--arch/x86/io/GlobalObj.h8
-rw-r--r--arch/x86/io/VGADisplay.cpp2
-rw-r--r--arch/x86/io/VGADisplay.h8
10 files changed, 40 insertions, 41 deletions
diff --git a/arch/x86/PrimaryInit.cpp b/arch/x86/PrimaryInit.cpp
new file mode 100644
index 0000000..7de690e
--- /dev/null
+++ b/arch/x86/PrimaryInit.cpp
@@ -0,0 +1,16 @@
+#include "PrimaryInit.h"
+
+
+void PrimaryInitialization::processorInitialize()
+{
+ MngGdt mngGdt = MngGdt();
+
+ mngGdt.addDescriptor(DescSeg32::flatCodeKernel());
+ mngGdt.addDescriptor(DescSeg32::flatDataKernel());
+ mngGdt.loadGdt();
+};
+
+void PrimaryInitialization::devicesInitialize()
+{
+ out::display = VGADisplay();
+};
diff --git a/arch/x86/PrimaryInit.h b/arch/x86/PrimaryInit.h
new file mode 100644
index 0000000..8d16549
--- /dev/null
+++ b/arch/x86/PrimaryInit.h
@@ -0,0 +1,12 @@
+#include "gdt/Gdt.h"
+#include "io/VGADisplay.h"
+
+
+#define x86_ARCH
+
+class PrimaryInitialization
+{
+ protected:
+ virtual void processorInitialize();
+ virtual void devicesInitialize();
+};
diff --git a/arch/x86/gdt/Gdt.cpp b/arch/x86/gdt/Gdt.cpp
index 80fcd13..21941b4 100755
--- a/arch/x86/gdt/Gdt.cpp
+++ b/arch/x86/gdt/Gdt.cpp
@@ -1,6 +1,8 @@
#include "Gdt.h"
+uint64 MngGdt::gdt[MngGdt::size];
+
DescSeg32::DescSeg32(uint32 base, uint32 limit, uint8 access, uint8 flags)
{
this->baseLow = base & 0x0000FFFF;
diff --git a/arch/x86/gdt/GlobalObj.cpp b/arch/x86/gdt/GlobalObj.cpp
deleted file mode 100644
index fbceeef..0000000
--- a/arch/x86/gdt/GlobalObj.cpp
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "GlobalObj.h"
-
-
-uint64 MngGdt::gdt[MngGdt::size];
-
-MngGdt mngGdt;
diff --git a/arch/x86/gdt/GlobalObj.h b/arch/x86/gdt/GlobalObj.h
deleted file mode 100644
index 3c62847..0000000
--- a/arch/x86/gdt/GlobalObj.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef GDTGLOBALOBJ_H
-#define GDTGLOBALOBJ_H
-
-#include <types.h>
-#include "Gdt.h"
-
-extern MngGdt mngGdt;
-
-void mngGdtInit();
-
-#endif
diff --git a/arch/x86/gdt/GoToGdtMemSeg.s b/arch/x86/gdt/GoToGdtMemSeg.s
deleted file mode 100644
index 2b5dd62..0000000
--- a/arch/x86/gdt/GoToGdtMemSeg.s
+++ /dev/null
@@ -1,13 +0,0 @@
-global GOTOGDTMEMSEG
-GOTOGDTMEMSEG:
- lgdt [esp + 4]
- jmp 0x08:.reloadCS
-.reloadCS:
- mov ax, 0x10
- mov ds, ax
- mov es, ax
- mov fs, ax
- mov gs, ax
- mov ss, ax
- ret
-.end:
diff --git a/arch/x86/io/GlobalObj.cpp b/arch/x86/io/GlobalObj.cpp
deleted file mode 100644
index a1c4f03..0000000
--- a/arch/x86/io/GlobalObj.cpp
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "VGADisplay.h"
-
-VGADisplay display;
diff --git a/arch/x86/io/GlobalObj.h b/arch/x86/io/GlobalObj.h
deleted file mode 100644
index 72c6b06..0000000
--- a/arch/x86/io/GlobalObj.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef GLOBALOBJ_H
-#define GLOBALOBJ_H
-
-#include "VGADisplay.h"
-
-extern VGADisplay display;
-
-#endif
diff --git a/arch/x86/io/VGADisplay.cpp b/arch/x86/io/VGADisplay.cpp
index 0cd0bed..ceb4862 100644
--- a/arch/x86/io/VGADisplay.cpp
+++ b/arch/x86/io/VGADisplay.cpp
@@ -1,5 +1,7 @@
#include "VGADisplay.h"
+VGADisplay out::display;
+
VGADisplay::VGADisplay()
{
isBright = isBlink = shift = 0;
diff --git a/arch/x86/io/VGADisplay.h b/arch/x86/io/VGADisplay.h
index db4c4df..326ae95 100644
--- a/arch/x86/io/VGADisplay.h
+++ b/arch/x86/io/VGADisplay.h
@@ -36,4 +36,12 @@ class VGADisplay
void setBlink(bool blinkAttr);
void setBright(bool brigthAttr);
};
+
+// Global variables
+
+namespace out
+{
+ extern VGADisplay display;
+};
+
#endif