All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] convert page-l3.h macros to inlines
@ 2005-05-13 11:16 Scott Parish
  2005-05-13 12:12 ` Gerd Knorr
  0 siblings, 1 reply; 7+ messages in thread
From: Scott Parish @ 2005-05-13 11:16 UTC (permalink / raw)
  To: kraxel; +Cc: xen-devel

[-- Attachment #1: Type: text/plain, Size: 131 bytes --]

Avoid multiple evals as discussed in "double incrementing l2tab" thread.

sRp

-- 
Scott Parish
Signed-off-by: srparish@us.ibm.com

[-- Attachment #2: macro-to-inline.diff --]
[-- Type: text/plain, Size: 3070 bytes --]

--- xen-unstable-orig/xen/include/asm-x86/x86_32/page-3l.h	2005-05-13 10:51:30.000000000 +0000
+++ xen-unstable-pae/xen/include/asm-x86/x86_32/page-3l.h	2005-05-13 10:42:15.000000000 +0000
@@ -24,28 +24,66 @@ typedef struct { u32 l3_lo; u32 l3_hi; }
 typedef l3_pgentry_t root_pgentry_t;
 
 /* read access (depricated) */
-#define l1e_get_value(_x)         ((u64)(_x).l1_lo | (u64)(_x).l1_hi << 32)
-#define l2e_get_value(_x)         ((u64)(_x).l2_lo | (u64)(_x).l2_hi << 32)
-#define l3e_get_value(_x)         ((u64)(_x).l3_lo | (u64)(_x).l3_hi << 32)
+static inline u64 l1e_get_value(l1_pgentry_t x)
+{
+    return ((u64)x.l1_lo | (u64)x.l1_hi << 32);
+}
+static inline u64 l2e_get_value(l2_pgentry_t x)
+{
+    return ((u64)x.l2_lo | (u64)x.l2_hi << 32);
+}
+static inline u64 l3e_get_value(l3_pgentry_t x)
+{
+    return ((u64)x.l3_lo | (u64)x.l3_hi << 32);
+}
+
 
 /* read access */
-#define l1e_get_pfn(_x)           ((((_x).l1_hi & 0x0f) << (32-PAGE_SHIFT))  |\
-				    ((_x).l1_lo         >> PAGE_SHIFT))
-#define l1e_get_phys(_x)          ((((u64)(_x).l1_hi & 0x0f) << 32)  |\
-				    ((u64)(_x).l1_lo & PAGE_MASK))
-#define l1e_get_flags(_x)         ((_x).l1_lo &  ~PAGE_MASK)
-
-#define l2e_get_pfn(_x)           ((((_x).l2_hi & 0x0f) << (32-PAGE_SHIFT))  |\
-				    ((_x).l2_lo         >> PAGE_SHIFT))
-#define l2e_get_phys(_x)          ((((u64)(_x).l2_hi & 0x0f) << 32)  |\
-				    ((u64)(_x).l2_lo & PAGE_MASK))
-#define l2e_get_flags(_x)         ((_x).l2_lo &  ~PAGE_MASK)
-
-#define l3e_get_pfn(_x)           ((((_x).l3_hi & 0x0f) << (32-PAGE_SHIFT))  |\
-				    ((_x).l3_lo         >> PAGE_SHIFT))
-#define l3e_get_phys(_x)          ((((u64)(_x).l3_hi & 0x0f) << 32)  |\
-				    ((u64)(_x).l3_lo & PAGE_MASK))
-#define l3e_get_flags(_x)         ((_x).l3_lo &  ~PAGE_MASK)
+static inline unsigned long l1e_get_pfn(l1_pgentry_t x)
+{
+    return (((x.l1_hi & 0x0fULL) << (32-PAGE_SHIFT))  |
+	     (x.l1_lo         >> PAGE_SHIFT));
+}
+static inline u64 l1e_get_phys(l1_pgentry_t x)
+{
+    return ((((u64)x.l1_hi & 0x0fULL) << 32)  |
+	     ((u64)x.l1_lo & PAGE_MASK));
+}
+static inline unsigned long l1e_get_flags(l1_pgentry_t x)
+{
+    return (x.l1_lo & ~PAGE_MASK);
+}
+
+static inline unsigned long l2e_get_pfn(l2_pgentry_t x)
+{
+    return (((x.l2_hi & 0x0fULL) << (32-PAGE_SHIFT))  |
+	     (x.l2_lo         >> PAGE_SHIFT));
+}
+static inline u64 l2e_get_phys(l2_pgentry_t x)
+{
+    return ((((u64)x.l2_hi & 0x0fULL) << 32)  |
+	     ((u64)x.l2_lo & PAGE_MASK));
+}
+static inline unsigned long l2e_get_flags(l2_pgentry_t x)
+{
+    return (x.l2_lo & ~PAGE_MASK);
+}
+
+static inline unsigned long l3e_get_pfn(l3_pgentry_t x)
+{
+    return (((x.l3_hi & 0x0fULL) << (32-PAGE_SHIFT))  |
+	     (x.l3_lo         >> PAGE_SHIFT));
+}
+static inline u64 l3e_get_phys(l3_pgentry_t x)
+{
+    return ((((u64)x.l3_hi & 0x0fULL) << 32)  |
+	     ((u64)x.l3_lo & PAGE_MASK));
+}
+static inline unsigned long l3e_get_flags(l3_pgentry_t x)
+{
+    return (x.l3_lo & ~PAGE_MASK);
+}
+
 
 /* write access */
 static inline l1_pgentry_t l1e_empty(void)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-05-17 21:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-13 11:16 [patch] convert page-l3.h macros to inlines Scott Parish
2005-05-13 12:12 ` Gerd Knorr
2005-05-13 13:36   ` Scott Parish
2005-05-13 13:57     ` Scott Parish
2005-05-13 16:25       ` Gerd Knorr
2005-05-13 17:48         ` Scott Parish
2005-05-17 21:48           ` Scott Parish

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.