Linux Audio

Check our new training course

Loading...
v5.4
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * thread_info.h: sparc low-level thread information
  4 * adapted from the ppc version by Pete Zaitcev, which was
  5 * adapted from the i386 version by Paul Mackerras
  6 *
  7 * Copyright (C) 2002  David Howells (dhowells@redhat.com)
  8 * Copyright (c) 2002  Pete Zaitcev (zaitcev@yahoo.com)
  9 * - Incorporating suggestions made by Linus Torvalds and Dave Miller
 10 */
 11
 12#ifndef _ASM_THREAD_INFO_H
 13#define _ASM_THREAD_INFO_H
 14
 15#ifdef __KERNEL__
 16
 17#ifndef __ASSEMBLY__
 18
 
 19#include <asm/ptrace.h>
 20#include <asm/page.h>
 21
 22/*
 23 * Low level task data.
 24 *
 25 * If you change this, change the TI_* offsets below to match.
 26 */
 27#define NSWINS 8
 28struct thread_info {
 29	unsigned long		uwinmask;
 30	struct task_struct	*task;		/* main task structure */
 
 31	unsigned long		flags;		/* low level flags */
 32	int			cpu;		/* cpu we're on */
 33	int			preempt_count;	/* 0 => preemptable,
 34						   <0 => BUG */
 35	int			softirq_count;
 36	int			hardirq_count;
 37
 38	u32 __unused;
 39
 40	/* Context switch saved kernel state. */
 41	unsigned long ksp;	/* ... ksp __attribute__ ((aligned (8))); */
 42	unsigned long kpc;
 43	unsigned long kpsr;
 44	unsigned long kwim;
 45
 46	/* A place to store user windows and stack pointers
 47	 * when the stack needs inspection.
 48	 */
 49	struct reg_window32	reg_window[NSWINS];	/* align for ldd! */
 50	unsigned long		rwbuf_stkptrs[NSWINS];
 51	unsigned long		w_saved;
 
 
 52};
 53
 54/*
 55 * macros/functions for gaining access to the thread information structure
 56 */
 57#define INIT_THREAD_INFO(tsk)				\
 58{							\
 59	.uwinmask	=	0,			\
 60	.task		=	&tsk,			\
 
 61	.flags		=	0,			\
 62	.cpu		=	0,			\
 63	.preempt_count	=	INIT_PREEMPT_COUNT,	\
 
 
 
 64}
 65
 
 
 
 66/* how to get the thread information struct from C */
 67register struct thread_info *current_thread_info_reg asm("g6");
 68#define current_thread_info()   (current_thread_info_reg)
 69
 70/*
 71 * thread information allocation
 72 */
 73#define THREAD_SIZE_ORDER  1
 
 
 
 
 
 
 
 
 74
 75#endif /* __ASSEMBLY__ */
 76
 77/* Size of kernel stack for each process */
 78#define THREAD_SIZE		(2 * PAGE_SIZE)
 
 
 
 
 79
 80/*
 81 * Offsets in thread_info structure, used in assembly code
 82 * The "#define REGWIN_SZ 0x40" was abolished, so no multiplications.
 83 */
 84#define TI_UWINMASK	0x00	/* uwinmask */
 85#define TI_TASK		0x04
 86#define TI_FLAGS	0x08
 87#define TI_CPU		0x0c
 88#define TI_PREEMPT	0x10	/* preempt_count */
 89#define TI_SOFTIRQ	0x14	/* softirq_count */
 90#define TI_HARDIRQ	0x18	/* hardirq_count */
 
 91#define TI_KSP		0x20	/* ksp */
 92#define TI_KPC		0x24	/* kpc (ldd'ed with kpc) */
 93#define TI_KPSR		0x28	/* kpsr */
 94#define TI_KWIM		0x2c	/* kwim (ldd'ed with kpsr) */
 95#define TI_REG_WINDOW	0x30
 96#define TI_RWIN_SPTRS	0x230
 97#define TI_W_SAVED	0x250
 
 
 
 98
 99/*
100 * thread information flag bit numbers
101 */
102#define TIF_SYSCALL_TRACE	0	/* syscall trace active */
103#define TIF_NOTIFY_RESUME	1	/* callback before returning to user */
104#define TIF_SIGPENDING		2	/* signal pending */
105#define TIF_NEED_RESCHED	3	/* rescheduling necessary */
106#define TIF_RESTORE_SIGMASK	4	/* restore signal mask in do_signal() */
107#define TIF_USEDFPU		8	/* FPU was used by this task
108					 * this quantum (SMP) */
109#define TIF_POLLING_NRFLAG	9	/* true if poll_idle() is polling
110					 * TIF_NEED_RESCHED */
111#define TIF_MEMDIE		10	/* is terminating due to OOM killer */
 
112
113/* as above, but as bit values */
114#define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
115#define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
116#define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
117#define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
 
118#define _TIF_USEDFPU		(1<<TIF_USEDFPU)
119#define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
120
121#define _TIF_DO_NOTIFY_RESUME_MASK	(_TIF_NOTIFY_RESUME | \
122					 _TIF_SIGPENDING)
123
124#define is_32bit_task()	(1)
125
126#endif /* __KERNEL__ */
127
128#endif /* _ASM_THREAD_INFO_H */
v3.1
 
  1/*
  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
 18#include <asm/btfixup.h>
 19#include <asm/ptrace.h>
 20#include <asm/page.h>
 21
 22/*
 23 * Low level task data.
 24 *
 25 * If you change this, change the TI_* offsets below to match.
 26 */
 27#define NSWINS 8
 28struct thread_info {
 29	unsigned long		uwinmask;
 30	struct task_struct	*task;		/* main task structure */
 31	struct exec_domain	*exec_domain;	/* execution domain */
 32	unsigned long		flags;		/* low level flags */
 33	int			cpu;		/* cpu we're on */
 34	int			preempt_count;	/* 0 => preemptable,
 35						   <0 => BUG */
 36	int			softirq_count;
 37	int			hardirq_count;
 38
 
 
 39	/* 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	 */
 48	struct reg_window32	reg_window[NSWINS];	/* align for ldd! */
 49	unsigned long		rwbuf_stkptrs[NSWINS];
 50	unsigned long		w_saved;
 51
 52	struct restart_block	restart_block;
 53};
 54
 55/*
 56 * macros/functions for gaining access to the thread information structure
 57 */
 58#define INIT_THREAD_INFO(tsk)				\
 59{							\
 60	.uwinmask	=	0,			\
 61	.task		=	&tsk,			\
 62	.exec_domain	=	&default_exec_domain,	\
 63	.flags		=	0,			\
 64	.cpu		=	0,			\
 65	.preempt_count	=	INIT_PREEMPT_COUNT,	\
 66	.restart_block	= {				\
 67		.fn	=	do_no_restart_syscall,	\
 68	},						\
 69}
 70
 71#define init_thread_info	(init_thread_union.thread_info)
 72#define init_stack		(init_thread_union.stack)
 73
 74/* how to get the thread information struct from C */
 75register struct thread_info *current_thread_info_reg asm("g6");
 76#define current_thread_info()   (current_thread_info_reg)
 77
 78/*
 79 * thread information allocation
 80 */
 81#define THREAD_INFO_ORDER  1
 82
 83#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
 84
 85BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info_node, int)
 86#define alloc_thread_info_node(tsk, node) BTFIXUP_CALL(alloc_thread_info_node)(node)
 87
 88BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
 89#define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti)
 90
 91#endif /* __ASSEMBLY__ */
 92
 93/*
 94 * Size of kernel stack for each process.
 95 * Observe the order of get_free_pages() in alloc_thread_info_node().
 96 * The sun4 has 8K stack too, because it's short on memory, and 16K is a waste.
 97 */
 98#define THREAD_SIZE		8192
 99
100/*
101 * Offsets in thread_info structure, used in assembly code
102 * The "#define REGWIN_SZ 0x40" was abolished, so no multiplications.
103 */
104#define TI_UWINMASK	0x00	/* uwinmask */
105#define TI_TASK		0x04
106#define TI_EXECDOMAIN	0x08	/* exec_domain */
107#define TI_FLAGS	0x0c
108#define TI_CPU		0x10
109#define TI_PREEMPT	0x14	/* preempt_count */
110#define TI_SOFTIRQ	0x18	/* softirq_count */
111#define TI_HARDIRQ	0x1c	/* hardirq_count */
112#define TI_KSP		0x20	/* ksp */
113#define TI_KPC		0x24	/* kpc (ldd'ed with kpc) */
114#define TI_KPSR		0x28	/* kpsr */
115#define TI_KWIM		0x2c	/* kwim (ldd'ed with kpsr) */
116#define TI_REG_WINDOW	0x30
117#define TI_RWIN_SPTRS	0x230
118#define TI_W_SAVED	0x250
119/* #define TI_RESTART_BLOCK 0x25n */ /* Nobody cares */
120
121#define PREEMPT_ACTIVE		0x4000000
122
123/*
124 * thread information flag bit numbers
125 */
126#define TIF_SYSCALL_TRACE	0	/* syscall trace active */
127#define TIF_NOTIFY_RESUME	1	/* callback before returning to user */
128#define TIF_SIGPENDING		2	/* signal pending */
129#define TIF_NEED_RESCHED	3	/* rescheduling necessary */
130#define TIF_RESTORE_SIGMASK	4	/* restore signal mask in do_signal() */
131#define TIF_USEDFPU		8	/* FPU was used by this task
132					 * this quantum (SMP) */
133#define TIF_POLLING_NRFLAG	9	/* true if poll_idle() is polling
134					 * TIF_NEED_RESCHED */
135#define TIF_MEMDIE		10	/* is terminating due to OOM killer */
136#define TIF_FREEZE		11	/* is freezing for suspend */
137
138/* as above, but as bit values */
139#define _TIF_SYSCALL_TRACE	(1<<TIF_SYSCALL_TRACE)
140#define _TIF_NOTIFY_RESUME	(1<<TIF_NOTIFY_RESUME)
141#define _TIF_SIGPENDING		(1<<TIF_SIGPENDING)
142#define _TIF_NEED_RESCHED	(1<<TIF_NEED_RESCHED)
143#define _TIF_RESTORE_SIGMASK	(1<<TIF_RESTORE_SIGMASK)
144#define _TIF_USEDFPU		(1<<TIF_USEDFPU)
145#define _TIF_POLLING_NRFLAG	(1<<TIF_POLLING_NRFLAG)
146
147#define _TIF_DO_NOTIFY_RESUME_MASK	(_TIF_NOTIFY_RESUME | \
148					 _TIF_SIGPENDING | \
149					 _TIF_RESTORE_SIGMASK)
150#define _TIF_FREEZE		(1<<TIF_FREEZE)
151
152#endif /* __KERNEL__ */
153
154#endif /* _ASM_THREAD_INFO_H */