aboutsummaryrefslogtreecommitdiff
path: root/src/core/asm.hpp
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2021-04-25 12:41:24 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2021-04-25 12:41:24 +0200
commit7db6db5ae64e7ab2626bbd898c63f58e053dc1a6 (patch)
treeaac3b4b8755acbea397709a00611642c2534f053 /src/core/asm.hpp
parent657372f1be95393b76a54f258ba3f937b4073abe (diff)
Debug multiboot, enable apic and ACPI table parsing
Diffstat (limited to 'src/core/asm.hpp')
-rw-r--r--src/core/asm.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/core/asm.hpp b/src/core/asm.hpp
new file mode 100644
index 0000000..8a931f6
--- /dev/null
+++ b/src/core/asm.hpp
@@ -0,0 +1,23 @@
+#pragma once
+
+#define READ_MSR(reg,high,low) \
+ asm volatile( \
+ "mov %2, %%ecx;rdmsr \n\t" \
+ "mov %%edx, %0 \n\t" \
+ "mov %%eax, %1" \
+ : "=m" (high), "=m" (low) :"i" (reg))
+
+#define WRITE_MSR(reg,high,low) \
+ asm volatile( \
+ "mov %1, %%edx \n\t" \
+ "mov %2, %%eax \n\t" \
+ "mov %0, %%ecx;wrmsr"::"i" (reg), "m" (high), "m" (low))
+
+#define outb(port,value) \
+ asm volatile ("outb %%al, %%dx" :: "a"(value), "d" (port) )
+
+#define outbj(port,value) \
+ asm volatile ("outb %%al, %%dx;" :: "a" (value), "d"(port) )
+
+#define inb(port,dst) \
+ asm volatile ("inb %%dx, %%al": "=a" (dst) : "d" (port))