vmap_stack.h 769 B

12345678910111213141516171819202122232425262728
  1. // SPDX-License-Identifier: GPL-2.0
  2. // Copyright (C) 2017 Arm Ltd.
  3. #ifndef __ASM_VMAP_STACK_H
  4. #define __ASM_VMAP_STACK_H
  5. #include <linux/bug.h>
  6. #include <linux/gfp.h>
  7. #include <linux/kconfig.h>
  8. #include <linux/vmalloc.h>
  9. #include <asm/memory.h>
  10. #include <asm/pgtable.h>
  11. #include <asm/thread_info.h>
  12. /*
  13. * To ensure that VMAP'd stack overflow detection works correctly, all VMAP'd
  14. * stacks need to have the same alignment.
  15. */
  16. static inline unsigned long *arch_alloc_vmap_stack(size_t stack_size, int node)
  17. {
  18. BUILD_BUG_ON(!IS_ENABLED(CONFIG_VMAP_STACK));
  19. return __vmalloc_node_range(stack_size, THREAD_ALIGN,
  20. VMALLOC_START, VMALLOC_END,
  21. THREADINFO_GFP, PAGE_KERNEL, 0, node,
  22. __builtin_return_address(0));
  23. }
  24. #endif /* __ASM_VMAP_STACK_H */