Move read/write[bwl] from smp.c to util.h.
authorKevin O'Connor <kevin@koconnor.net>
Mon, 12 Oct 2009 13:49:27 +0000 (09:49 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Mon, 12 Oct 2009 13:49:27 +0000 (09:49 -0400)
Move them to the header so other code can use them.

src/smp.c
src/util.h

index 687947293b38e953901dfe4bdf7da269c4292571..ffeb5ae478b484fc2ae6012aef7c53899c3ea645 100644 (file)
--- a/src/smp.c
+++ b/src/smp.c
 
 #define APIC_ENABLED 0x0100
 
-static inline void writel(void *addr, u32 val)
-{
-    *(volatile u32 *)addr = val;
-}
-
-static inline void writew(void *addr, u16 val)
-{
-    *(volatile u16 *)addr = val;
-}
-
-static inline void writeb(void *addr, u8 val)
-{
-    *(volatile u8 *)addr = val;
-}
-
-static inline u32 readl(const void *addr)
-{
-    return *(volatile const u32 *)addr;
-}
-
-static inline u16 readw(const void *addr)
-{
-    return *(volatile const u16 *)addr;
-}
-
-static inline u8 readb(const void *addr)
-{
-    return *(volatile const u8 *)addr;
-}
-
 struct { u32 ecx, eax, edx; } smp_mtrr[16] VAR16VISIBLE;
 u32 smp_mtrr_count VAR16VISIBLE;
 
index 401e6ea9fc19dfd2e57fb3fa8f50cd95724d5a4b..ca3aa314e519f1d656b142cbb5865afefd43ca0c 100644 (file)
@@ -94,6 +94,25 @@ static inline u32 __ffs(u32 word)
     return word;
 }
 
+static inline void writel(void *addr, u32 val) {
+    *(volatile u32 *)addr = val;
+}
+static inline void writew(void *addr, u16 val) {
+    *(volatile u16 *)addr = val;
+}
+static inline void writeb(void *addr, u8 val) {
+    *(volatile u8 *)addr = val;
+}
+static inline u32 readl(const void *addr) {
+    return *(volatile const u32 *)addr;
+}
+static inline u16 readw(const void *addr) {
+    return *(volatile const u16 *)addr;
+}
+static inline u8 readb(const void *addr) {
+    return *(volatile const u8 *)addr;
+}
+
 // GDT bit manipulation
 #define GDT_BASE(v)  ((((u64)(v) & 0xff000000) << 32)           \
                       | (((u64)(v) & 0x00ffffff) << 16))