Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 826 → Rev 827

/kernel/trunk/generic/include/fpu_context.h
35,7 → 35,7
 
extern void fpu_context_save(fpu_context_t *);
extern void fpu_context_restore(fpu_context_t *);
extern void fpu_init(void);
extern void fpu_init(fpu_context_t *);
extern void fpu_enable(void);
extern void fpu_disable(void);
 
/kernel/trunk/generic/include/mm/frame.h
57,13 → 57,8
{
__address e1 = s1+sz1;
__address e2 = s2+sz2;
if (s1 >= s2 && s1 < e2)
return 1;
if (e1 >= s2 && e1 < e2)
return 1;
if ((s1 < s2) && (e1 >= e2))
return 1;
return 0;
 
return s1 < e2 && s2 < e1;
}
 
static inline __address PFN2ADDR(pfn_t frame)
/kernel/trunk/generic/src/proc/scheduler.c
55,6 → 55,8
* taken before the newly selected
* tread is passed control.
*
* THREAD->lock is locked on entry
*
*/
void before_thread_runs(void)
{
69,7 → 71,7
if (THREAD->fpu_context_exists)
fpu_context_restore(&(THREAD->saved_fpu_context));
else {
fpu_init();
fpu_init(&(THREAD->saved_fpu_context));
THREAD->fpu_context_exists=1;
}
#endif
79,19 → 81,29
void scheduler_fpu_lazy_request(void)
{
fpu_enable();
spinlock_lock(&CPU->lock);
 
/* Save old context */
if (CPU->fpu_owner != NULL) {
spinlock_lock(&CPU->fpu_owner->lock);
fpu_context_save(&CPU->fpu_owner->saved_fpu_context);
/* don't prevent migration */
CPU->fpu_owner->fpu_context_engaged=0;
spinlock_unlock(&CPU->fpu_owner->lock);
}
 
spinlock_lock(&THREAD->lock);
if (THREAD->fpu_context_exists)
fpu_context_restore(&THREAD->saved_fpu_context);
else {
fpu_init();
fpu_init(&(THREAD->saved_fpu_context));
THREAD->fpu_context_exists=1;
}
CPU->fpu_owner=THREAD;
THREAD->fpu_context_engaged = 1;
 
spinlock_unlock(&THREAD->lock);
spinlock_unlock(&CPU->lock);
}
#endif