#ifndef _LINUX_SCHED_TASK_STACK_H
#define _LINUX_SCHED_TASK_STACK_H
#include <linux/sched.h>
#include <linux/magic.h>
#include <linux/refcount.h>
#ifdef CONFIG_THREAD_INFO_IN_TASK
static __always_inline void *task_stack_page(const struct task_struct *task)
{ … }
#define setup_thread_stack(new,old) …
static __always_inline unsigned long *end_of_stack(const struct task_struct *task)
{ … }
#elif !defined(__HAVE_THREAD_FUNCTIONS)
#define task_stack_page …
static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org)
{
*task_thread_info(p) = *task_thread_info(org);
task_thread_info(p)->task = p;
}
static inline unsigned long *end_of_stack(struct task_struct *p)
{
#ifdef CONFIG_STACK_GROWSUP
return (unsigned long *)((unsigned long)task_thread_info(p) + THREAD_SIZE) - 1;
#else
return (unsigned long *)(task_thread_info(p) + 1);
#endif
}
#endif
#ifdef CONFIG_THREAD_INFO_IN_TASK
static inline void *try_get_task_stack(struct task_struct *tsk)
{ … }
extern void put_task_stack(struct task_struct *tsk);
#else
static inline void *try_get_task_stack(struct task_struct *tsk)
{
return task_stack_page(tsk);
}
static inline void put_task_stack(struct task_struct *tsk) {}
#endif
void exit_task_stack_account(struct task_struct *tsk);
#define task_stack_end_corrupted(task) …
static inline int object_is_on_stack(const void *obj)
{ … }
extern void thread_stack_cache_init(void);
#ifdef CONFIG_DEBUG_STACK_USAGE
unsigned long stack_not_used(struct task_struct *p);
#else
static inline unsigned long stack_not_used(struct task_struct *p)
{
return 0;
}
#endif
extern void set_task_stack_end_magic(struct task_struct *tsk);
#ifndef __HAVE_ARCH_KSTACK_END
static inline int kstack_end(void *addr)
{ … }
#endif
#endif