[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PATCH: page related functions
From: |
Johan Rydberg |
Subject: |
PATCH: page related functions |
Date: |
Mon, 20 Oct 2003 00:27:40 +0200 |
Hi,
I would really love for this functions to make it into libl4.
I don't know if kip.h is the right place, but I put them next
to the other page related functions.
2003-10-20 Johan Rydberg <address@hidden>
* l4/kip.h (l4_page_trunc): New function.
(l4_page_round): Likewise.
(l4_atop): Likewise.
(l4_ptoa): Likewise.
Index: kip.h
===================================================================
RCS file: /cvsroot/hurd/hurd-l4/libl4/l4/kip.h,v
retrieving revision 1.7
diff -u -p -r1.7 kip.h
--- kip.h 5 Oct 2003 21:58:43 -0000 1.7
+++ kip.h 19 Oct 2003 22:22:35 -0000
@@ -470,6 +468,34 @@ l4_min_page_size (void)
return L4_WORD_C(1) << l4_min_page_size_log2 ();
}
+static inline l4_word_t
+__attribute__((__always_inline__))
+l4_page_trunc (l4_word_t addr)
+{
+ return (addr & ~(l4_min_page_size () - 1));
+}
+
+static inline l4_word_t
+__attribute__((__always_inline__))
+l4_page_round (l4_word_t addr)
+{
+ return ((addr + (l4_min_page_size () - 1))
+ & ~(l4_min_page_size () - 1));
+}
+
+static inline l4_word_t
+__attribute__((__always_inline__))
+l4_atop (l4_word_t addr)
+{
+ return ((addr) >> l4_min_page_size_log2 ());
+}
+
+static inline l4_word_t
+__attribute__((__always_inline__))
+l4_ptoa (l4_word_t p)
+{
+ return ((p) << l4_min_page_size_log2 ());
+}
static inline l4_page_info_t
__attribute__((__always_inline__))
- PATCH: page related functions,
Johan Rydberg <=