xref: /linux/kernel/bounds.c (revision 7b8e9264f55a9c320f398e337d215e68cca50131)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Generate definitions needed by the preprocessor.
4  * This code generates raw asm output which is post-processed
5  * to extract and format the required data.
6  */
7 
8 #define __GENERATING_BOUNDS_H
9 #define COMPILE_OFFSETS
10 /* Include headers that define the enum constants of interest */
11 #include <linux/page-flags.h>
12 #include <linux/mmzone.h>
13 #include <linux/kbuild.h>
14 #include <linux/log2.h>
15 #include <linux/spinlock_types.h>
16 
17 int main(void)
18 {
19 	/* The enum constants to put into include/generated/bounds.h */
20 	DEFINE(NR_PAGEFLAGS, __NR_PAGEFLAGS);
21 	DEFINE(MAX_NR_ZONES, __MAX_NR_ZONES);
22 #ifdef CONFIG_SMP
23 	DEFINE(NR_CPUS_BITS, order_base_2(CONFIG_NR_CPUS));
24 #endif
25 	DEFINE(SPINLOCK_SIZE, sizeof(spinlock_t));
26 #ifdef CONFIG_LRU_GEN
27 	DEFINE(LRU_GEN_WIDTH, order_base_2(MAX_NR_GENS + 1));
28 	DEFINE(__LRU_REFS_WIDTH, MAX_NR_TIERS - 2);
29 #else
30 	DEFINE(LRU_GEN_WIDTH, 0);
31 	DEFINE(__LRU_REFS_WIDTH, 0);
32 #endif
33 	/* End of constants */
34 
35 	return 0;
36 }
37