Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 // Copyright (C) 2017 Arm Ltd.
0003 #ifndef __ASM_VMAP_STACK_H
0004 #define __ASM_VMAP_STACK_H
0005 
0006 #include <linux/bug.h>
0007 #include <linux/gfp.h>
0008 #include <linux/kconfig.h>
0009 #include <linux/vmalloc.h>
0010 #include <linux/pgtable.h>
0011 #include <asm/memory.h>
0012 #include <asm/thread_info.h>
0013 
0014 /*
0015  * To ensure that VMAP'd stack overflow detection works correctly, all VMAP'd
0016  * stacks need to have the same alignment.
0017  */
0018 static inline unsigned long *arch_alloc_vmap_stack(size_t stack_size, int node)
0019 {
0020     void *p;
0021 
0022     BUILD_BUG_ON(!IS_ENABLED(CONFIG_VMAP_STACK));
0023 
0024     p = __vmalloc_node(stack_size, THREAD_ALIGN, THREADINFO_GFP, node,
0025             __builtin_return_address(0));
0026     return kasan_reset_tag(p);
0027 }
0028 
0029 #endif /* __ASM_VMAP_STACK_H */