diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2006-06-21 08:31:52 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-06-22 05:24:18 -0400 |
commit | d6551e884cf66de072b81f8b6d23259462c40baf (patch) | |
tree | fd8af193bd045e4b16ce911d392d7ffd109d7284 /arch/arm/kernel/process.c | |
parent | 52ab3f3dc711eeccbfbcc5d4f5c5d9b9ff59650f (diff) |
[ARM] Add thread_notify infrastructure
Some machine classes need to allow VFP support to be built into the
kernel, but still allow the kernel to run even though VFP isn't
present. Unfortunately, the kernel hard-codes VFP instructions
into the thread switch, which prevents this being run-time selectable.
Solve this by introducing a notifier which things such as VFP can
hook into to be informed of events which affect the VFP subsystem
(eg, creation and destruction of threads, switches between threads.)
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/kernel/process.c')
-rw-r--r-- | arch/arm/kernel/process.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 17c38dbf2f3c..e1c77ee885a7 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/leds.h> | 33 | #include <asm/leds.h> |
34 | #include <asm/processor.h> | 34 | #include <asm/processor.h> |
35 | #include <asm/system.h> | 35 | #include <asm/system.h> |
36 | #include <asm/thread_notify.h> | ||
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
37 | #include <asm/mach/time.h> | 38 | #include <asm/mach/time.h> |
38 | 39 | ||
@@ -338,13 +339,9 @@ void exit_thread(void) | |||
338 | { | 339 | { |
339 | } | 340 | } |
340 | 341 | ||
341 | static void default_fp_init(union fp_state *fp) | 342 | ATOMIC_NOTIFIER_HEAD(thread_notify_head); |
342 | { | ||
343 | memset(fp, 0, sizeof(union fp_state)); | ||
344 | } | ||
345 | 343 | ||
346 | void (*fp_init)(union fp_state *) = default_fp_init; | 344 | EXPORT_SYMBOL_GPL(thread_notify_head); |
347 | EXPORT_SYMBOL(fp_init); | ||
348 | 345 | ||
349 | void flush_thread(void) | 346 | void flush_thread(void) |
350 | { | 347 | { |
@@ -353,22 +350,21 @@ void flush_thread(void) | |||
353 | 350 | ||
354 | memset(thread->used_cp, 0, sizeof(thread->used_cp)); | 351 | memset(thread->used_cp, 0, sizeof(thread->used_cp)); |
355 | memset(&tsk->thread.debug, 0, sizeof(struct debug_info)); | 352 | memset(&tsk->thread.debug, 0, sizeof(struct debug_info)); |
353 | memset(&thread->fpstate, 0, sizeof(union fp_state)); | ||
354 | |||
355 | thread_notify(THREAD_NOTIFY_FLUSH, thread); | ||
356 | #if defined(CONFIG_IWMMXT) | 356 | #if defined(CONFIG_IWMMXT) |
357 | iwmmxt_task_release(thread); | 357 | iwmmxt_task_release(thread); |
358 | #endif | 358 | #endif |
359 | fp_init(&thread->fpstate); | ||
360 | #if defined(CONFIG_VFP) | ||
361 | vfp_flush_thread(&thread->vfpstate); | ||
362 | #endif | ||
363 | } | 359 | } |
364 | 360 | ||
365 | void release_thread(struct task_struct *dead_task) | 361 | void release_thread(struct task_struct *dead_task) |
366 | { | 362 | { |
367 | #if defined(CONFIG_VFP) | 363 | struct thread_info *thread = task_thread_info(dead_task); |
368 | vfp_release_thread(&task_thread_info(dead_task)->vfpstate); | 364 | |
369 | #endif | 365 | thread_notify(THREAD_NOTIFY_RELEASE, thread); |
370 | #if defined(CONFIG_IWMMXT) | 366 | #if defined(CONFIG_IWMMXT) |
371 | iwmmxt_task_release(task_thread_info(dead_task)); | 367 | iwmmxt_task_release(thread); |
372 | #endif | 368 | #endif |
373 | } | 369 | } |
374 | 370 | ||