sections.h 833 B

123456789101112131415161718192021222324252627282930313233
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (C) 2020 Western Digital Corporation or its affiliates.
  4. */
  5. #ifndef __ASM_SECTIONS_H
  6. #define __ASM_SECTIONS_H
  7. #include <asm-generic/sections.h>
  8. #include <linux/mm.h>
  9. extern char _start[];
  10. extern char _start_kernel[];
  11. extern char __init_data_begin[], __init_data_end[];
  12. extern char __init_text_begin[], __init_text_end[];
  13. extern char __alt_start[], __alt_end[];
  14. static inline bool is_va_kernel_text(uintptr_t va)
  15. {
  16. uintptr_t start = (uintptr_t)_start;
  17. uintptr_t end = (uintptr_t)__init_data_begin;
  18. return va >= start && va < end;
  19. }
  20. static inline bool is_va_kernel_lm_alias_text(uintptr_t va)
  21. {
  22. uintptr_t start = (uintptr_t)lm_alias(_start);
  23. uintptr_t end = (uintptr_t)lm_alias(__init_data_begin);
  24. return va >= start && va < end;
  25. }
  26. #endif /* __ASM_SECTIONS_H */