All: Start work again on sse support
This commit is contained in:
parent
5d83ab2289
commit
4307968182
|
@ -4,8 +4,8 @@ if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "banan-os")
|
||||||
message(FATAL_ERROR "CMAKE_SYSTEM_NAME is not banan-os")
|
message(FATAL_ERROR "CMAKE_SYSTEM_NAME is not banan-os")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_compile_options(-mno-sse -mno-sse2)
|
#add_compile_options(-mno-sse -mno-sse2)
|
||||||
add_compile_definitions(__enable_sse=0)
|
add_compile_definitions(__enable_sse=1)
|
||||||
|
|
||||||
project(banan-os CXX C ASM)
|
project(banan-os CXX C ASM)
|
||||||
|
|
||||||
|
|
|
@ -303,9 +303,7 @@ done:
|
||||||
extern "C" void cpp_irq_handler(uint64_t irq, InterruptStack& interrupt_stack)
|
extern "C" void cpp_irq_handler(uint64_t irq, InterruptStack& interrupt_stack)
|
||||||
{
|
{
|
||||||
#if __enable_sse
|
#if __enable_sse
|
||||||
bool from_userspace = (interrupt_stack.cs & 0b11) == 0b11;
|
Thread::current().save_sse();
|
||||||
if (from_userspace)
|
|
||||||
Thread::current().save_sse();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Scheduler::current_tid())
|
if (Scheduler::current_tid())
|
||||||
|
@ -330,11 +328,7 @@ done:
|
||||||
ASSERT(Thread::current().state() != Thread::State::Terminated);
|
ASSERT(Thread::current().state() != Thread::State::Terminated);
|
||||||
|
|
||||||
#if __enable_sse
|
#if __enable_sse
|
||||||
if (from_userspace)
|
Thread::current().load_sse();
|
||||||
{
|
|
||||||
ASSERT(Thread::current().state() == Thread::State::Executing);
|
|
||||||
Thread::current().load_sse();
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,11 @@ namespace Kernel
|
||||||
|
|
||||||
Thread::Thread(pid_t tid, Process* process)
|
Thread::Thread(pid_t tid, Process* process)
|
||||||
: m_tid(tid), m_process(process)
|
: m_tid(tid), m_process(process)
|
||||||
{}
|
{
|
||||||
|
#if __enable_sse
|
||||||
|
save_sse();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
Thread& Thread::current()
|
Thread& Thread::current()
|
||||||
{
|
{
|
||||||
|
|
|
@ -124,7 +124,12 @@ static void floating_point_to_string(char* buffer, T value, bool upper, const fo
|
||||||
{
|
{
|
||||||
if (isnan(value))
|
if (isnan(value))
|
||||||
{
|
{
|
||||||
strcpy(buffer, "-nan");
|
if (value < (T)0.0)
|
||||||
|
{
|
||||||
|
*buffer = '-';
|
||||||
|
buffer++;
|
||||||
|
}
|
||||||
|
strcpy(buffer, upper ? "NAN" : "nan");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +152,7 @@ static void floating_point_to_string(char* buffer, T value, bool upper, const fo
|
||||||
|
|
||||||
if (isinf(value))
|
if (isinf(value))
|
||||||
{
|
{
|
||||||
strcpy(buffer + offset, "inf");
|
strcpy(buffer + offset, upper ? "INF" : "inf");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,10 +210,6 @@ static void floating_point_to_string(char* buffer, T value, bool upper, const fo
|
||||||
template<BAN::floating_point T>
|
template<BAN::floating_point T>
|
||||||
static void floating_point_to_exponent_string(char* buffer, T value, bool upper, const format_options_t options)
|
static void floating_point_to_exponent_string(char* buffer, T value, bool upper, const format_options_t options)
|
||||||
{
|
{
|
||||||
int percision = 6;
|
|
||||||
if (options.percision != -1)
|
|
||||||
percision = options.percision;
|
|
||||||
|
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
|
|
||||||
// Add sign if needed
|
// Add sign if needed
|
||||||
|
|
Loading…
Reference in New Issue