blob: f3e5cad93b26b39fec25e55a192d2015212a6d86 [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
Linus Torvalds1da177e2005-04-16 15:20:36 -070010/*
11 * Size of kernel stack for each process
12 */
Heiko Carstensf4815ac2012-05-23 16:24:51 +020013#ifndef CONFIG_64BIT
Linus Torvalds1da177e2005-04-16 15:20:36 -070014#define THREAD_ORDER 1
15#define ASYNC_ORDER 1
Heiko Carstensf4815ac2012-05-23 16:24:51 +020016#else /* CONFIG_64BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#define THREAD_ORDER 2
18#define ASYNC_ORDER 2
Heiko Carstensf4815ac2012-05-23 16:24:51 +020019#endif /* CONFIG_64BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070020
21#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
22#define ASYNC_SIZE (PAGE_SIZE << ASYNC_ORDER)
23
24#ifndef __ASSEMBLY__
Linus Torvalds1da177e2005-04-16 15:20:36 -070025#include <asm/lowcore.h>
Christian Ehrhardt25097bf2009-04-14 15:36:16 +020026#include <asm/page.h>
27#include <asm/processor.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070028
29/*
30 * low level task data that entry.S needs immediate access to
31 * - this struct should fit entirely inside of one cache line
32 * - this struct shares the supervisor stack pages
33 * - if the contents of this structure are changed, the assembly constants must also be changed
34 */
35struct thread_info {
36 struct task_struct *task; /* main task structure */
37 struct exec_domain *exec_domain; /* execution domain */
38 unsigned long flags; /* low level flags */
Martin Schwidefsky61649882013-04-24 12:58:39 +020039 unsigned long sys_call_table; /* System call table address */
Linus Torvalds1da177e2005-04-16 15:20:36 -070040 unsigned int cpu; /* current CPU */
Jesper Juhldcd497f2005-06-23 00:09:07 -070041 int preempt_count; /* 0 => preemptable, <0 => BUG */
Linus Torvalds1da177e2005-04-16 15:20:36 -070042 struct restart_block restart_block;
Martin Schwidefsky20b40a72011-10-30 15:16:47 +010043 unsigned int system_call;
Martin Schwidefskyaa5e97c2008-12-31 15:11:39 +010044 __u64 user_timer;
45 __u64 system_timer;
Martin Schwidefsky86f25522010-05-17 10:00:05 +020046 unsigned long last_break; /* last breaking-event-address. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070047};
48
49/*
50 * macros/functions for gaining access to the thread information structure
51 */
52#define INIT_THREAD_INFO(tsk) \
53{ \
54 .task = &tsk, \
55 .exec_domain = &default_exec_domain, \
56 .flags = 0, \
57 .cpu = 0, \
Peter Zijlstrac99e6ef2009-07-10 14:57:56 +020058 .preempt_count = INIT_PREEMPT_COUNT, \
Linus Torvalds1da177e2005-04-16 15:20:36 -070059 .restart_block = { \
60 .fn = do_no_restart_syscall, \
61 }, \
62}
63
64#define init_thread_info (init_thread_union.thread_info)
65#define init_stack (init_thread_union.stack)
66
67/* how to get the thread information struct from C */
68static inline struct thread_info *current_thread_info(void)
69{
Martin Schwidefsky6432c012011-01-05 12:47:42 +010070 return (struct thread_info *) S390_lowcore.thread_info;
Linus Torvalds1da177e2005-04-16 15:20:36 -070071}
72
FUJITA Tomonorib69c49b2008-07-25 01:45:40 -070073#define THREAD_SIZE_ORDER THREAD_ORDER
Linus Torvalds1da177e2005-04-16 15:20:36 -070074
75#endif
76
77/*
78 * thread information flags bit numbers
79 */
Martin Schwidefskyb6ef5bb2011-10-30 15:16:49 +010080#define TIF_SYSCALL 0 /* inside a system call */
Martin Schwidefsky753c4dd2008-10-10 21:33:20 +020081#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
Linus Torvalds1da177e2005-04-16 15:20:36 -070082#define TIF_SIGPENDING 2 /* signal pending */
83#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
Martin Schwidefskybeef5602014-04-14 15:11:26 +020084#define TIF_ASCE 5 /* user asce needs fixup / uaccess */
Martin Schwidefsky5e9a2692011-01-05 12:48:10 +010085#define TIF_PER_TRAP 6 /* deliver sigtrap on return to user */
Heiko Carstens77fa2242005-06-25 14:55:30 -070086#define TIF_MCCK_PENDING 7 /* machine check handling is pending */
Heiko Carstensbcf5cef2009-06-12 10:26:26 +020087#define TIF_SYSCALL_TRACE 8 /* syscall trace active */
88#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
89#define TIF_SECCOMP 10 /* secure computing */
Josh Stone66700002009-08-24 14:43:11 -070090#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */
Martin Schwidefskybebf0232010-01-13 20:44:28 +010091#define TIF_31BIT 17 /* 32bit process */
Andreas Dilger0ddc9322010-05-14 11:13:27 +020092#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
Martin Schwidefskybebf0232010-01-13 20:44:28 +010093#define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */
Martin Schwidefsky5e9a2692011-01-05 12:48:10 +010094#define TIF_SINGLE_STEP 20 /* This task is single stepped */
Martin Schwidefsky818a3302014-03-14 12:01:08 +010095#define TIF_BLOCK_STEP 21 /* This task is block stepped */
Linus Torvalds1da177e2005-04-16 15:20:36 -070096
Martin Schwidefskyb6ef5bb2011-10-30 15:16:49 +010097#define _TIF_SYSCALL (1<<TIF_SYSCALL)
Martin Schwidefsky753c4dd2008-10-10 21:33:20 +020098#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
Linus Torvalds1da177e2005-04-16 15:20:36 -070099#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
100#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
Heiko Carstens457f2182014-03-21 10:42:25 +0100101#define _TIF_ASCE (1<<TIF_ASCE)
Martin Schwidefsky5e9a2692011-01-05 12:48:10 +0100102#define _TIF_PER_TRAP (1<<TIF_PER_TRAP)
Heiko Carstens77fa2242005-06-25 14:55:30 -0700103#define _TIF_MCCK_PENDING (1<<TIF_MCCK_PENDING)
Heiko Carstensbcf5cef2009-06-12 10:26:26 +0200104#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
105#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
106#define _TIF_SECCOMP (1<<TIF_SECCOMP)
Josh Stone66700002009-08-24 14:43:11 -0700107#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108#define _TIF_31BIT (1<<TIF_31BIT)
Tejun Heo80853a82011-10-30 15:16:35 +0100109#define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110
Heiko Carstensa05c90f2011-01-12 09:55:29 +0100111#ifdef CONFIG_64BIT
112#define is_32bit_task() (test_thread_flag(TIF_31BIT))
113#else
114#define is_32bit_task() (1)
115#endif
116
Linus Torvalds1da177e2005-04-16 15:20:36 -0700117#endif /* _ASM_THREAD_INFO_H */