[PATCH] powerpc: Merge thread_info.h
Merge ppc32 and ppc64 versions of thread_info.h. They were pretty
similar already, the chief changes are:
- Instead of inline asm to implement current_thread_info(),
which needs to be different for ppc32 and ppc64, we use C with an
asm("r1") register variable. gcc turns it into the same asm as we
used to have for both platforms.
- We replace ppc32's 'local_flags' with the ppc64
'syscall_noerror' field. The noerror flag was in fact the only thing
in the local_flags field anyway, so the ppc64 approach is simpler, and
means we only need a load-immediate/store instead of load/mask/store
when clearing the flag.
- In readiness for 64k pages, when THREAD_SIZE will be less
than a page, ppc64 used kmalloc() rather than get_free_pages() to
allocate the kernel stack. With this patch we do the same for ppc32,
since there's no strong reason not to.
- For ppc64, we no longer export THREAD_SHIFT and THREAD_SIZE
via asm-offsets, thread_info.h can now be safely included in asm, as
on ppc32.
Built and booted on G4 Powerbook (ARCH=ppc and ARCH=powerpc) and
Power5 (ARCH=ppc64 and ARCH=powerpc).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-10-21 05:45:50 +00:00
|
|
|
/* thread_info.h: PowerPC low-level thread information
|
2005-04-16 22:20:36 +00:00
|
|
|
* adapted from the i386 version by Paul Mackerras
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 David Howells (dhowells@redhat.com)
|
|
|
|
* - Incorporating suggestions made by Linus Torvalds and Dave Miller
|
|
|
|
*/
|
|
|
|
|
[PATCH] powerpc: Merge thread_info.h
Merge ppc32 and ppc64 versions of thread_info.h. They were pretty
similar already, the chief changes are:
- Instead of inline asm to implement current_thread_info(),
which needs to be different for ppc32 and ppc64, we use C with an
asm("r1") register variable. gcc turns it into the same asm as we
used to have for both platforms.
- We replace ppc32's 'local_flags' with the ppc64
'syscall_noerror' field. The noerror flag was in fact the only thing
in the local_flags field anyway, so the ppc64 approach is simpler, and
means we only need a load-immediate/store instead of load/mask/store
when clearing the flag.
- In readiness for 64k pages, when THREAD_SIZE will be less
than a page, ppc64 used kmalloc() rather than get_free_pages() to
allocate the kernel stack. With this patch we do the same for ppc32,
since there's no strong reason not to.
- For ppc64, we no longer export THREAD_SHIFT and THREAD_SIZE
via asm-offsets, thread_info.h can now be safely included in asm, as
on ppc32.
Built and booted on G4 Powerbook (ARCH=ppc and ARCH=powerpc) and
Power5 (ARCH=ppc64 and ARCH=powerpc).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-10-21 05:45:50 +00:00
|
|
|
#ifndef _ASM_POWERPC_THREAD_INFO_H
|
|
|
|
#define _ASM_POWERPC_THREAD_INFO_H
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
|
[PATCH] powerpc: Merge thread_info.h
Merge ppc32 and ppc64 versions of thread_info.h. They were pretty
similar already, the chief changes are:
- Instead of inline asm to implement current_thread_info(),
which needs to be different for ppc32 and ppc64, we use C with an
asm("r1") register variable. gcc turns it into the same asm as we
used to have for both platforms.
- We replace ppc32's 'local_flags' with the ppc64
'syscall_noerror' field. The noerror flag was in fact the only thing
in the local_flags field anyway, so the ppc64 approach is simpler, and
means we only need a load-immediate/store instead of load/mask/store
when clearing the flag.
- In readiness for 64k pages, when THREAD_SIZE will be less
than a page, ppc64 used kmalloc() rather than get_free_pages() to
allocate the kernel stack. With this patch we do the same for ppc32,
since there's no strong reason not to.
- For ppc64, we no longer export THREAD_SHIFT and THREAD_SIZE
via asm-offsets, thread_info.h can now be safely included in asm, as
on ppc32.
Built and booted on G4 Powerbook (ARCH=ppc and ARCH=powerpc) and
Power5 (ARCH=ppc64 and ARCH=powerpc).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-10-21 05:45:50 +00:00
|
|
|
/* We have 8k stacks on ppc32 and 16k on ppc64 */
|
|
|
|
|
powerpc/44x: Support for 256KB PAGE_SIZE
This patch adds support for 256KB pages on ppc44x-based boards.
For simplification of implementation with 256KB pages we still assume
2-level paging. As a side effect this leads to wasting extra memory space
reserved for PTE tables: only 1/4 of pages allocated for PTEs are
actually used. But this may be an acceptable trade-off to achieve the
high performance we have with big PAGE_SIZEs in some applications (e.g.
RAID).
Also with 256KB PAGE_SIZE we increase THREAD_SIZE up to 32KB to minimize
the risk of stack overflows in the cases of on-stack arrays, which size
depends on the page size (e.g. multipage BIOs, NTFS, etc.).
With 256KB PAGE_SIZE we need to decrease the PKMAP_ORDER at least down
to 9, otherwise all high memory (2 ^ 10 * PAGE_SIZE == 256MB) we'll be
occupied by PKMAP addresses leaving no place for vmalloc. We do not
separate PKMAP_ORDER for 256K from 16K/64K PAGE_SIZE here; actually that
value of 10 in support for 16K/64K had been selected rather intuitively.
Thus now for all cases of PAGE_SIZE on ppc44x (including the default, 4KB,
one) we have 512 pages for PKMAP.
Because ELF standard supports only page sizes up to 64K, then you should
use binutils later than 2.17.50.0.3 with '-zmax-page-size' set to 256K
for building applications, which are to be run with the 256KB-page sized
kernel. If using the older binutils, then you should patch them like follows:
--- binutils/bfd/elf32-ppc.c.orig
+++ binutils/bfd/elf32-ppc.c
-#define ELF_MAXPAGESIZE 0x10000
+#define ELF_MAXPAGESIZE 0x40000
One more restriction we currently have with 256KB page sizes is inability
to use shmem safely, so, for now, the 256KB is available only if you turn
the CONFIG_SHMEM option off (another variant is to use BROKEN).
Though, if you need shmem with 256KB pages, you can always remove the !SHMEM
dependency in 'config PPC_256K_PAGES', and use the workaround available here:
http://lkml.org/lkml/2008/12/19/20
Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
2009-01-29 01:40:44 +00:00
|
|
|
#if defined(CONFIG_PPC64)
|
[PATCH] powerpc: Merge thread_info.h
Merge ppc32 and ppc64 versions of thread_info.h. They were pretty
similar already, the chief changes are:
- Instead of inline asm to implement current_thread_info(),
which needs to be different for ppc32 and ppc64, we use C with an
asm("r1") register variable. gcc turns it into the same asm as we
used to have for both platforms.
- We replace ppc32's 'local_flags' with the ppc64
'syscall_noerror' field. The noerror flag was in fact the only thing
in the local_flags field anyway, so the ppc64 approach is simpler, and
means we only need a load-immediate/store instead of load/mask/store
when clearing the flag.
- In readiness for 64k pages, when THREAD_SIZE will be less
than a page, ppc64 used kmalloc() rather than get_free_pages() to
allocate the kernel stack. With this patch we do the same for ppc32,
since there's no strong reason not to.
- For ppc64, we no longer export THREAD_SHIFT and THREAD_SIZE
via asm-offsets, thread_info.h can now be safely included in asm, as
on ppc32.
Built and booted on G4 Powerbook (ARCH=ppc and ARCH=powerpc) and
Power5 (ARCH=ppc64 and ARCH=powerpc).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-10-21 05:45:50 +00:00
|
|
|
#define THREAD_SHIFT 14
|
powerpc/44x: Support for 256KB PAGE_SIZE
This patch adds support for 256KB pages on ppc44x-based boards.
For simplification of implementation with 256KB pages we still assume
2-level paging. As a side effect this leads to wasting extra memory space
reserved for PTE tables: only 1/4 of pages allocated for PTEs are
actually used. But this may be an acceptable trade-off to achieve the
high performance we have with big PAGE_SIZEs in some applications (e.g.
RAID).
Also with 256KB PAGE_SIZE we increase THREAD_SIZE up to 32KB to minimize
the risk of stack overflows in the cases of on-stack arrays, which size
depends on the page size (e.g. multipage BIOs, NTFS, etc.).
With 256KB PAGE_SIZE we need to decrease the PKMAP_ORDER at least down
to 9, otherwise all high memory (2 ^ 10 * PAGE_SIZE == 256MB) we'll be
occupied by PKMAP addresses leaving no place for vmalloc. We do not
separate PKMAP_ORDER for 256K from 16K/64K PAGE_SIZE here; actually that
value of 10 in support for 16K/64K had been selected rather intuitively.
Thus now for all cases of PAGE_SIZE on ppc44x (including the default, 4KB,
one) we have 512 pages for PKMAP.
Because ELF standard supports only page sizes up to 64K, then you should
use binutils later than 2.17.50.0.3 with '-zmax-page-size' set to 256K
for building applications, which are to be run with the 256KB-page sized
kernel. If using the older binutils, then you should patch them like follows:
--- binutils/bfd/elf32-ppc.c.orig
+++ binutils/bfd/elf32-ppc.c
-#define ELF_MAXPAGESIZE 0x10000
+#define ELF_MAXPAGESIZE 0x40000
One more restriction we currently have with 256KB page sizes is inability
to use shmem safely, so, for now, the 256KB is available only if you turn
the CONFIG_SHMEM option off (another variant is to use BROKEN).
Though, if you need shmem with 256KB pages, you can always remove the !SHMEM
dependency in 'config PPC_256K_PAGES', and use the workaround available here:
http://lkml.org/lkml/2008/12/19/20
Signed-off-by: Yuri Tikhonov <yur@emcraft.com>
Signed-off-by: Ilya Yanok <yanok@emcraft.com>
Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
2009-01-29 01:40:44 +00:00
|
|
|
#elif defined(CONFIG_PPC_256K_PAGES)
|
|
|
|
#define THREAD_SHIFT 15
|
[PATCH] powerpc: Merge thread_info.h
Merge ppc32 and ppc64 versions of thread_info.h. They were pretty
similar already, the chief changes are:
- Instead of inline asm to implement current_thread_info(),
which needs to be different for ppc32 and ppc64, we use C with an
asm("r1") register variable. gcc turns it into the same asm as we
used to have for both platforms.
- We replace ppc32's 'local_flags' with the ppc64
'syscall_noerror' field. The noerror flag was in fact the only thing
in the local_flags field anyway, so the ppc64 approach is simpler, and
means we only need a load-immediate/store instead of load/mask/store
when clearing the flag.
- In readiness for 64k pages, when THREAD_SIZE will be less
than a page, ppc64 used kmalloc() rather than get_free_pages() to
allocate the kernel stack. With this patch we do the same for ppc32,
since there's no strong reason not to.
- For ppc64, we no longer export THREAD_SHIFT and THREAD_SIZE
via asm-offsets, thread_info.h can now be safely included in asm, as
on ppc32.
Built and booted on G4 Powerbook (ARCH=ppc and ARCH=powerpc) and
Power5 (ARCH=ppc64 and ARCH=powerpc).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-10-21 05:45:50 +00:00
|
|
|
#else
|
|
|
|
#define THREAD_SHIFT 13
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define THREAD_SIZE (1 << THREAD_SHIFT)
|
|
|
|
|
2012-07-05 04:41:35 +00:00
|
|
|
#ifdef CONFIG_PPC64
|
|
|
|
#define CURRENT_THREAD_INFO(dest, sp) clrrdi dest, sp, THREAD_SHIFT
|
|
|
|
#else
|
|
|
|
#define CURRENT_THREAD_INFO(dest, sp) rlwinm dest, sp, 0, 0, 31-THREAD_SHIFT
|
|
|
|
#endif
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/cache.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/page.h>
|
|
|
|
#include <linux/stringify.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* low level task data.
|
|
|
|
*/
|
|
|
|
struct thread_info {
|
|
|
|
struct task_struct *task; /* main task structure */
|
|
|
|
struct exec_domain *exec_domain; /* execution domain */
|
|
|
|
int cpu; /* cpu we're on */
|
[PATCH] powerpc: Merge thread_info.h
Merge ppc32 and ppc64 versions of thread_info.h. They were pretty
similar already, the chief changes are:
- Instead of inline asm to implement current_thread_info(),
which needs to be different for ppc32 and ppc64, we use C with an
asm("r1") register variable. gcc turns it into the same asm as we
used to have for both platforms.
- We replace ppc32's 'local_flags' with the ppc64
'syscall_noerror' field. The noerror flag was in fact the only thing
in the local_flags field anyway, so the ppc64 approach is simpler, and
means we only need a load-immediate/store instead of load/mask/store
when clearing the flag.
- In readiness for 64k pages, when THREAD_SIZE will be less
than a page, ppc64 used kmalloc() rather than get_free_pages() to
allocate the kernel stack. With this patch we do the same for ppc32,
since there's no strong reason not to.
- For ppc64, we no longer export THREAD_SHIFT and THREAD_SIZE
via asm-offsets, thread_info.h can now be safely included in asm, as
on ppc32.
Built and booted on G4 Powerbook (ARCH=ppc and ARCH=powerpc) and
Power5 (ARCH=ppc64 and ARCH=powerpc).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-10-21 05:45:50 +00:00
|
|
|
int preempt_count; /* 0 => preemptable,
|
|
|
|
<0 => BUG */
|
2005-04-16 22:20:36 +00:00
|
|
|
struct restart_block restart_block;
|
2006-04-18 11:49:11 +00:00
|
|
|
unsigned long local_flags; /* private flags for thread */
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* low level flags - has atomic operations done on it */
|
|
|
|
unsigned long flags ____cacheline_aligned_in_smp;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* macros/functions for gaining access to the thread information structure
|
|
|
|
*/
|
|
|
|
#define INIT_THREAD_INFO(tsk) \
|
|
|
|
{ \
|
|
|
|
.task = &tsk, \
|
|
|
|
.exec_domain = &default_exec_domain, \
|
|
|
|
.cpu = 0, \
|
2009-07-10 12:57:56 +00:00
|
|
|
.preempt_count = INIT_PREEMPT_COUNT, \
|
2005-04-16 22:20:36 +00:00
|
|
|
.restart_block = { \
|
|
|
|
.fn = do_no_restart_syscall, \
|
|
|
|
}, \
|
|
|
|
.flags = 0, \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define init_thread_info (init_thread_union.thread_info)
|
|
|
|
#define init_stack (init_thread_union.stack)
|
|
|
|
|
2008-07-25 08:45:40 +00:00
|
|
|
#define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT)
|
2005-10-24 04:05:38 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* how to get the thread information struct from C */
|
|
|
|
static inline struct thread_info *current_thread_info(void)
|
|
|
|
{
|
[PATCH] powerpc: Merge thread_info.h
Merge ppc32 and ppc64 versions of thread_info.h. They were pretty
similar already, the chief changes are:
- Instead of inline asm to implement current_thread_info(),
which needs to be different for ppc32 and ppc64, we use C with an
asm("r1") register variable. gcc turns it into the same asm as we
used to have for both platforms.
- We replace ppc32's 'local_flags' with the ppc64
'syscall_noerror' field. The noerror flag was in fact the only thing
in the local_flags field anyway, so the ppc64 approach is simpler, and
means we only need a load-immediate/store instead of load/mask/store
when clearing the flag.
- In readiness for 64k pages, when THREAD_SIZE will be less
than a page, ppc64 used kmalloc() rather than get_free_pages() to
allocate the kernel stack. With this patch we do the same for ppc32,
since there's no strong reason not to.
- For ppc64, we no longer export THREAD_SHIFT and THREAD_SIZE
via asm-offsets, thread_info.h can now be safely included in asm, as
on ppc32.
Built and booted on G4 Powerbook (ARCH=ppc and ARCH=powerpc) and
Power5 (ARCH=ppc64 and ARCH=powerpc).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-10-21 05:45:50 +00:00
|
|
|
register unsigned long sp asm("r1");
|
|
|
|
|
|
|
|
/* gcc4, at least, is smart enough to turn this into a single
|
|
|
|
* rlwinm for ppc32 and clrrdi for ppc64 */
|
|
|
|
return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
|
|
|
|
#define PREEMPT_ACTIVE 0x10000000
|
|
|
|
|
|
|
|
/*
|
|
|
|
* thread information flag bit numbers
|
|
|
|
*/
|
|
|
|
#define TIF_SYSCALL_TRACE 0 /* syscall trace active */
|
2007-07-31 07:38:00 +00:00
|
|
|
#define TIF_SIGPENDING 1 /* signal pending */
|
|
|
|
#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
|
|
|
|
#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
|
2005-04-16 22:20:36 +00:00
|
|
|
TIF_NEED_RESCHED */
|
2007-07-31 07:38:00 +00:00
|
|
|
#define TIF_32BIT 4 /* 32 bit binary */
|
|
|
|
#define TIF_PERFMON_WORK 5 /* work for pfm_handle_work() */
|
|
|
|
#define TIF_PERFMON_CTXSW 6 /* perfmon needs ctxsw calls */
|
|
|
|
#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
|
|
|
|
#define TIF_SINGLESTEP 8 /* singlestepping active */
|
2010-05-14 09:13:27 +00:00
|
|
|
#define TIF_MEMDIE 9 /* is terminating due to OOM killer */
|
2007-07-31 07:38:00 +00:00
|
|
|
#define TIF_SECCOMP 10 /* secure computing */
|
|
|
|
#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */
|
|
|
|
#define TIF_NOERROR 12 /* Force successful syscall return */
|
2008-07-27 06:52:52 +00:00
|
|
|
#define TIF_NOTIFY_RESUME 13 /* callback before returning to user */
|
2012-08-23 21:31:32 +00:00
|
|
|
#define TIF_UPROBE 14 /* breakpointed or single-stepping */
|
2011-02-02 17:27:24 +00:00
|
|
|
#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */
|
2012-09-16 23:54:29 +00:00
|
|
|
#define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation
|
|
|
|
for stack store? */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* as above, but as bit values */
|
|
|
|
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
|
|
|
|
#define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
|
|
|
|
#define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
|
|
|
|
#define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
|
|
|
|
#define _TIF_32BIT (1<<TIF_32BIT)
|
2007-05-15 19:59:06 +00:00
|
|
|
#define _TIF_PERFMON_WORK (1<<TIF_PERFMON_WORK)
|
|
|
|
#define _TIF_PERFMON_CTXSW (1<<TIF_PERFMON_CTXSW)
|
2005-04-16 22:20:36 +00:00
|
|
|
#define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
|
|
|
|
#define _TIF_SINGLESTEP (1<<TIF_SINGLESTEP)
|
|
|
|
#define _TIF_SECCOMP (1<<TIF_SECCOMP)
|
[PATCH] syscall entry/exit revamp
This cleanup patch speeds up the null syscall path on ppc64 by about 3%,
and brings the ppc32 and ppc64 code slightly closer together.
The ppc64 code was checking current_thread_info()->flags twice in the
syscall exit path; once for TIF_SYSCALL_T_OR_A before disabling
interrupts, and then again for TIF_SIGPENDING|TIF_NEED_RESCHED etc after
disabling interrupts. Now we do the same as ppc32 -- check the flags
only once in the fast path, and re-enable interrupts if necessary in the
ptrace case.
The patch abolishes the 'syscall_noerror' member of struct thread_info
and replaces it with a TIF_NOERROR bit in the flags, which is handled in
the slow path. This shortens the syscall entry code, which no longer
needs to clear syscall_noerror.
The patch adds a TIF_SAVE_NVGPRS flag which causes the syscall exit slow
path to save the non-volatile GPRs into a signal frame. This removes the
need for the assembly wrappers around sys_sigsuspend(),
sys_rt_sigsuspend(), et al which existed solely to save those registers
in advance. It also means I don't have to add new wrappers for ppoll()
and pselect(), which is what I was supposed to be doing when I got
distracted into this...
Finally, it unifies the ppc64 and ppc32 methods of handling syscall exit
directly into a signal handler (as required by sigsuspend et al) by
introducing a TIF_RESTOREALL flag which causes _all_ the registers to be
reloaded from the pt_regs by taking the ret_from_exception path, instead
of the normal syscall exit path which stomps on the callee-saved GPRs.
It appears to pass an LTP test run on ppc64, and passes basic testing on
ppc32 too. Brief tests of ptrace functionality with strace and gdb also
appear OK. I wouldn't send it to Linus for 2.6.15 just yet though :)
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-11-15 18:52:18 +00:00
|
|
|
#define _TIF_RESTOREALL (1<<TIF_RESTOREALL)
|
|
|
|
#define _TIF_NOERROR (1<<TIF_NOERROR)
|
2008-07-27 06:52:52 +00:00
|
|
|
#define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
|
2012-08-23 21:31:32 +00:00
|
|
|
#define _TIF_UPROBE (1<<TIF_UPROBE)
|
2011-02-02 17:27:24 +00:00
|
|
|
#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
|
2012-09-16 23:54:29 +00:00
|
|
|
#define _TIF_EMULATE_STACK_STORE (1<<TIF_EMULATE_STACK_STORE)
|
2011-02-02 17:27:24 +00:00
|
|
|
#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
|
|
|
|
_TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2008-07-27 06:52:52 +00:00
|
|
|
#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
|
2012-08-23 21:31:32 +00:00
|
|
|
_TIF_NOTIFY_RESUME | _TIF_UPROBE)
|
2006-03-08 02:24:22 +00:00
|
|
|
#define _TIF_PERSYSCALL_MASK (_TIF_RESTOREALL|_TIF_NOERROR)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2006-04-18 11:49:11 +00:00
|
|
|
/* Bits in local_flags */
|
|
|
|
/* Don't move TLF_NAPPING without adjusting the code in entry_32.S */
|
|
|
|
#define TLF_NAPPING 0 /* idle thread enabled NAP mode */
|
2008-05-14 04:30:48 +00:00
|
|
|
#define TLF_SLEEPING 1 /* suspend code enabled SLEEP mode */
|
|
|
|
#define TLF_RESTORE_SIGMASK 2 /* Restore signal mask in do_signal */
|
2011-05-25 00:11:48 +00:00
|
|
|
#define TLF_LAZY_MMU 3 /* tlb_batch is active */
|
2012-03-01 01:45:27 +00:00
|
|
|
#define TLF_RUNLATCH 4 /* Is the runlatch enabled? */
|
2006-04-18 11:49:11 +00:00
|
|
|
|
|
|
|
#define _TLF_NAPPING (1 << TLF_NAPPING)
|
2008-05-14 04:30:48 +00:00
|
|
|
#define _TLF_SLEEPING (1 << TLF_SLEEPING)
|
2008-04-28 07:30:37 +00:00
|
|
|
#define _TLF_RESTORE_SIGMASK (1 << TLF_RESTORE_SIGMASK)
|
2011-05-25 00:11:48 +00:00
|
|
|
#define _TLF_LAZY_MMU (1 << TLF_LAZY_MMU)
|
2012-03-01 01:45:27 +00:00
|
|
|
#define _TLF_RUNLATCH (1 << TLF_RUNLATCH)
|
2008-04-28 07:30:37 +00:00
|
|
|
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#define HAVE_SET_RESTORE_SIGMASK 1
|
|
|
|
static inline void set_restore_sigmask(void)
|
|
|
|
{
|
|
|
|
struct thread_info *ti = current_thread_info();
|
|
|
|
ti->local_flags |= _TLF_RESTORE_SIGMASK;
|
2012-04-27 17:42:45 +00:00
|
|
|
WARN_ON(!test_bit(TIF_SIGPENDING, &ti->flags));
|
2008-04-28 07:30:37 +00:00
|
|
|
}
|
2012-04-27 02:29:20 +00:00
|
|
|
static inline void clear_restore_sigmask(void)
|
|
|
|
{
|
|
|
|
current_thread_info()->local_flags &= ~_TLF_RESTORE_SIGMASK;
|
|
|
|
}
|
|
|
|
static inline bool test_restore_sigmask(void)
|
|
|
|
{
|
|
|
|
return current_thread_info()->local_flags & _TLF_RESTORE_SIGMASK;
|
|
|
|
}
|
|
|
|
static inline bool test_and_clear_restore_sigmask(void)
|
|
|
|
{
|
|
|
|
struct thread_info *ti = current_thread_info();
|
|
|
|
if (!(ti->local_flags & _TLF_RESTORE_SIGMASK))
|
|
|
|
return false;
|
|
|
|
ti->local_flags &= ~_TLF_RESTORE_SIGMASK;
|
|
|
|
return true;
|
|
|
|
}
|
2009-02-22 01:49:58 +00:00
|
|
|
|
2012-03-01 01:45:27 +00:00
|
|
|
static inline bool test_thread_local_flags(unsigned int flags)
|
|
|
|
{
|
|
|
|
struct thread_info *ti = current_thread_info();
|
|
|
|
return (ti->local_flags & flags) != 0;
|
|
|
|
}
|
|
|
|
|
2009-02-22 01:49:58 +00:00
|
|
|
#ifdef CONFIG_PPC64
|
|
|
|
#define is_32bit_task() (test_thread_flag(TIF_32BIT))
|
|
|
|
#else
|
|
|
|
#define is_32bit_task() (1)
|
|
|
|
#endif
|
|
|
|
|
2008-04-28 07:30:37 +00:00
|
|
|
#endif /* !__ASSEMBLY__ */
|
2006-04-18 11:49:11 +00:00
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
|
[PATCH] powerpc: Merge thread_info.h
Merge ppc32 and ppc64 versions of thread_info.h. They were pretty
similar already, the chief changes are:
- Instead of inline asm to implement current_thread_info(),
which needs to be different for ppc32 and ppc64, we use C with an
asm("r1") register variable. gcc turns it into the same asm as we
used to have for both platforms.
- We replace ppc32's 'local_flags' with the ppc64
'syscall_noerror' field. The noerror flag was in fact the only thing
in the local_flags field anyway, so the ppc64 approach is simpler, and
means we only need a load-immediate/store instead of load/mask/store
when clearing the flag.
- In readiness for 64k pages, when THREAD_SIZE will be less
than a page, ppc64 used kmalloc() rather than get_free_pages() to
allocate the kernel stack. With this patch we do the same for ppc32,
since there's no strong reason not to.
- For ppc64, we no longer export THREAD_SHIFT and THREAD_SIZE
via asm-offsets, thread_info.h can now be safely included in asm, as
on ppc32.
Built and booted on G4 Powerbook (ARCH=ppc and ARCH=powerpc) and
Power5 (ARCH=ppc64 and ARCH=powerpc).
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-10-21 05:45:50 +00:00
|
|
|
#endif /* _ASM_POWERPC_THREAD_INFO_H */
|