xref: /linux/arch/x86/include/asm/sections.h (revision 68f0f2690e183306b52671a9ad09fb31808b0500)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _ASM_X86_SECTIONS_H
3 #define _ASM_X86_SECTIONS_H
4 
5 #define arch_is_kernel_initmem_freed arch_is_kernel_initmem_freed
6 
7 #include <asm-generic/sections.h>
8 #include <asm/extable.h>
9 
10 extern char __brk_base[], __brk_limit[];
11 extern char __end_rodata_aligned[];
12 
13 #if defined(CONFIG_X86_64)
14 extern char __end_rodata_hpage_align[];
15 #endif
16 
17 extern char __end_of_kernel_reserve[];
18 
19 extern unsigned long _brk_start, _brk_end;
20 
21 static inline bool arch_is_kernel_initmem_freed(unsigned long addr)
22 {
23 	/*
24 	 * If _brk_start has not been cleared, brk allocation is incomplete,
25 	 * and we can not make assumptions about its use.
26 	 */
27 	if (_brk_start)
28 		return 0;
29 
30 	/*
31 	 * After brk allocation is complete, space between _brk_end and _end
32 	 * is available for allocation.
33 	 */
34 	return addr >= _brk_end && addr < (unsigned long)&_end;
35 }
36 
37 #endif	/* _ASM_X86_SECTIONS_H */
38