···11+/*22+ * Thread support for the Hexagon architecture33+ *44+ * Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.55+ *66+ * This program is free software; you can redistribute it and/or modify77+ * it under the terms of the GNU General Public License version 2 and88+ * only version 2 as published by the Free Software Foundation.99+ *1010+ * This program is distributed in the hope that it will be useful,1111+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1212+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1313+ * GNU General Public License for more details.1414+ *1515+ * You should have received a copy of the GNU General Public License1616+ * along with this program; if not, write to the Free Software1717+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA1818+ * 02110-1301, USA.1919+ */2020+2121+#ifndef _ASM_THREAD_INFO_H2222+#define _ASM_THREAD_INFO_H2323+2424+#ifdef __KERNEL__2525+2626+#ifndef __ASSEMBLY__2727+#include <asm/processor.h>2828+#include <asm/registers.h>2929+#include <asm/page.h>3030+#endif3131+3232+#define THREAD_SHIFT 123333+#define THREAD_SIZE (1<<THREAD_SHIFT)3434+3535+#if THREAD_SHIFT >= PAGE_SHIFT3636+#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)3737+#else /* don't use standard allocator */3838+#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR3939+extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);4040+extern void free_thread_info(struct thread_info *ti);4141+#endif4242+4343+4444+#ifndef __ASSEMBLY__4545+4646+typedef struct {4747+ unsigned long seg;4848+} mm_segment_t;4949+5050+/*5151+ * This is union'd with the "bottom" of the kernel stack.5252+ * It keeps track of thread info which is handy for routines5353+ * to access quickly.5454+ */5555+5656+struct thread_info {5757+ struct task_struct *task; /* main task structure */5858+ struct exec_domain *exec_domain; /* execution domain */5959+ unsigned long flags; /* low level flags */6060+ __u32 cpu; /* current cpu */6161+ int preempt_count; /* 0=>preemptible,<0=>BUG */6262+ mm_segment_t addr_limit; /* segmentation sux */6363+ /*6464+ * used for syscalls somehow;6565+ * seems to have a function pointer and four arguments6666+ */6767+ struct restart_block restart_block;6868+ /* Points to the current pt_regs frame */6969+ struct pt_regs *regs;7070+ /*7171+ * saved kernel sp at switch_to time;7272+ * not sure if this is used (it's not in the VM model it seems;7373+ * see thread_struct)7474+ */7575+ unsigned long sp;7676+};7777+7878+#else /* !__ASSEMBLY__ */7979+8080+#include <asm/asm-offsets.h>8181+8282+#endif /* __ASSEMBLY__ */8383+8484+/* looks like "linux/hardirq.h" uses this. */8585+8686+#define PREEMPT_ACTIVE 0x100000008787+8888+#ifndef __ASSEMBLY__8989+9090+#define INIT_THREAD_INFO(tsk) \9191+{ \9292+ .task = &tsk, \9393+ .exec_domain = &default_exec_domain, \9494+ .flags = 0, \9595+ .cpu = 0, \9696+ .preempt_count = 1, \9797+ .addr_limit = KERNEL_DS, \9898+ .restart_block = { \9999+ .fn = do_no_restart_syscall, \100100+ }, \101101+ .sp = 0, \102102+ .regs = NULL, \103103+}104104+105105+#define init_thread_info (init_thread_union.thread_info)106106+#define init_stack (init_thread_union.stack)107107+108108+/* Tacky preprocessor trickery */109109+#define qqstr(s) qstr(s)110110+#define qstr(s) #s111111+#define QUOTED_THREADINFO_REG qqstr(THREADINFO_REG)112112+113113+register struct thread_info *__current_thread_info asm(QUOTED_THREADINFO_REG);114114+#define current_thread_info() __current_thread_info115115+116116+#endif /* __ASSEMBLY__ */117117+118118+/*119119+ * thread information flags120120+ * - these are process state flags that various assembly files121121+ * may need to access122122+ * - pending work-to-be-done flags are in LSW123123+ * - other flags in MSW124124+ */125125+126126+#define TIF_SYSCALL_TRACE 0 /* syscall trace active */127127+#define TIF_NOTIFY_RESUME 1 /* resumption notification requested */128128+#define TIF_SIGPENDING 2 /* signal pending */129129+#define TIF_NEED_RESCHED 3 /* rescheduling necessary */130130+#define TIF_SINGLESTEP 4 /* restore ss @ return to usr mode */131131+#define TIF_IRET 5 /* return with iret */132132+#define TIF_RESTORE_SIGMASK 6 /* restore sig mask in do_signal() */133133+/* true if poll_idle() is polling TIF_NEED_RESCHED */134134+#define TIF_POLLING_NRFLAG 16135135+#define TIF_MEMDIE 17 /* OOM killer killed process */136136+137137+#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)138138+#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)139139+#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)140140+#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)141141+#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)142142+#define _TIF_IRET (1 << TIF_IRET)143143+#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)144144+#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)145145+146146+/* work to do on interrupt/exception return - All but TIF_SYSCALL_TRACE */147147+#define _TIF_WORK_MASK (0x0000FFFF & ~_TIF_SYSCALL_TRACE)148148+149149+/* work to do on any return to u-space */150150+#define _TIF_ALLWORK_MASK 0x0000FFFF151151+152152+#endif /* __KERNEL__ */153153+154154+#endif