39 lines
846 B
C++
39 lines
846 B
C++
/*
|
|
* \brief Kernel backend for protection domains
|
|
* \author Stefan Kalkowski
|
|
* \date 2015-03-20
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2015 Genode Labs GmbH
|
|
*
|
|
* This file is part of the Genode OS framework, which is distributed
|
|
* under the terms of the GNU General Public License version 2.
|
|
*/
|
|
|
|
/* core includes */
|
|
#include <cpu.h>
|
|
#include <kernel/pd.h>
|
|
|
|
void Genode::Cpu::_init_fpu()
|
|
{
|
|
Cr0::access_t cr0_value = Cr0::read();
|
|
Cr4::access_t cr4_value = Cr4::read();
|
|
|
|
Cr0::Mp::set(cr0_value);
|
|
Cr0::Em::clear(cr0_value);
|
|
Cr0::Ts::set(cr0_value);
|
|
Cr0::Ne::set(cr0_value);
|
|
Cr0::write(cr0_value);
|
|
|
|
Cr4::Osfxsr::set(cr4_value);
|
|
Cr4::Osxmmexcpt::set(cr4_value);
|
|
Cr4::write(cr4_value);
|
|
}
|
|
|
|
|
|
void Genode::Cpu::_disable_fpu() { Cr0::write(Cr0::read() | Cr0::Ts::bits(1)); }
|
|
|
|
|
|
bool Genode::Cpu::_fpu_enabled() { return !Cr0::Ts::get(Cr0::read()); }
|