/kernel/trunk/test/fpu/mips1/test.c |
---|
47,8 → 47,6 |
static void testit1(void *data) |
{ |
int i; |
volatile long long j; |
double e,d,le,f; |
int arg __attribute__((aligned(16))) = (int)((__native) data); |
int after_arg __attribute__((aligned(16))); |
77,8 → 75,6 |
static void testit2(void *data) |
{ |
int i; |
volatile long long j; |
double e,d,le,f; |
int arg __attribute__((aligned(16))) = (int)((__native) data); |
int after_arg __attribute__((aligned(16))); |
129,7 → 125,7 |
thread_sleep(1); |
waitq_wakeup(&can_start, WAKEUP_ALL); |
while (threads_ok != THREADS) |
while (atomic_get(&threads_ok) != THREADS) |
; |
printf("Test passed.\n"); |
/kernel/trunk/test/fpu/fpu1/test.c |
---|
126,7 → 126,7 |
thread_sleep(1); |
waitq_wakeup(&can_start, WAKEUP_ALL); |
while (threads_ok != THREADS) |
while (atomic_get(&threads_ok) != THREADS) |
; |
printf("Test passed.\n"); |
/kernel/trunk/test/fpu/sse1/test.c |
---|
47,8 → 47,6 |
static void testit1(void *data) |
{ |
int i; |
volatile long long j; |
double e,d,le,f; |
int arg __attribute__((aligned(16))) = (int)((__native) data); |
int after_arg __attribute__((aligned(16))); |
77,8 → 75,6 |
static void testit2(void *data) |
{ |
int i; |
volatile long long j; |
double e,d,le,f; |
int arg __attribute__((aligned(16))) = (int)((__native) data); |
int after_arg __attribute__((aligned(16))); |
129,7 → 125,7 |
thread_sleep(1); |
waitq_wakeup(&can_start, WAKEUP_ALL); |
while (threads_ok != THREADS) |
while (atomic_get(&threads_ok) != THREADS) |
; |
printf("Test passed.\n"); |
/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 |
/kernel/trunk/arch/amd64/src/fpu_context.c |
---|
56,7 → 56,7 |
); |
} |
void fpu_init(void) |
void fpu_init(fpu_context_t *fctx) |
{ |
/* TODO: Zero all SSE, MMX etc. registers */ |
__asm__ volatile ( |
/kernel/trunk/arch/mips32/src/fpu_context.c |
---|
50,7 → 50,7 |
#endif |
} |
void fpu_init(void) |
void fpu_init(fpu_context_t *fctx) |
{ |
/* TODO: Zero all registers */ |
} |
/kernel/trunk/arch/ia32/src/fpu_context.c |
---|
48,7 → 48,7 |
); |
} |
void fpu_init(void) |
void fpu_init(fpu_context_t *fctx) |
{ |
__asm__ volatile ( |
"fninit;" |