diff options
| author | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-04-10 07:39:32 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@el-mahrouss-logic.com> | 2024-04-10 07:47:18 +0200 |
| commit | b3681aa66d52ac531f440a1a8da228f21a7d9546 (patch) | |
| tree | f1df65f71f9fb6883c073f2c77abfc2188650374 /Private/HALKit/AMD64/HalHardwareMP.cpp | |
| parent | 92af2056d51e56b12702c439c82ef335420c9d83 (diff) | |
Kernel: Lots of changes.
ArchKit: Remove rt_wait_400ns, as it is unused outside the AMD64 HAL.
Processor.hpp: Fix typo inside AMD64's StackFrame.
HalPageAlloc.hpp: Rename ControlRegisterBits::Paging to ControlRegisterBits::PageEnable.
HalPageAlloc.cpp: Rework Page allocation API.
HalHardwareMP.cpp: Rename from HalHardwareAPIC.cpp, implement primitive routines.
MBCI: Add new fields inside MBCI host according to standard.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/HALKit/AMD64/HalHardwareMP.cpp')
| -rw-r--r-- | Private/HALKit/AMD64/HalHardwareMP.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Private/HALKit/AMD64/HalHardwareMP.cpp b/Private/HALKit/AMD64/HalHardwareMP.cpp new file mode 100644 index 00000000..0e9f3022 --- /dev/null +++ b/Private/HALKit/AMD64/HalHardwareMP.cpp @@ -0,0 +1,39 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#include <ArchKit/ArchKit.hpp> + +// bugs = 0 + +namespace NewOS { +/// @brief wakes up thread. +/// wakes up thread from hang. +void rt_wakeup_thread(HAL::StackFrame* stack) { + HAL::rt_cli(); + + stack->Rcx = 0; + + HAL::rt_sti(); +} + +/// @brief Hangs until RCX register is cleared. +/// @param stack +static void __rt_hang_proc(HAL::StackFrame* stack) { + while (stack->Rcx == 1) { + ; + } +} + +/// @brief makes thread sleep. +/// hooks and hangs thread to prevent code from executing. +void rt_hang_thread(HAL::StackFrame* stack) { + HAL::rt_cli(); + + __rt_hang_proc(stack); + + HAL::rt_sti(); +} +} // namespace NewOS |
