]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Common header file change not applicable to open-vm-tools.
authorJohn Wolfe <jwolfe@vmware.com>
Mon, 22 Feb 2021 17:37:00 +0000 (09:37 -0800)
committerJohn Wolfe <jwolfe@vmware.com>
Mon, 22 Feb 2021 17:37:00 +0000 (09:37 -0800)
open-vm-tools/lib/include/vm_basic_defs.h

index f7c3cd9f0552687d3b939524753ea8dd7f9d20c3..ce3502aa45e50bbf1455ccf6df3a9174efc361f2 100644 (file)
@@ -248,32 +248,44 @@ Max(int a, int b)
  * -- edward
  */
 
+#define PAGE_SHIFT_4KB   12
+#define PAGE_SHIFT_16KB  14
+
 #ifndef PAGE_SHIFT // {
 #if defined __x86_64__ || defined __i386__
-   #define PAGE_SHIFT    12
+   #define PAGE_SHIFT    PAGE_SHIFT_4KB
 #elif defined __APPLE__
    #if defined VM_ARM_ANY
-      #define PAGE_SHIFT    14
+      #define PAGE_SHIFT    PAGE_SHIFT_16KB
    #else
-      #define PAGE_SHIFT    12
+      #define PAGE_SHIFT    PAGE_SHIFT_4KB
    #endif
 #elif defined VM_ARM_64
-   #define PAGE_SHIFT    12
+   #define PAGE_SHIFT    PAGE_SHIFT_4KB
 #elif defined __arm__
-   #define PAGE_SHIFT    12
+   #define PAGE_SHIFT    PAGE_SHIFT_4KB
 #else
    #error
 #endif
 #endif // }
 
+#define PAGE_SIZE_4KB    (1 << PAGE_SHIFT_4KB)
+#define PAGE_SIZE_16KB   (1 << PAGE_SHIFT_16KB)
+
 #ifndef PAGE_SIZE
 #define PAGE_SIZE     (1 << PAGE_SHIFT)
 #endif
 
+#define PAGE_MASK_4KB    (PAGE_SIZE_4KB - 1)
+#define PAGE_MASK_16KB   (PAGE_SIZE_16KB - 1)
+
 #ifndef PAGE_MASK
 #define PAGE_MASK     (PAGE_SIZE - 1)
 #endif
 
+#define PAGE_OFFSET_4KB(_addr)   ((uintptr_t)(_addr) & (PAGE_SIZE_4KB - 1))
+#define PAGE_OFFSET_16KB(_addr)  ((uintptr_t)(_addr) & (PAGE_SIZE_16KB - 1))
+
 #ifndef PAGE_OFFSET
 #define PAGE_OFFSET(_addr)  ((uintptr_t)(_addr) & (PAGE_SIZE - 1))
 #endif
@@ -398,14 +410,6 @@ Max(int a, int b)
 #define VM_1GB_2_PDIRS (VM_1GB_PAGE_SIZE / VM_PAE_LARGE_PAGE_SIZE)
 #endif
 
-#define PAGE_SIZE_4KB    0x1000
-#define PAGE_MASK_4KB    (PAGE_SIZE_4KB - 1)
-#define PAGE_SHIFT_4KB   12
-
-#define PAGE_SIZE_16KB   0x4000
-#define PAGE_MASK_16KB   (PAGE_SIZE_16KB - 1)
-#define PAGE_SHIFT_16KB  14
-
 /*
  * Word operations
  */