summaryrefslogtreecommitdiffhomepage
path: root/newBoot/Source/Arch
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-08 18:13:03 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-08 20:40:04 +0100
commitfc78d2f68ab5c9d9d84734fcc1af906c02a984b8 (patch)
tree8253a8439f6d107ebcd51b82783311d17f51a088 /newBoot/Source/Arch
parentb06f525d69e6adab8da0a5129bcd39fc592c6922 (diff)
boot\mpt: add init_ata_mpt, and some specific things about the MPT.
other: add ppc directory for newBoot support. rev A: make it prettier. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'newBoot/Source/Arch')
-rw-r--r--newBoot/Source/Arch/AMD64/ATA.cxx18
-rw-r--r--newBoot/Source/Arch/AMD64/BIOSRuntime.cxx2
-rw-r--r--newBoot/Source/Arch/AMD64/BIOSRuntime0.asm4
-rw-r--r--newBoot/Source/Arch/AMD64/Processor.cxx16
-rw-r--r--newBoot/Source/Arch/AMD64/makefile1
-rw-r--r--newBoot/Source/Arch/PowerPC/.gitkeep0
6 files changed, 32 insertions, 9 deletions
diff --git a/newBoot/Source/Arch/AMD64/ATA.cxx b/newBoot/Source/Arch/AMD64/ATA.cxx
index 5ddf3efa..ce905639 100644
--- a/newBoot/Source/Arch/AMD64/ATA.cxx
+++ b/newBoot/Source/Arch/AMD64/ATA.cxx
@@ -157,10 +157,16 @@ extern "C" UInt32 in32(UInt16 port)
return value;
}
-extern "C" void rt_halt() { asm volatile("hlt"); }
-
-extern "C" void rt_cli() { asm volatile("cli"); }
-
-extern "C" void rt_sti() { asm volatile("sti"); }
+extern "C" int init_ata_mpt(void)
+{
+ for (int i = 0; i < 255; ++i)
+ {
+ if (ATAInitDriver(i, ATA_MASTER))
+ {
+ ATAInitDriver(i, ATA_SLAVE);
+ return 1;
+ }
+ }
-extern "C" void rt_cld() { asm volatile("cld"); } \ No newline at end of file
+ return 0;
+} \ No newline at end of file
diff --git a/newBoot/Source/Arch/AMD64/BIOSRuntime.cxx b/newBoot/Source/Arch/AMD64/BIOSRuntime.cxx
index b8a95560..611a48c4 100644
--- a/newBoot/Source/Arch/AMD64/BIOSRuntime.cxx
+++ b/newBoot/Source/Arch/AMD64/BIOSRuntime.cxx
@@ -5,4 +5,4 @@
#include <BootKit/Boot.hpp>
#include "ATA.hxx"
-extern "C" char __STACK[4096] = { 0 };
+extern "C" char __runtime_stack[4096] = { 0 };
diff --git a/newBoot/Source/Arch/AMD64/BIOSRuntime0.asm b/newBoot/Source/Arch/AMD64/BIOSRuntime0.asm
index 5b5a6338..3a690d99 100644
--- a/newBoot/Source/Arch/AMD64/BIOSRuntime0.asm
+++ b/newBoot/Source/Arch/AMD64/BIOSRuntime0.asm
@@ -1,6 +1,6 @@
;; Copyright Mahrouss Logic, all rights reserved
-extern __STACK
+extern __runtime_stack
global NBRuntimeZero
bits 16
@@ -36,7 +36,7 @@ NBProtectedMode:
mov gs, ax
mov ss, ax
- mov esp, __STACK
+ mov esp, __runtime_stack
jmp 0x8000000
NBLoopOne:
diff --git a/newBoot/Source/Arch/AMD64/Processor.cxx b/newBoot/Source/Arch/AMD64/Processor.cxx
new file mode 100644
index 00000000..65cf85cb
--- /dev/null
+++ b/newBoot/Source/Arch/AMD64/Processor.cxx
@@ -0,0 +1,16 @@
+/*
+* ========================================================
+*
+* newBoot
+* Copyright Mahrouss Logic, all rights reserved.
+*
+* ========================================================
+*/
+
+extern "C" void rt_halt(void) { asm volatile("hlt"); }
+
+extern "C" void rt_cli(void) { asm volatile("cli"); }
+
+extern "C" void rt_sti(void) { asm volatile("sti"); }
+
+extern "C" void rt_cld(void) { asm volatile("cld"); }
diff --git a/newBoot/Source/Arch/AMD64/makefile b/newBoot/Source/Arch/AMD64/makefile
index fb4b0910..21860551 100644
--- a/newBoot/Source/Arch/AMD64/makefile
+++ b/newBoot/Source/Arch/AMD64/makefile
@@ -22,6 +22,7 @@ CCFLAGS = -c -ffreestanding -fno-rtti -fno-exceptions -std=c++20 -D__HAVE_HCORE
build-crt0-bios:
$(CC) $(CCFLAGS) BIOSRuntime.cxx
$(CC) $(CCFLAGS) ATA.cxx
+ $(CC) $(CCFLAGS) Processor.cxx
$(ASM) $(ASMFLAGS) BIOSRuntime0.asm
$(LD) --oformat $(FMT) ATA.o -o $(ATAMOD)
diff --git a/newBoot/Source/Arch/PowerPC/.gitkeep b/newBoot/Source/Arch/PowerPC/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/newBoot/Source/Arch/PowerPC/.gitkeep