blob: 84f2ae44b4e98ca1412ccfe5e60111cea60995f9 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Linus Torvalds1da177e2005-04-16 15:20:36 -07002 * S390 version
Heiko Carstensa53c8fa2012-07-20 11:15:04 +02003 * Copyright IBM Corp. 2002, 2006
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
5 */
6
7#ifndef _ASM_THREAD_INFO_H
8#define _ASM_THREAD_INFO_H
9
Heiko Carstens92778b92015-10-06 16:23:39 +020010#include <linux/const.h>
11
Linus Torvalds1da177e2005-04-16 15:20:36 -070012/*
13 * Size of kernel stack for each process
14 */
Linus Torvalds1da177e2005-04-16 15:20:36 -070015#define THREAD_ORDER 2
16#define ASYNC_ORDER 2
Linus Torvalds1da177e2005-04-16 15:20:36 -070017
18#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
19#define ASYNC_SIZE (PAGE_SIZE << ASYNC_ORDER)
20
21#ifndef __ASSEMBLY__
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <asm/lowcore.h>
Christian Ehrhardt25097bf2009-04-14 15:36:16 +020023#include <asm/page.h>
24#include <asm/processor.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
26/*
27 * low level task data that entry.S needs immediate access to
28 * - this struct should fit entirely inside of one cache line
29 * - this struct shares the supervisor stack pages
30 * - if the contents of this structure are changed, the assembly constants must also be changed
31 */
32struct thread_info {
33 struct task_struct *task; /* main task structure */
Linus Torvalds1da177e2005-04-16 15:20:36 -070034 unsigned long flags; /* low level flags */
Martin Schwidefsky61649882013-04-24 12:58:39 +020035 unsigned long sys_call_table; /* System call table address */
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 unsigned int cpu; /* current CPU */
Jesper Juhldcd497f2005-06-23 00:09:07 -070037 int preempt_count; /* 0 => preemptable, <0 => BUG */
Martin Schwidefsky20b40a72011-10-30 15:16:47 +010038 unsigned int system_call;
Martin Schwidefskyaa5e97c2008-12-31 15:11:39 +010039 __u64 user_timer;
40 __u64 system_timer;
Martin Schwidefsky86f25522010-05-17 10:00:05 +020041 unsigned long last_break; /* last breaking-event-address. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070042};
43
44/*
45 * macros/functions for gaining access to the thread information structure
46 */
47#define INIT_THREAD_INFO(tsk) \
48{ \
49 .task = &tsk, \
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 .flags = 0, \
51 .cpu = 0, \
Peter Zijlstrac99e6ef2009-07-10 14:57:56 +020052 .preempt_count = INIT_PREEMPT_COUNT, \
Linus Torvalds1da177e2005-04-16 15:20:36 -070053}
54
55#define init_thread_info (init_thread_union.thread_info)
56#define init_stack (init_thread_union.stack)
57
58/* how to get the thread information struct from C */
59static inline struct thread_info *current_thread_info(void)
60{
Martin Schwidefsky6432c012011-01-05 12:47:42 +010061 return (struct thread_info *) S390_lowcore.thread_info;
Linus Torvalds1da177e2005-04-16 15:20:36 -070062}
63
Heiko Carstens2a5e91c2015-03-16 12:46:38 +010064void arch_release_task_struct(struct task_struct *tsk);
Heiko Carstens521b00c2016-05-07 12:15:21 +020065int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
Heiko Carstens2a5e91c2015-03-16 12:46:38 +010066
FUJITA Tomonorib69c49b2008-07-25 01:45:40 -070067#define THREAD_SIZE_ORDER THREAD_ORDER
Linus Torvalds1da177e2005-04-16 15:20:36 -070068
69#endif
70
71/*
72 * thread information flags bit numbers
73 */
Martin Schwidefskyd3a73ac2014-04-15 12:55:07 +020074#define TIF_NOTIFY_RESUME 0 /* callback before returning to user */
75#define TIF_SIGPENDING 1 /* signal pending */
76#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
77#define TIF_SYSCALL_TRACE 3 /* syscall trace active */
78#define TIF_SYSCALL_AUDIT 4 /* syscall auditing active */
79#define TIF_SECCOMP 5 /* secure computing */
80#define TIF_SYSCALL_TRACEPOINT 6 /* syscall tracepoint instrumentation */
Jan Willeke2a0a5b22014-09-22 16:39:06 +020081#define TIF_UPROBE 7 /* breakpointed or single-stepping */
Martin Schwidefskya1f44e72018-04-27 07:36:46 +020082#define TIF_ISOLATE_BP 8 /* Run process with isolated BP */
83#define TIF_ISOLATE_BP_GUEST 9 /* Run KVM guests with isolated BP */
Martin Schwidefskyd3a73ac2014-04-15 12:55:07 +020084#define TIF_31BIT 16 /* 32bit process */
85#define TIF_MEMDIE 17 /* is terminating due to OOM killer */
86#define TIF_RESTORE_SIGMASK 18 /* restore signal mask in do_signal() */
87#define TIF_SINGLE_STEP 19 /* This task is single stepped */
88#define TIF_BLOCK_STEP 20 /* This task is block stepped */
Jan Willeke2a0a5b22014-09-22 16:39:06 +020089#define TIF_UPROBE_SINGLESTEP 21 /* This task is uprobe single stepped */
Linus Torvalds1da177e2005-04-16 15:20:36 -070090
Heiko Carstens92778b92015-10-06 16:23:39 +020091#define _TIF_NOTIFY_RESUME _BITUL(TIF_NOTIFY_RESUME)
92#define _TIF_SIGPENDING _BITUL(TIF_SIGPENDING)
93#define _TIF_NEED_RESCHED _BITUL(TIF_NEED_RESCHED)
94#define _TIF_SYSCALL_TRACE _BITUL(TIF_SYSCALL_TRACE)
95#define _TIF_SYSCALL_AUDIT _BITUL(TIF_SYSCALL_AUDIT)
96#define _TIF_SECCOMP _BITUL(TIF_SECCOMP)
97#define _TIF_SYSCALL_TRACEPOINT _BITUL(TIF_SYSCALL_TRACEPOINT)
98#define _TIF_UPROBE _BITUL(TIF_UPROBE)
Martin Schwidefskya1f44e72018-04-27 07:36:46 +020099#define _TIF_ISOLATE_BP _BITUL(TIF_ISOLATE_BP)
100#define _TIF_ISOLATE_BP_GUEST _BITUL(TIF_ISOLATE_BP_GUEST)
Heiko Carstens92778b92015-10-06 16:23:39 +0200101#define _TIF_31BIT _BITUL(TIF_31BIT)
102#define _TIF_SINGLE_STEP _BITUL(TIF_SINGLE_STEP)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700103
Linus Torvalds1da177e2005-04-16 15:20:36 -0700104#endif /* _ASM_THREAD_INFO_H */