Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

m68k: remove thread_info struct from thread struct

Currently on m68k we have a comeplete thread_info structure stored inside
of the thread_struct, and we also have it in the initial part of the kernel
stack. Mostly the code currently uses the one inside of the thread_struct,
only using the "task" pointer from the stack based one.

This is wasteful and confusing, we should only have the single instance of
thread_info inside the stack page. And this is the norm for all other
architectures.

This change makes m68k handle thread_info consistently on both MMU enabled
and non-MMU setups.

Signed-off-by: Greg Ungerer <gerg@uclinux.org>

+22 -43
-2
arch/m68k/include/asm/processor.h
··· 88 88 unsigned long fp[8*3]; 89 89 unsigned long fpcntl[3]; /* fp control regs */ 90 90 unsigned char fpstate[FPSTATESIZE]; /* floating point state */ 91 - struct thread_info info; 92 91 }; 93 92 94 93 #define INIT_THREAD { \ 95 94 .ksp = sizeof(init_stack) + (unsigned long) init_stack, \ 96 95 .sr = PS_S, \ 97 96 .fs = __KERNEL_DS, \ 98 - .info = INIT_THREAD_INFO(init_task), \ 99 97 } 100 98 101 99 #ifdef CONFIG_MMU
-30
arch/m68k/include/asm/thread_info.h
··· 47 47 48 48 #define init_stack (init_thread_union.stack) 49 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_INFO)) 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 50 #ifndef __ASSEMBLY__ 79 51 /* how to get the thread information struct from C */ 80 52 static inline struct thread_info *current_thread_info(void) ··· 63 91 #endif 64 92 65 93 #define init_thread_info (init_thread_union.thread_info) 66 - 67 - #endif /* CONFIG_MMU */ 68 94 69 95 /* entry.S relies on these definitions! 70 96 * bits 0-7 are tested at every exception exit
+1 -1
arch/m68k/kernel/asm-offsets.c
··· 24 24 /* offsets into the task struct */ 25 25 DEFINE(TASK_THREAD, offsetof(struct task_struct, thread)); 26 26 DEFINE(TASK_MM, offsetof(struct task_struct, mm)); 27 - DEFINE(TASK_INFO, offsetof(struct task_struct, thread.info)); 27 + DEFINE(TASK_STACK, offsetof(struct task_struct, stack)); 28 28 29 29 /* offsets into the thread struct */ 30 30 DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
+21 -10
arch/m68k/kernel/entry_mm.S
··· 99 99 jra .Lret_from_exception 100 100 101 101 ENTRY(ret_from_signal) 102 - tstb %curptr@(TASK_INFO+TINFO_FLAGS+2) 102 + movel %curptr@(TASK_STACK),%a1 103 + tstb %a1@(TINFO_FLAGS+2) 103 104 jge 1f 104 105 jbsr syscall_trace 105 106 1: RESTORE_SWITCH_STACK ··· 121 120 SAVE_ALL_SYS 122 121 123 122 GET_CURRENT(%d1) 123 + movel %d1,%a1 124 + 124 125 | save top of frame 125 126 movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0) 126 127 127 128 | syscall trace? 128 - tstb %curptr@(TASK_INFO+TINFO_FLAGS+2) 129 + tstb %a1@(TINFO_FLAGS+2) 129 130 jmi do_trace_entry 130 131 cmpl #NR_syscalls,%d0 131 132 jcc badsys ··· 136 133 movel %d0,%sp@(PT_OFF_D0) | save the return value 137 134 ret_from_syscall: 138 135 |oriw #0x0700,%sr 139 - movew %curptr@(TASK_INFO+TINFO_FLAGS+2),%d0 136 + movel %curptr@(TASK_STACK),%a1 137 + movew %a1@(TINFO_FLAGS+2),%d0 140 138 jne syscall_exit_work 141 139 1: RESTORE_ALL 142 140 ··· 163 159 andw #ALLOWINT,%sr 164 160 165 161 resume_userspace: 166 - moveb %curptr@(TASK_INFO+TINFO_FLAGS+3),%d0 162 + movel %curptr@(TASK_STACK),%a1 163 + moveb %a1@(TINFO_FLAGS+3),%d0 167 164 jne exit_work 168 165 1: RESTORE_ALL 169 166 ··· 204 199 ENTRY(auto_inthandler) 205 200 SAVE_ALL_INT 206 201 GET_CURRENT(%d0) 207 - addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 202 + movel %d0,%a1 203 + addqb #1,%a1@(TINFO_PREEMPT+1) 208 204 | put exception # in d0 209 205 bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 210 206 subw #VEC_SPUR,%d0 ··· 217 211 addql #8,%sp | pop parameters off stack 218 212 219 213 ret_from_interrupt: 220 - subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 214 + movel %curptr@(TASK_STACK),%a1 215 + subqb #1,%a1@(TINFO_PREEMPT+1) 221 216 jeq ret_from_last_interrupt 222 217 2: RESTORE_ALL 223 218 ··· 239 232 ENTRY(user_inthandler) 240 233 SAVE_ALL_INT 241 234 GET_CURRENT(%d0) 242 - addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 235 + movel %d0,%a1 236 + addqb #1,%a1@(TINFO_PREEMPT+1) 243 237 | put exception # in d0 244 238 bfextu %sp@(PT_OFF_FORMATVEC){#4,#10},%d0 245 239 user_irqvec_fixup = . + 2 ··· 251 243 jsr do_IRQ | process the IRQ 252 244 addql #8,%sp | pop parameters off stack 253 245 254 - subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 246 + movel %curptr@(TASK_STACK),%a1 247 + subqb #1,%a1@(TINFO_PREEMPT+1) 255 248 jeq ret_from_last_interrupt 256 249 RESTORE_ALL 257 250 ··· 261 252 ENTRY(bad_inthandler) 262 253 SAVE_ALL_INT 263 254 GET_CURRENT(%d0) 264 - addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 255 + movel %d0,%a1 256 + addqb #1,%a1@(TINFO_PREEMPT+1) 265 257 266 258 movel %sp,%sp@- 267 259 jsr handle_badint 268 260 addql #4,%sp 269 261 270 - subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) 262 + movel %curptr@(TASK_STACK),%a1 263 + subqb #1,%a1@(TINFO_PREEMPT+1) 271 264 jeq ret_from_last_interrupt 272 265 RESTORE_ALL 273 266