summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_page.h
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-11-05 08:20:32 +0000
committerkib <kib@FreeBSD.org>2011-11-05 08:20:32 +0000
commit91c9020e204a60fe6696c11e641e4766935bc954 (patch)
tree9ee35faf0b40236dc5aff1237e5edd9bdf0375ce /sys/vm/vm_page.h
parentaf1e42f3663dcd8159beaaa0859821132e24b852 (diff)
downloadFreeBSD-src-91c9020e204a60fe6696c11e641e4766935bc954.zip
FreeBSD-src-91c9020e204a60fe6696c11e641e4766935bc954.tar.gz
Provide typedefs for the type of bit mask for the page bits.
Use the defined types instead of int when manipulating masks. Supposedly, it could fix support for 32KB page size in the machine-independend VM layer. Reviewed by: alc MFC after: 2 weeks
Diffstat (limited to 'sys/vm/vm_page.h')
-rw-r--r--sys/vm/vm_page.h32
1 files changed, 17 insertions, 15 deletions
diff --git a/sys/vm/vm_page.h b/sys/vm/vm_page.h
index 23637bb..e3eb08c 100644
--- a/sys/vm/vm_page.h
+++ b/sys/vm/vm_page.h
@@ -113,6 +113,20 @@
TAILQ_HEAD(pglist, vm_page);
+#if PAGE_SIZE == 4096
+#define VM_PAGE_BITS_ALL 0xffu
+typedef uint8_t vm_page_bits_t;
+#elif PAGE_SIZE == 8192
+#define VM_PAGE_BITS_ALL 0xffffu
+typedef uint16_t vm_page_bits_t;
+#elif PAGE_SIZE == 16384
+#define VM_PAGE_BITS_ALL 0xffffffffu
+typedef uint32_t vm_page_bits_t;
+#elif PAGE_SIZE == 32768
+#define VM_PAGE_BITS_ALL 0xfffffffffffffffflu
+typedef uint64_t vm_page_bits_t;
+#endif
+
struct vm_page {
TAILQ_ENTRY(vm_page) pageq; /* queue info for FIFO queue or free list (Q) */
TAILQ_ENTRY(vm_page) listq; /* pages in same object (O) */
@@ -137,20 +151,8 @@ struct vm_page {
u_char busy; /* page busy count (O) */
/* NOTE that these must support one bit per DEV_BSIZE in a page!!! */
/* so, on normal X86 kernels, they must be at least 8 bits wide */
- /* In reality, support for 32KB pages is not fully implemented. */
-#if PAGE_SIZE == 4096
- uint8_t valid; /* map of valid DEV_BSIZE chunks (O) */
- uint8_t dirty; /* map of dirty DEV_BSIZE chunks (M) */
-#elif PAGE_SIZE == 8192
- uint16_t valid; /* map of valid DEV_BSIZE chunks (O) */
- uint16_t dirty; /* map of dirty DEV_BSIZE chunks (M) */
-#elif PAGE_SIZE == 16384
- uint32_t valid; /* map of valid DEV_BSIZE chunks (O) */
- uint32_t dirty; /* map of dirty DEV_BSIZE chunks (M) */
-#elif PAGE_SIZE == 32768
- uint64_t valid; /* map of valid DEV_BSIZE chunks (O) */
- uint64_t dirty; /* map of dirty DEV_BSIZE chunks (M) */
-#endif
+ vm_page_bits_t valid; /* map of valid DEV_BSIZE chunks (O) */
+ vm_page_bits_t dirty; /* map of dirty DEV_BSIZE chunks (M) */
};
/*
@@ -403,7 +405,7 @@ void vm_page_clear_dirty (vm_page_t, int, int);
void vm_page_set_invalid (vm_page_t, int, int);
int vm_page_is_valid (vm_page_t, int, int);
void vm_page_test_dirty (vm_page_t);
-int vm_page_bits (int, int);
+vm_page_bits_t vm_page_bits(int base, int size);
void vm_page_zero_invalid(vm_page_t m, boolean_t setvalid);
void vm_page_free_toq(vm_page_t m);
void vm_page_zero_idle_wakeup(void);
OpenPOWER on IntegriCloud