diff options
| author | David Gibson <david@gibson.dropbear.id.au> | 2005-10-21 01:45:50 -0400 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2005-10-21 08:47:23 -0400 |
| commit | 6cb7bfebb145af5ea1d052512a2ae7ff07a47202 (patch) | |
| tree | 677ce52e6ad423f8a652ec3e16f98c3ad33fcc54 /include/asm-ppc | |
| parent | b0faa28493f97b55b36ff5b1a2b8c81bf253a460 (diff) | |
[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>
Diffstat (limited to 'include/asm-ppc')
| -rw-r--r-- | include/asm-ppc/ptrace.h | 2 | ||||
| -rw-r--r-- | include/asm-ppc/thread_info.h | 107 |
2 files changed, 1 insertions, 108 deletions
diff --git a/include/asm-ppc/ptrace.h b/include/asm-ppc/ptrace.h index 7043c164b537..c34fb4e37a97 100644 --- a/include/asm-ppc/ptrace.h +++ b/include/asm-ppc/ptrace.h | |||
| @@ -57,7 +57,7 @@ extern unsigned long profile_pc(struct pt_regs *regs); | |||
| 57 | 57 | ||
| 58 | #define force_successful_syscall_return() \ | 58 | #define force_successful_syscall_return() \ |
| 59 | do { \ | 59 | do { \ |
| 60 | current_thread_info()->local_flags |= _TIFL_FORCE_NOERROR; \ | 60 | current_thread_info()->syscall_noerror = 1; \ |
| 61 | } while(0) | 61 | } while(0) |
| 62 | 62 | ||
| 63 | /* | 63 | /* |
diff --git a/include/asm-ppc/thread_info.h b/include/asm-ppc/thread_info.h deleted file mode 100644 index 27903db42efc..000000000000 --- a/include/asm-ppc/thread_info.h +++ /dev/null | |||
| @@ -1,107 +0,0 @@ | |||
| 1 | /* thread_info.h: PPC low-level thread information | ||
| 2 | * adapted from the i386 version by Paul Mackerras | ||
| 3 | * | ||
| 4 | * Copyright (C) 2002 David Howells (dhowells@redhat.com) | ||
| 5 | * - Incorporating suggestions made by Linus Torvalds and Dave Miller | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef _ASM_THREAD_INFO_H | ||
| 9 | #define _ASM_THREAD_INFO_H | ||
| 10 | |||
| 11 | #ifdef __KERNEL__ | ||
| 12 | #ifndef __ASSEMBLY__ | ||
| 13 | /* | ||
| 14 | * low level task data. | ||
| 15 | * If you change this, change the TI_* offsets below to match. | ||
| 16 | */ | ||
| 17 | struct thread_info { | ||
| 18 | struct task_struct *task; /* main task structure */ | ||
| 19 | struct exec_domain *exec_domain; /* execution domain */ | ||
| 20 | unsigned long flags; /* low level flags */ | ||
| 21 | unsigned long local_flags; /* non-racy flags */ | ||
| 22 | int cpu; /* cpu we're on */ | ||
| 23 | int preempt_count; /* 0 => preemptable, | ||
| 24 | <0 => BUG */ | ||
| 25 | struct restart_block restart_block; | ||
| 26 | }; | ||
| 27 | |||
| 28 | #define INIT_THREAD_INFO(tsk) \ | ||
| 29 | { \ | ||
| 30 | .task = &tsk, \ | ||
| 31 | .exec_domain = &default_exec_domain, \ | ||
| 32 | .flags = 0, \ | ||
| 33 | .local_flags = 0, \ | ||
| 34 | .cpu = 0, \ | ||
| 35 | .preempt_count = 1, \ | ||
| 36 | .restart_block = { \ | ||
| 37 | .fn = do_no_restart_syscall, \ | ||
| 38 | }, \ | ||
| 39 | } | ||
| 40 | |||
| 41 | #define init_thread_info (init_thread_union.thread_info) | ||
| 42 | #define init_stack (init_thread_union.stack) | ||
| 43 | |||
| 44 | /* | ||
| 45 | * macros/functions for gaining access to the thread information structure | ||
| 46 | */ | ||
| 47 | |||
| 48 | /* how to get the thread information struct from C */ | ||
| 49 | static inline struct thread_info *current_thread_info(void) | ||
| 50 | { | ||
| 51 | struct thread_info *ti; | ||
| 52 | __asm__("rlwinm %0,1,0,0,18" : "=r"(ti)); | ||
| 53 | return ti; | ||
| 54 | } | ||
| 55 | |||
| 56 | /* thread information allocation */ | ||
| 57 | #define alloc_thread_info(tsk) ((struct thread_info *) \ | ||
| 58 | __get_free_pages(GFP_KERNEL, 1)) | ||
| 59 | #define free_thread_info(ti) free_pages((unsigned long) (ti), 1) | ||
| 60 | #define get_thread_info(ti) get_task_struct((ti)->task) | ||
| 61 | #define put_thread_info(ti) put_task_struct((ti)->task) | ||
| 62 | #endif /* __ASSEMBLY__ */ | ||
| 63 | |||
| 64 | /* | ||
| 65 | * Size of kernel stack for each process. | ||
| 66 | */ | ||
| 67 | #define THREAD_SIZE 8192 /* 2 pages */ | ||
| 68 | |||
| 69 | #define PREEMPT_ACTIVE 0x10000000 | ||
| 70 | |||
| 71 | /* | ||
| 72 | * thread information flag bit numbers | ||
| 73 | */ | ||
| 74 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
| 75 | #define TIF_NOTIFY_RESUME 1 /* resumption notification requested */ | ||
| 76 | #define TIF_SIGPENDING 2 /* signal pending */ | ||
| 77 | #define TIF_NEED_RESCHED 3 /* rescheduling necessary */ | ||
| 78 | #define TIF_POLLING_NRFLAG 4 /* true if poll_idle() is polling | ||
| 79 | TIF_NEED_RESCHED */ | ||
| 80 | #define TIF_MEMDIE 5 | ||
| 81 | #define TIF_SYSCALL_AUDIT 6 /* syscall auditing active */ | ||
| 82 | #define TIF_SECCOMP 7 /* secure computing */ | ||
| 83 | |||
| 84 | /* as above, but as bit values */ | ||
| 85 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
| 86 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | ||
| 87 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
| 88 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
| 89 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
| 90 | #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT) | ||
| 91 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | ||
| 92 | |||
| 93 | #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP) | ||
| 94 | |||
| 95 | /* | ||
| 96 | * Non racy (local) flags bit numbers | ||
| 97 | */ | ||
| 98 | #define TIFL_FORCE_NOERROR 0 /* don't return error from current | ||
| 99 | syscall even if result < 0 */ | ||
| 100 | |||
| 101 | /* as above, but as bit values */ | ||
| 102 | #define _TIFL_FORCE_NOERROR (1<<TIFL_FORCE_NOERROR) | ||
| 103 | |||
| 104 | |||
| 105 | #endif /* __KERNEL__ */ | ||
| 106 | |||
| 107 | #endif /* _ASM_THREAD_INFO_H */ | ||
