mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-18 02:40:08 +00:00
hw: enable FPU during CPU startup on x86
Also disable TS (task switch) flag in cr0 during kernel initialization, so FPU faults are not raised. This became necessary since GCC lately aggressively generates FPU instructions at arbitrary places and also at early kernel-bootstrapping stages. fixes #3365
This commit is contained in:
parent
e60b597af5
commit
f18285205c
@ -157,6 +157,23 @@ __gdt:
|
||||
movq (%rax), %rsp
|
||||
addq %rcx, %rsp
|
||||
|
||||
/*
|
||||
* Enable paging and FPU:
|
||||
* PE, MP, NE, WP, PG
|
||||
*/
|
||||
mov $0x80010023, %rax
|
||||
mov %rax, %cr0
|
||||
|
||||
/*
|
||||
* OSFXSR and OSXMMEXCPT for SSE FPU support
|
||||
*/
|
||||
mov %cr4, %rax
|
||||
bts $9, %rax
|
||||
bts $10, %rax
|
||||
mov %rax, %cr4
|
||||
|
||||
fninit
|
||||
|
||||
/* kernel-initialization */
|
||||
call init
|
||||
|
||||
|
@ -21,7 +21,12 @@ void Genode::Fpu::init()
|
||||
|
||||
Cpu::Cr0::Mp::set(cr0_value);
|
||||
Cpu::Cr0::Em::clear(cr0_value);
|
||||
Cpu::Cr0::Ts::set(cr0_value);
|
||||
|
||||
/*
|
||||
* Clear task switched so we do not gnerate FPU faults during kernel
|
||||
* initialisation, it will be turned on by Fpu::disable
|
||||
*/
|
||||
Cpu::Cr0::Ts::clear(cr0_value);
|
||||
Cpu::Cr0::Ne::set(cr0_value);
|
||||
Cpu::Cr0::write(cr0_value);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user