diff options
| -rw-r--r-- | arch/m68k/include/asm/entry_mm.h | 3 | ||||
| -rw-r--r-- | arch/m68k/include/asm/thread_info.h | 109 | ||||
| -rw-r--r-- | arch/m68k/include/asm/thread_info_mm.h | 76 | ||||
| -rw-r--r-- | arch/m68k/include/asm/thread_info_no.h | 102 | ||||
| -rw-r--r-- | arch/m68knommu/platform/coldfire/entry.S | 4 |
5 files changed, 111 insertions, 183 deletions
diff --git a/arch/m68k/include/asm/entry_mm.h b/arch/m68k/include/asm/entry_mm.h index 474125886218..e41fea399bfe 100644 --- a/arch/m68k/include/asm/entry_mm.h +++ b/arch/m68k/include/asm/entry_mm.h | |||
| @@ -3,6 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | #include <asm/setup.h> | 4 | #include <asm/setup.h> |
| 5 | #include <asm/page.h> | 5 | #include <asm/page.h> |
| 6 | #ifdef __ASSEMBLY__ | ||
| 7 | #include <asm/thread_info.h> | ||
| 8 | #endif | ||
| 6 | 9 | ||
| 7 | /* | 10 | /* |
| 8 | * Stack layout in 'ret_from_exception': | 11 | * Stack layout in 'ret_from_exception': |
diff --git a/arch/m68k/include/asm/thread_info.h b/arch/m68k/include/asm/thread_info.h index f31a3f42b7b3..1da5d53a00eb 100644 --- a/arch/m68k/include/asm/thread_info.h +++ b/arch/m68k/include/asm/thread_info.h | |||
| @@ -1,5 +1,108 @@ | |||
| 1 | #ifdef __uClinux__ | 1 | #ifndef _ASM_M68K_THREAD_INFO_H |
| 2 | #include "thread_info_no.h" | 2 | #define _ASM_M68K_THREAD_INFO_H |
| 3 | |||
| 4 | #include <asm/types.h> | ||
| 5 | #include <asm/page.h> | ||
| 6 | |||
| 7 | /* | ||
| 8 | * On machines with 4k pages we default to an 8k thread size, though we | ||
| 9 | * allow a 4k with config option. Any other machine page size then | ||
| 10 | * the thread size must match the page size (which is 8k and larger here). | ||
| 11 | */ | ||
| 12 | #if PAGE_SHIFT < 13 | ||
| 13 | #ifdef CONFIG_4KSTACKS | ||
| 14 | #define THREAD_SIZE 4096 | ||
| 3 | #else | 15 | #else |
| 4 | #include "thread_info_mm.h" | 16 | #define THREAD_SIZE 8192 |
| 5 | #endif | 17 | #endif |
| 18 | #else | ||
| 19 | #define THREAD_SIZE PAGE_SIZE | ||
| 20 | #endif | ||
| 21 | #define THREAD_SIZE_ORDER ((THREAD_SIZE / PAGE_SIZE) - 1) | ||
| 22 | |||
| 23 | #ifndef __ASSEMBLY__ | ||
| 24 | |||
| 25 | struct thread_info { | ||
| 26 | struct task_struct *task; /* main task structure */ | ||
| 27 | unsigned long flags; | ||
| 28 | struct exec_domain *exec_domain; /* execution domain */ | ||
| 29 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | ||
| 30 | __u32 cpu; /* should always be 0 on m68k */ | ||
| 31 | unsigned long tp_value; /* thread pointer */ | ||
| 32 | struct restart_block restart_block; | ||
| 33 | }; | ||
| 34 | #endif /* __ASSEMBLY__ */ | ||
| 35 | |||
| 36 | #define PREEMPT_ACTIVE 0x4000000 | ||
| 37 | |||
| 38 | #define INIT_THREAD_INFO(tsk) \ | ||
| 39 | { \ | ||
| 40 | .task = &tsk, \ | ||
| 41 | .exec_domain = &default_exec_domain, \ | ||
| 42 | .preempt_count = INIT_PREEMPT_COUNT, \ | ||
| 43 | .restart_block = { \ | ||
| 44 | .fn = do_no_restart_syscall, \ | ||
| 45 | }, \ | ||
| 46 | } | ||
| 47 | |||
| 48 | #define init_stack (init_thread_union.stack) | ||
| 49 | |||
| 50 | #ifdef CONFIG_MMU | ||
| 51 | |||
| 52 | #ifndef __ASSEMBLY__ | ||
| 53 | #include <asm/current.h> | ||
| 54 | #endif | ||
| 55 | |||
| 56 | #ifdef ASM_OFFSETS_C | ||
| 57 | #define task_thread_info(tsk) ((struct thread_info *) NULL) | ||
| 58 | #else | ||
| 59 | #include <asm/asm-offsets.h> | ||
| 60 | #define task_thread_info(tsk) ((struct thread_info *)((char *)tsk+TASK_TINFO)) | ||
| 61 | #endif | ||
| 62 | |||
| 63 | #define init_thread_info (init_task.thread.info) | ||
| 64 | #define task_stack_page(tsk) ((tsk)->stack) | ||
| 65 | #define current_thread_info() task_thread_info(current) | ||
| 66 | |||
| 67 | #define __HAVE_THREAD_FUNCTIONS | ||
| 68 | |||
| 69 | #define setup_thread_stack(p, org) ({ \ | ||
| 70 | *(struct task_struct **)(p)->stack = (p); \ | ||
| 71 | task_thread_info(p)->task = (p); \ | ||
| 72 | }) | ||
| 73 | |||
| 74 | #define end_of_stack(p) ((unsigned long *)(p)->stack + 1) | ||
| 75 | |||
| 76 | #else /* !CONFIG_MMU */ | ||
| 77 | |||
| 78 | #ifndef __ASSEMBLY__ | ||
| 79 | /* how to get the thread information struct from C */ | ||
| 80 | static inline struct thread_info *current_thread_info(void) | ||
| 81 | { | ||
| 82 | struct thread_info *ti; | ||
| 83 | __asm__( | ||
| 84 | "move.l %%sp, %0 \n\t" | ||
| 85 | "and.l %1, %0" | ||
| 86 | : "=&d"(ti) | ||
| 87 | : "di" (~(THREAD_SIZE-1)) | ||
| 88 | ); | ||
| 89 | return ti; | ||
| 90 | } | ||
| 91 | #endif | ||
| 92 | |||
| 93 | #define init_thread_info (init_thread_union.thread_info) | ||
| 94 | |||
| 95 | #endif /* CONFIG_MMU */ | ||
| 96 | |||
| 97 | /* entry.S relies on these definitions! | ||
| 98 | * bits 0-7 are tested at every exception exit | ||
| 99 | * bits 8-15 are also tested at syscall exit | ||
| 100 | */ | ||
| 101 | #define TIF_SIGPENDING 6 /* signal pending */ | ||
| 102 | #define TIF_NEED_RESCHED 7 /* rescheduling necessary */ | ||
| 103 | #define TIF_DELAYED_TRACE 14 /* single step a syscall */ | ||
| 104 | #define TIF_SYSCALL_TRACE 15 /* syscall trace active */ | ||
| 105 | #define TIF_MEMDIE 16 /* is terminating due to OOM killer */ | ||
| 106 | #define TIF_FREEZE 17 /* thread is freezing for suspend */ | ||
| 107 | |||
| 108 | #endif /* _ASM_M68K_THREAD_INFO_H */ | ||
diff --git a/arch/m68k/include/asm/thread_info_mm.h b/arch/m68k/include/asm/thread_info_mm.h deleted file mode 100644 index d08046cf8a4d..000000000000 --- a/arch/m68k/include/asm/thread_info_mm.h +++ /dev/null | |||
| @@ -1,76 +0,0 @@ | |||
| 1 | #ifndef _ASM_M68K_THREAD_INFO_H | ||
| 2 | #define _ASM_M68K_THREAD_INFO_H | ||
| 3 | |||
| 4 | #ifndef ASM_OFFSETS_C | ||
| 5 | #include <asm/asm-offsets.h> | ||
| 6 | #endif | ||
| 7 | #include <asm/types.h> | ||
| 8 | #include <asm/page.h> | ||
| 9 | |||
| 10 | #ifndef __ASSEMBLY__ | ||
| 11 | #include <asm/current.h> | ||
| 12 | |||
| 13 | struct thread_info { | ||
| 14 | struct task_struct *task; /* main task structure */ | ||
| 15 | unsigned long flags; | ||
| 16 | struct exec_domain *exec_domain; /* execution domain */ | ||
| 17 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | ||
| 18 | __u32 cpu; /* should always be 0 on m68k */ | ||
| 19 | unsigned long tp_value; /* thread pointer */ | ||
| 20 | struct restart_block restart_block; | ||
| 21 | }; | ||
| 22 | #endif /* __ASSEMBLY__ */ | ||
| 23 | |||
| 24 | #define PREEMPT_ACTIVE 0x4000000 | ||
| 25 | |||
| 26 | #define INIT_THREAD_INFO(tsk) \ | ||
| 27 | { \ | ||
| 28 | .task = &tsk, \ | ||
| 29 | .exec_domain = &default_exec_domain, \ | ||
| 30 | .preempt_count = INIT_PREEMPT_COUNT, \ | ||
| 31 | .restart_block = { \ | ||
| 32 | .fn = do_no_restart_syscall, \ | ||
| 33 | }, \ | ||
| 34 | } | ||
| 35 | |||
| 36 | /* THREAD_SIZE should be 8k, so handle differently for 4k and 8k machines */ | ||
| 37 | #if PAGE_SHIFT < 13 | ||
| 38 | #define THREAD_SIZE (8192) | ||
| 39 | #else | ||
| 40 | #define THREAD_SIZE PAGE_SIZE | ||
| 41 | #endif | ||
| 42 | #define THREAD_SIZE_ORDER (13 - PAGE_SHIFT) | ||
| 43 | |||
| 44 | #define init_thread_info (init_task.thread.info) | ||
| 45 | #define init_stack (init_thread_union.stack) | ||
| 46 | |||
| 47 | #ifdef ASM_OFFSETS_C | ||
| 48 | #define task_thread_info(tsk) ((struct thread_info *) NULL) | ||
| 49 | #else | ||
| 50 | #define task_thread_info(tsk) ((struct thread_info *)((char *)tsk+TASK_TINFO)) | ||
| 51 | #endif | ||
| 52 | |||
| 53 | #define task_stack_page(tsk) ((tsk)->stack) | ||
| 54 | #define current_thread_info() task_thread_info(current) | ||
| 55 | |||
| 56 | #define __HAVE_THREAD_FUNCTIONS | ||
| 57 | |||
| 58 | #define setup_thread_stack(p, org) ({ \ | ||
| 59 | *(struct task_struct **)(p)->stack = (p); \ | ||
| 60 | task_thread_info(p)->task = (p); \ | ||
| 61 | }) | ||
| 62 | |||
| 63 | #define end_of_stack(p) ((unsigned long *)(p)->stack + 1) | ||
| 64 | |||
| 65 | /* entry.S relies on these definitions! | ||
| 66 | * bits 0-7 are tested at every exception exit | ||
| 67 | * bits 8-15 are also tested at syscall exit | ||
| 68 | */ | ||
| 69 | #define TIF_SIGPENDING 6 /* signal pending */ | ||
| 70 | #define TIF_NEED_RESCHED 7 /* rescheduling necessary */ | ||
| 71 | #define TIF_DELAYED_TRACE 14 /* single step a syscall */ | ||
| 72 | #define TIF_SYSCALL_TRACE 15 /* syscall trace active */ | ||
| 73 | #define TIF_MEMDIE 16 /* is terminating due to OOM killer */ | ||
| 74 | #define TIF_FREEZE 17 /* thread is freezing for suspend */ | ||
| 75 | |||
| 76 | #endif /* _ASM_M68K_THREAD_INFO_H */ | ||
diff --git a/arch/m68k/include/asm/thread_info_no.h b/arch/m68k/include/asm/thread_info_no.h deleted file mode 100644 index 51f354b672e6..000000000000 --- a/arch/m68k/include/asm/thread_info_no.h +++ /dev/null | |||
| @@ -1,102 +0,0 @@ | |||
| 1 | /* thread_info.h: m68knommu low-level thread information | ||
| 2 | * adapted from the i386 and PPC versions by Greg Ungerer (gerg@snapgear.com) | ||
| 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 | #include <asm/page.h> | ||
| 12 | |||
| 13 | #ifdef __KERNEL__ | ||
| 14 | |||
| 15 | /* | ||
| 16 | * Size of kernel stack for each process. This must be a power of 2... | ||
| 17 | */ | ||
| 18 | #ifdef CONFIG_4KSTACKS | ||
| 19 | #define THREAD_SIZE_ORDER (0) | ||
| 20 | #else | ||
| 21 | #define THREAD_SIZE_ORDER (1) | ||
| 22 | #endif | ||
| 23 | |||
| 24 | /* | ||
| 25 | * for asm files, THREAD_SIZE is now generated by asm-offsets.c | ||
| 26 | */ | ||
| 27 | #define THREAD_SIZE (PAGE_SIZE<<THREAD_SIZE_ORDER) | ||
| 28 | |||
| 29 | #ifndef __ASSEMBLY__ | ||
| 30 | |||
| 31 | /* | ||
| 32 | * low level task data. | ||
| 33 | */ | ||
| 34 | struct thread_info { | ||
| 35 | struct task_struct *task; /* main task structure */ | ||
| 36 | struct exec_domain *exec_domain; /* execution domain */ | ||
| 37 | unsigned long flags; /* low level flags */ | ||
| 38 | int cpu; /* cpu we're on */ | ||
| 39 | int preempt_count; /* 0 => preemptable, <0 => BUG */ | ||
| 40 | unsigned long tp_value; /* thread pointer */ | ||
| 41 | struct restart_block restart_block; | ||
| 42 | }; | ||
| 43 | |||
| 44 | /* | ||
| 45 | * macros/functions for gaining access to the thread information structure | ||
| 46 | */ | ||
| 47 | #define INIT_THREAD_INFO(tsk) \ | ||
| 48 | { \ | ||
| 49 | .task = &tsk, \ | ||
| 50 | .exec_domain = &default_exec_domain, \ | ||
| 51 | .flags = 0, \ | ||
| 52 | .cpu = 0, \ | ||
| 53 | .preempt_count = INIT_PREEMPT_COUNT, \ | ||
| 54 | .restart_block = { \ | ||
| 55 | .fn = do_no_restart_syscall, \ | ||
| 56 | }, \ | ||
| 57 | } | ||
| 58 | |||
| 59 | #define init_thread_info (init_thread_union.thread_info) | ||
| 60 | #define init_stack (init_thread_union.stack) | ||
| 61 | |||
| 62 | |||
| 63 | /* how to get the thread information struct from C */ | ||
| 64 | static inline struct thread_info *current_thread_info(void) | ||
| 65 | { | ||
| 66 | struct thread_info *ti; | ||
| 67 | __asm__( | ||
| 68 | "move.l %%sp, %0 \n\t" | ||
| 69 | "and.l %1, %0" | ||
| 70 | : "=&d"(ti) | ||
| 71 | : "di" (~(THREAD_SIZE-1)) | ||
| 72 | ); | ||
| 73 | return ti; | ||
| 74 | } | ||
| 75 | |||
| 76 | #endif /* __ASSEMBLY__ */ | ||
| 77 | |||
| 78 | #define PREEMPT_ACTIVE 0x4000000 | ||
| 79 | |||
| 80 | /* | ||
| 81 | * thread information flag bit numbers | ||
| 82 | */ | ||
| 83 | #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ | ||
| 84 | #define TIF_SIGPENDING 1 /* signal pending */ | ||
| 85 | #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ | ||
| 86 | #define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling | ||
| 87 | TIF_NEED_RESCHED */ | ||
| 88 | #define TIF_MEMDIE 4 /* is terminating due to OOM killer */ | ||
| 89 | #define TIF_FREEZE 16 /* is freezing for suspend */ | ||
| 90 | |||
| 91 | /* as above, but as bit values */ | ||
| 92 | #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE) | ||
| 93 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | ||
| 94 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | ||
| 95 | #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG) | ||
| 96 | #define _TIF_FREEZE (1<<TIF_FREEZE) | ||
| 97 | |||
| 98 | #define _TIF_WORK_MASK 0x0000FFFE /* work to do on interrupt/exception return */ | ||
| 99 | |||
| 100 | #endif /* __KERNEL__ */ | ||
| 101 | |||
| 102 | #endif /* _ASM_THREAD_INFO_H */ | ||
diff --git a/arch/m68knommu/platform/coldfire/entry.S b/arch/m68knommu/platform/coldfire/entry.S index dd7d591f70ea..cd79d7e92ce6 100644 --- a/arch/m68knommu/platform/coldfire/entry.S +++ b/arch/m68knommu/platform/coldfire/entry.S | |||
| @@ -112,7 +112,7 @@ ret_from_exception: | |||
| 112 | andl #-THREAD_SIZE,%d1 /* at base of kernel stack */ | 112 | andl #-THREAD_SIZE,%d1 /* at base of kernel stack */ |
| 113 | movel %d1,%a0 | 113 | movel %d1,%a0 |
| 114 | movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ | 114 | movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ |
| 115 | andl #_TIF_NEED_RESCHED,%d1 | 115 | andl #(1<<TIF_NEED_RESCHED),%d1 |
| 116 | jeq Lkernel_return | 116 | jeq Lkernel_return |
| 117 | 117 | ||
| 118 | movel %a0@(TI_PREEMPTCOUNT),%d1 | 118 | movel %a0@(TI_PREEMPTCOUNT),%d1 |
| @@ -136,7 +136,7 @@ Luser_return: | |||
| 136 | andl #-THREAD_SIZE,%d1 /* at base of kernel stack */ | 136 | andl #-THREAD_SIZE,%d1 /* at base of kernel stack */ |
| 137 | movel %d1,%a0 | 137 | movel %d1,%a0 |
| 138 | movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ | 138 | movel %a0@(TI_FLAGS),%d1 /* get thread_info->flags */ |
| 139 | andl #_TIF_WORK_MASK,%d1 | 139 | andl #0xefff,%d1 |
| 140 | jne Lwork_to_do /* still work to do */ | 140 | jne Lwork_to_do /* still work to do */ |
| 141 | 141 | ||
| 142 | Lreturn: | 142 | Lreturn: |
