Back to home page

OSCL-LXR

 
 

    


0001 #ifndef _ASM_GENERIC_HUGETLB_ENCODE_H_
0002 #define _ASM_GENERIC_HUGETLB_ENCODE_H_
0003 
0004 /*
0005  * Several system calls take a flag to request "hugetlb" huge pages.
0006  * Without further specification, these system calls will use the
0007  * system's default huge page size.  If a system supports multiple
0008  * huge page sizes, the desired huge page size can be specified in
0009  * bits [26:31] of the flag arguments.  The value in these 6 bits
0010  * will encode the log2 of the huge page size.
0011  *
0012  * The following definitions are associated with this huge page size
0013  * encoding in flag arguments.  System call specific header files
0014  * that use this encoding should include this file.  They can then
0015  * provide definitions based on these with their own specific prefix.
0016  * for example:
0017  * #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
0018  */
0019 
0020 #define HUGETLB_FLAG_ENCODE_SHIFT   26
0021 #define HUGETLB_FLAG_ENCODE_MASK    0x3f
0022 
0023 #define HUGETLB_FLAG_ENCODE_16KB    (14 << HUGETLB_FLAG_ENCODE_SHIFT)
0024 #define HUGETLB_FLAG_ENCODE_64KB    (16 << HUGETLB_FLAG_ENCODE_SHIFT)
0025 #define HUGETLB_FLAG_ENCODE_512KB   (19 << HUGETLB_FLAG_ENCODE_SHIFT)
0026 #define HUGETLB_FLAG_ENCODE_1MB     (20 << HUGETLB_FLAG_ENCODE_SHIFT)
0027 #define HUGETLB_FLAG_ENCODE_2MB     (21 << HUGETLB_FLAG_ENCODE_SHIFT)
0028 #define HUGETLB_FLAG_ENCODE_8MB     (23 << HUGETLB_FLAG_ENCODE_SHIFT)
0029 #define HUGETLB_FLAG_ENCODE_16MB    (24 << HUGETLB_FLAG_ENCODE_SHIFT)
0030 #define HUGETLB_FLAG_ENCODE_32MB    (25 << HUGETLB_FLAG_ENCODE_SHIFT)
0031 #define HUGETLB_FLAG_ENCODE_256MB   (28 << HUGETLB_FLAG_ENCODE_SHIFT)
0032 #define HUGETLB_FLAG_ENCODE_512MB   (29 << HUGETLB_FLAG_ENCODE_SHIFT)
0033 #define HUGETLB_FLAG_ENCODE_1GB     (30 << HUGETLB_FLAG_ENCODE_SHIFT)
0034 #define HUGETLB_FLAG_ENCODE_2GB     (31 << HUGETLB_FLAG_ENCODE_SHIFT)
0035 #define HUGETLB_FLAG_ENCODE_16GB    (34 << HUGETLB_FLAG_ENCODE_SHIFT)
0036 
0037 #endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */