blob: 229475f0d7ce0a700619848c9525d2c24e77d591 [file] [log] [blame]
Sam Ravnborgf5e706a2008-07-17 21:55:51 -07001/*
2 * thread_info.h: sparc low-level thread information
3 * adapted from the ppc version by Pete Zaitcev, which was
4 * adapted from the i386 version by Paul Mackerras
5 *
6 * Copyright (C) 2002 David Howells (dhowells@redhat.com)
7 * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
8 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
9 */
10
11#ifndef _ASM_THREAD_INFO_H
12#define _ASM_THREAD_INFO_H
13
14#ifdef __KERNEL__
15
16#ifndef __ASSEMBLY__
17
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070018#include <asm/ptrace.h>
19#include <asm/page.h>
20
21/*
22 * Low level task data.
23 *
24 * If you change this, change the TI_* offsets below to match.
25 */
26#define NSWINS 8
27struct thread_info {
28 unsigned long uwinmask;
29 struct task_struct *task; /* main task structure */
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070030 unsigned long flags; /* low level flags */
31 int cpu; /* cpu we're on */
32 int preempt_count; /* 0 => preemptable,
33 <0 => BUG */
34 int softirq_count;
35 int hardirq_count;
36
Guenter Roeck720d7072015-04-11 19:58:25 -070037 u32 __unused;
38
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070039 /* Context switch saved kernel state. */
40 unsigned long ksp; /* ... ksp __attribute__ ((aligned (8))); */
41 unsigned long kpc;
42 unsigned long kpsr;
43 unsigned long kwim;
44
45 /* A place to store user windows and stack pointers
46 * when the stack needs inspection.
47 */
Sam Ravnborg4d7b92a2009-01-02 19:32:59 -080048 struct reg_window32 reg_window[NSWINS]; /* align for ldd! */
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070049 unsigned long rwbuf_stkptrs[NSWINS];
50 unsigned long w_saved;
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070051};
52
53/*
54 * macros/functions for gaining access to the thread information structure
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070055 */
56#define INIT_THREAD_INFO(tsk) \
57{ \
58 .uwinmask = 0, \
59 .task = &tsk, \
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070060 .flags = 0, \
61 .cpu = 0, \
Peter Zijlstrac99e6ef2009-07-10 14:57:56 +020062 .preempt_count = INIT_PREEMPT_COUNT, \
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070063}
64
65#define init_thread_info (init_thread_union.thread_info)
66#define init_stack (init_thread_union.stack)
67
68/* how to get the thread information struct from C */
69register struct thread_info *current_thread_info_reg asm("g6");
70#define current_thread_info() (current_thread_info_reg)
71
72/*
73 * thread information allocation
74 */
Sam Ravnborg29af0eb2012-05-22 16:39:00 +020075#define THREAD_SIZE_ORDER 1
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070076
77#endif /* __ASSEMBLY__ */
78
Sam Ravnborg29af0eb2012-05-22 16:39:00 +020079/* Size of kernel stack for each process */
Sam Ravnborga4b4f432011-12-29 15:04:38 +010080#define THREAD_SIZE (2 * PAGE_SIZE)
Sam Ravnborgf5e706a2008-07-17 21:55:51 -070081
82/*
83 * Offsets in thread_info structure, used in assembly code
84 * The "#define REGWIN_SZ 0x40" was abolished, so no multiplications.
85 */
86#define TI_UWINMASK 0x00 /* uwinmask */
87#define TI_TASK 0x04
Richard Weinberger14464772014-07-13 17:39:47 +020088#define TI_FLAGS 0x08
89#define TI_CPU 0x0c
90#define TI_PREEMPT 0x10 /* preempt_count */
91#define TI_SOFTIRQ 0x14 /* softirq_count */
92#define TI_HARDIRQ 0x18 /* hardirq_count */
Guenter Roeck720d7072015-04-11 19:58:25 -070093#define TI_KSP 0x20 /* ksp */
94#define TI_KPC 0x24 /* kpc (ldd'ed with kpc) */
95#define TI_KPSR 0x28 /* kpsr */
96#define TI_KWIM 0x2c /* kwim (ldd'ed with kpsr) */
97#define TI_REG_WINDOW 0x30
98#define TI_RWIN_SPTRS 0x230
99#define TI_W_SAVED 0x250
Sam Ravnborgf5e706a2008-07-17 21:55:51 -0700100
Sam Ravnborgf5e706a2008-07-17 21:55:51 -0700101/*
102 * thread information flag bit numbers
103 */
104#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
David S. Miller5a157d52008-07-27 03:38:53 -0700105#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
Sam Ravnborgf5e706a2008-07-17 21:55:51 -0700106#define TIF_SIGPENDING 2 /* signal pending */
107#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
108#define TIF_RESTORE_SIGMASK 4 /* restore signal mask in do_signal() */
109#define TIF_USEDFPU 8 /* FPU was used by this task
110 * this quantum (SMP) */
111#define TIF_POLLING_NRFLAG 9 /* true if poll_idle() is polling
112 * TIF_NEED_RESCHED */
Andreas Dilger0ddc9322010-05-14 11:13:27 +0200113#define TIF_MEMDIE 10 /* is terminating due to OOM killer */
Sam Ravnborgf5e706a2008-07-17 21:55:51 -0700114
115/* as above, but as bit values */
116#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
David S. Miller5a157d52008-07-27 03:38:53 -0700117#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
Sam Ravnborgf5e706a2008-07-17 21:55:51 -0700118#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
119#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
Sam Ravnborgf5e706a2008-07-17 21:55:51 -0700120#define _TIF_USEDFPU (1<<TIF_USEDFPU)
121#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
122
David S. Miller5a157d52008-07-27 03:38:53 -0700123#define _TIF_DO_NOTIFY_RESUME_MASK (_TIF_NOTIFY_RESUME | \
Al Viro6fd84c02012-05-23 15:28:58 -0400124 _TIF_SIGPENDING)
David S. Miller5a157d52008-07-27 03:38:53 -0700125
Eric Parisa17c8b52014-04-22 12:39:51 -0400126#define is_32bit_task() (1)
127
Sam Ravnborgf5e706a2008-07-17 21:55:51 -0700128#endif /* __KERNEL__ */
129
130#endif /* _ASM_THREAD_INFO_H */