summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/ZBA/Sources/HEL/AMD64/BootMain.cxx17
-rw-r--r--dev/ZBA/amd64-efi.make2
-rw-r--r--dev/ZKA/FirmwareKit/Handover.hxx8
-rw-r--r--dev/ZKA/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx1
-rw-r--r--dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm11
-rw-r--r--dev/ZKA/HALKit/AMD64/HalKernelMain.cxx3
-rw-r--r--dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm7
7 files changed, 30 insertions, 19 deletions
diff --git a/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx b/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
index 9cdaf603..6925a05a 100644
--- a/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
+++ b/dev/ZBA/Sources/HEL/AMD64/BootMain.cxx
@@ -126,23 +126,28 @@ EFI_EXTERN_C EFI_API Int Main(EfiHandlePtr ImageHandle,
handoverHdrPtr->f_GOP.f_PixelFormat = kGop->Mode->Info->PixelFormat;
handoverHdrPtr->f_GOP.f_Size = kGop->Mode->FrameBufferSize;
- auto guid_mp = EfiGUID(EFI_MP_SERVICES_PROTOCOL_GUID);
- VoidPtr mp = nullptr;
+ auto guid_mp = EfiGUID(EFI_MP_SERVICES_PROTOCOL_GUID);
+ EfiMpServicesProtocol* mp = nullptr;
extern EfiBootServices* BS;
- BS->LocateProtocol(&guid_mp, nullptr, &mp);
+ BS->LocateProtocol(&guid_mp, nullptr, reinterpret_cast<VoidPtr*>(&mp));
- handoverHdrPtr->f_HardwareTables.f_MPPtr = mp;
+ handoverHdrPtr->f_MultiProcessingEnabled = mp != nullptr;
kHandoverHeader = handoverHdrPtr;
CGInit();
- CGDrawInRegion(CGColor(0xff, 0x3a, 0x3a), handoverHdrPtr->f_GOP.f_Height, handoverHdrPtr->f_GOP.f_Width, 0, 0);
+ CGDrawInRegion(CGColor(0xFF, 0x3A, 0x3A), handoverHdrPtr->f_GOP.f_Height, handoverHdrPtr->f_GOP.f_Width, 0, 0);
CGFini();
+ UInt32 cnt_enabled = 0;
+ UInt32 cnt_disabled = 0;
+
+ mp->GetNumberOfProcessors(mp, &cnt_disabled, &cnt_enabled);
+
CGDrawString("NEWOSLDR (C) ZKA TECHNOLOGIES.", 10, 10, RGB(0xFF, 0xFF, 0xFF));
- CGDrawString(BVersionString::The(), 20, 10, RGB(0xFF, 0xFF, 0xFF));
+ CGDrawString((cnt_enabled > 1) ? "MULTIPROCESSOR SYSTEM." : "UNIPROCESSOR SYSTEM.", 20, 10, RGB(0xFF, 0xFF, 0xFF));
// Fill handover header now.
diff --git a/dev/ZBA/amd64-efi.make b/dev/ZBA/amd64-efi.make
index f5c19801..44253e42 100644
--- a/dev/ZBA/amd64-efi.make
+++ b/dev/ZBA/amd64-efi.make
@@ -29,7 +29,7 @@ IMG=epm-master-1.img
IMG_2=epm-slave.img
IMG_3=epm-master-2.img
-EMU_FLAGS=-net none -smp 4 -m 8G -M q35 \
+EMU_FLAGS=-net none -m 8G -M q35 \
-bios $(BIOS) -device piix3-ide,id=ide \
-drive id=disk,file=$(IMG),format=raw,if=none \
-device ide-hd,drive=disk,bus=ide.0 -drive \
diff --git a/dev/ZKA/FirmwareKit/Handover.hxx b/dev/ZKA/FirmwareKit/Handover.hxx
index ba7b23b2..2873b954 100644
--- a/dev/ZKA/FirmwareKit/Handover.hxx
+++ b/dev/ZKA/FirmwareKit/Handover.hxx
@@ -75,14 +75,10 @@ namespace Kernel::HEL
{
VoidPtr f_SmBios;
VoidPtr f_VendorPtr;
- struct
- {
- VoidPtr f_ImagePtr;
- SizeT f_ImageSz;
- };
- VoidPtr f_MPPtr;
} f_HardwareTables;
+ Bool f_MultiProcessingEnabled;
+
struct
{
UIntPtr f_The;
diff --git a/dev/ZKA/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx b/dev/ZKA/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
index b1b8d698..d11d1c8c 100644
--- a/dev/ZKA/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
+++ b/dev/ZKA/HALKit/AMD64/HalCoreMultiProcessingAMD64.cxx
@@ -114,6 +114,7 @@ namespace Kernel::HAL
/// @param targetAddress
/// @return
/***********************************************************************************/
+
Void hal_send_start_ipi(UInt32 apicId, UInt8 vector, UInt32 targetAddress)
{
Kernel::ke_dma_write(targetAddress, kAPIC_ICR_High, (apicId << 24));
diff --git a/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm b/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm
index 12c71663..0c79be81 100644
--- a/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm
+++ b/dev/ZKA/HALKit/AMD64/HalInterruptAPI.asm
@@ -186,7 +186,16 @@ __NEW_INT_51:
sti
iretq
-IntNormal 52
+[extern hal_ap_startup]
+
+__NEW_INT_52:
+ cli
+
+ jmp hal_ap_startup
+
+ sti
+ ret
+
IntNormal 53
IntNormal 54
IntNormal 55
diff --git a/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx b/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx
index 126473a0..6be8eeaf 100644
--- a/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx
+++ b/dev/ZKA/HALKit/AMD64/HalKernelMain.cxx
@@ -218,7 +218,8 @@ Kernel::Void hal_real_init(Kernel::Void) noexcept
kSyscalls[cShutdownInterrupt].Leak().Leak()->fHooked = true;
kSyscalls[cRebootInterrupt].Leak().Leak()->fHooked = true;
- Kernel::HAL::hal_system_get_cores(kHandoverHeader->f_HardwareTables.f_VendorPtr);
+ if (kHandoverHeader->f_MultiProcessingEnabled)
+ Kernel::HAL::hal_system_get_cores(kHandoverHeader->f_HardwareTables.f_VendorPtr);
Kernel::kcout << "newoskrnl: Creating filesystem and such.\r";
diff --git a/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm b/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm
index 70ee1205..c5af31a0 100644
--- a/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm
+++ b/dev/ZKA/HALKit/AMD64/HalMPContextSwitch.asm
@@ -21,15 +21,14 @@ section .text
;; rcx: Stack Pointer
;; rdx: SMP core address.
rt_do_context_switch:
- push rax
+ push rcx
call _hal_switch_context
- pop rax
+ pop rcx
;; Now grab newly allocated process's stack frame.
-
push rax
call _hal_leak_current_context
- mov rax, r9
+ mov r9, rax
pop rax
;; Take care of context switching within AP.