blob: 51035e5d86cbe7319b07dc570fbb4af131f51cdc [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#ifndef __SMALL_STACK
18#define THREAD_ORDER 2
19#define ASYNC_ORDER 2
20#else
21#define THREAD_ORDER 1
22#define ASYNC_ORDER 1
23#endif
Heiko Carstensf4815ac2012-05-23 16:24:51 +020024#endif /* CONFIG_64BIT */
Linus Torvalds1da177e2005-04-16 15:20:36 -070025
26#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER)
27#define ASYNC_SIZE (PAGE_SIZE << ASYNC_ORDER)
28
29#ifndef __ASSEMBLY__
Linus Torvalds1da177e2005-04-16 15:20:36 -070030#include <asm/lowcore.h>
Christian Ehrhardt25097bf2009-04-14 15:36:16 +020031#include <asm/page.h>
32#include <asm/processor.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070033
34/*
35 * low level task data that entry.S needs immediate access to
36 * - this struct should fit entirely inside of one cache line
37 * - this struct shares the supervisor stack pages
38 * - if the contents of this structure are changed, the assembly constants must also be changed
39 */
40struct thread_info {
41 struct task_struct *task; /* main task structure */
42 struct exec_domain *exec_domain; /* execution domain */
43 unsigned long flags; /* low level flags */
Martin Schwidefsky61649882013-04-24 12:58:39 +020044 unsigned long sys_call_table; /* System call table address */
Linus Torvalds1da177e2005-04-16 15:20:36 -070045 unsigned int cpu; /* current CPU */
Jesper Juhldcd497f2005-06-23 00:09:07 -070046 int preempt_count; /* 0 => preemptable, <0 => BUG */
Linus Torvalds1da177e2005-04-16 15:20:36 -070047 struct restart_block restart_block;
Martin Schwidefsky20b40a72011-10-30 15:16:47 +010048 unsigned int system_call;
Martin Schwidefskyaa5e97c2008-12-31 15:11:39 +010049 __u64 user_timer;
50 __u64 system_timer;
Martin Schwidefsky86f25522010-05-17 10:00:05 +020051 unsigned long last_break; /* last breaking-event-address. */
Linus Torvalds1da177e2005-04-16 15:20:36 -070052};
53
54/*
55 * macros/functions for gaining access to the thread information structure
56 */
57#define INIT_THREAD_INFO(tsk) \
58{ \
59 .task = &tsk, \
60 .exec_domain = &default_exec_domain, \
61 .flags = 0, \
62 .cpu = 0, \
Peter Zijlstrac99e6ef2009-07-10 14:57:56 +020063 .preempt_count = INIT_PREEMPT_COUNT, \
Linus Torvalds1da177e2005-04-16 15:20:36 -070064 .restart_block = { \
65 .fn = do_no_restart_syscall, \
66 }, \
67}
68
69#define init_thread_info (init_thread_union.thread_info)
70#define init_stack (init_thread_union.stack)
71
72/* how to get the thread information struct from C */
73static inline struct thread_info *current_thread_info(void)
74{
Martin Schwidefsky6432c012011-01-05 12:47:42 +010075 return (struct thread_info *) S390_lowcore.thread_info;
Linus Torvalds1da177e2005-04-16 15:20:36 -070076}
77
FUJITA Tomonorib69c49b2008-07-25 01:45:40 -070078#define THREAD_SIZE_ORDER THREAD_ORDER
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
80#endif
81
82/*
83 * thread information flags bit numbers
84 */
Martin Schwidefskyb6ef5bb2011-10-30 15:16:49 +010085#define TIF_SYSCALL 0 /* inside a system call */
Martin Schwidefsky753c4dd2008-10-10 21:33:20 +020086#define TIF_NOTIFY_RESUME 1 /* callback before returning to user */
Linus Torvalds1da177e2005-04-16 15:20:36 -070087#define TIF_SIGPENDING 2 /* signal pending */
88#define TIF_NEED_RESCHED 3 /* rescheduling necessary */
Martin Schwidefsky5e9a2692011-01-05 12:48:10 +010089#define TIF_PER_TRAP 6 /* deliver sigtrap on return to user */
Heiko Carstens77fa2242005-06-25 14:55:30 -070090#define TIF_MCCK_PENDING 7 /* machine check handling is pending */
Heiko Carstensbcf5cef2009-06-12 10:26:26 +020091#define TIF_SYSCALL_TRACE 8 /* syscall trace active */
92#define TIF_SYSCALL_AUDIT 9 /* syscall auditing active */
93#define TIF_SECCOMP 10 /* secure computing */
Josh Stone66700002009-08-24 14:43:11 -070094#define TIF_SYSCALL_TRACEPOINT 11 /* syscall tracepoint instrumentation */
Martin Schwidefskybebf0232010-01-13 20:44:28 +010095#define TIF_31BIT 17 /* 32bit process */
Andreas Dilger0ddc9322010-05-14 11:13:27 +020096#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
Martin Schwidefskybebf0232010-01-13 20:44:28 +010097#define TIF_RESTORE_SIGMASK 19 /* restore signal mask in do_signal() */
Martin Schwidefsky5e9a2692011-01-05 12:48:10 +010098#define TIF_SINGLE_STEP 20 /* This task is single stepped */
Linus Torvalds1da177e2005-04-16 15:20:36 -070099
Martin Schwidefskyb6ef5bb2011-10-30 15:16:49 +0100100#define _TIF_SYSCALL (1<<TIF_SYSCALL)
Martin Schwidefsky753c4dd2008-10-10 21:33:20 +0200101#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700102#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
103#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
Martin Schwidefsky5e9a2692011-01-05 12:48:10 +0100104#define _TIF_PER_TRAP (1<<TIF_PER_TRAP)
Heiko Carstens77fa2242005-06-25 14:55:30 -0700105#define _TIF_MCCK_PENDING (1<<TIF_MCCK_PENDING)
Heiko Carstensbcf5cef2009-06-12 10:26:26 +0200106#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
107#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
108#define _TIF_SECCOMP (1<<TIF_SECCOMP)
Josh Stone66700002009-08-24 14:43:11 -0700109#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700110#define _TIF_31BIT (1<<TIF_31BIT)
Tejun Heo80853a82011-10-30 15:16:35 +0100111#define _TIF_SINGLE_STEP (1<<TIF_SINGLE_STEP)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700112
Heiko Carstensa05c90f2011-01-12 09:55:29 +0100113#ifdef CONFIG_64BIT
114#define is_32bit_task() (test_thread_flag(TIF_31BIT))
115#else
116#define is_32bit_task() (1)
117#endif
118
Linus Torvalds1da177e2005-04-16 15:20:36 -0700119#define PREEMPT_ACTIVE 0x4000000
120
121#endif /* _ASM_THREAD_INFO_H */