summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/HALKit/AMD64/HalAPICDmaWrapper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/HALKit/AMD64/HalAPICDmaWrapper.cpp')
-rw-r--r--src/kernel/HALKit/AMD64/HalAPICDmaWrapper.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/kernel/HALKit/AMD64/HalAPICDmaWrapper.cpp b/src/kernel/HALKit/AMD64/HalAPICDmaWrapper.cpp
new file mode 100644
index 00000000..b262f2b3
--- /dev/null
+++ b/src/kernel/HALKit/AMD64/HalAPICDmaWrapper.cpp
@@ -0,0 +1,37 @@
+// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
+// Licensed under the Apache License, Version 2.0 (see LICENSE file)
+// Official repository: https://github.com/nekernel-org/nekernel
+
+#include <HALKit/AMD64/Processor.h>
+#include <modules/ACPI/ACPIFactoryInterface.h>
+
+namespace Kernel::HAL {
+/***********************************************************************************/
+/// Constructors.
+/***********************************************************************************/
+LAPICDmaWrapper::LAPICDmaWrapper(VoidPtr base) : fApic(base) {}
+LAPICDmaWrapper::~LAPICDmaWrapper() = default;
+
+/***********************************************************************************/
+/// @brief Read from APIC controller.
+/// @param reg register.
+/***********************************************************************************/
+UInt32 LAPICDmaWrapper::Read(UInt16 reg) {
+ MUST_PASS(this->fApic);
+
+ UInt32 volatile* io_apic = (UInt32 volatile*) this->fApic;
+ return io_apic[reg];
+}
+
+/***********************************************************************************/
+/// @brief Write to APIC controller.
+/// @param reg register.
+/// @param value value.
+/***********************************************************************************/
+Void LAPICDmaWrapper::Write(UInt16 reg, UInt32 value) {
+ MUST_PASS(this->fApic);
+
+ UInt32 volatile* io_apic = (UInt32 volatile*) this->fApic;
+ io_apic[reg] = value;
+}
+} // namespace Kernel::HAL