1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

set TS flag at boot timer to detect the first FPU access

- the first FPU access requires an FPU init
This commit is contained in:
Stefan Lankes 2016-02-20 12:29:38 +01:00
parent 83bbd08ef7
commit f5644ef74a
3 changed files with 15 additions and 8 deletions

View file

@ -722,8 +722,17 @@ static inline void register_task(void)
*/
inline static int system_calibration(void)
{
size_t cr0;
apic_init();
register_task();
// set task switched flag for the first FPU access
// => initialize the FPU
cr0 = read_cr0();
cr0 |= CR0_TS;
write_cr0(cr0);
irq_enable();
detect_cpu_frequency();
apic_calibration();

View file

@ -669,6 +669,12 @@ int smp_start(void)
//kprintf("CR0 of core %u: 0x%x\n", atomic_int32_read(&current_boot_id), read_cr0());
online[atomic_int32_read(&current_boot_id)] = 1;
// set task switched flag for the first FPU access
// => initialize the FPU
size_t cr0 = read_cr0();
cr0 |= CR0_TS;
write_cr0(cr0);
set_idle_task();
irq_enable();

View file

@ -97,14 +97,6 @@ static int thread_entry(void* arg, size_t ep)
if (init_tls())
return -ENOMEM;
#ifndef SAVE_FPU
// set task switched flag for the first FPU access
// => initialize the FPU
size_t cr0 = read_cr0();
cr0 |= CR0_TS;
write_cr0(cr0);
#endif
//vma_dump();
// set first argument