All: Start work again on sse support

This commit is contained in:
Bananymous 2023-12-28 19:14:42 +02:00
parent 5d83ab2289
commit 4307968182
4 changed files with 16 additions and 17 deletions

View File

@ -4,8 +4,8 @@ if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "banan-os")
message(FATAL_ERROR "CMAKE_SYSTEM_NAME is not banan-os")
endif ()
add_compile_options(-mno-sse -mno-sse2)
add_compile_definitions(__enable_sse=0)
#add_compile_options(-mno-sse -mno-sse2)
add_compile_definitions(__enable_sse=1)
project(banan-os CXX C ASM)

View File

@ -303,9 +303,7 @@ done:
extern "C" void cpp_irq_handler(uint64_t irq, InterruptStack& interrupt_stack)
{
#if __enable_sse
bool from_userspace = (interrupt_stack.cs & 0b11) == 0b11;
if (from_userspace)
Thread::current().save_sse();
Thread::current().save_sse();
#endif
if (Scheduler::current_tid())
@ -330,11 +328,7 @@ done:
ASSERT(Thread::current().state() != Thread::State::Terminated);
#if __enable_sse
if (from_userspace)
{
ASSERT(Thread::current().state() == Thread::State::Executing);
Thread::current().load_sse();
}
Thread::current().load_sse();
#endif
}

View File

@ -99,7 +99,11 @@ namespace Kernel
Thread::Thread(pid_t tid, Process* process)
: m_tid(tid), m_process(process)
{}
{
#if __enable_sse
save_sse();
#endif
}
Thread& Thread::current()
{

View File

@ -124,7 +124,12 @@ static void floating_point_to_string(char* buffer, T value, bool upper, const fo
{
if (isnan(value))
{
strcpy(buffer, "-nan");
if (value < (T)0.0)
{
*buffer = '-';
buffer++;
}
strcpy(buffer, upper ? "NAN" : "nan");
return;
}
@ -147,7 +152,7 @@ static void floating_point_to_string(char* buffer, T value, bool upper, const fo
if (isinf(value))
{
strcpy(buffer + offset, "inf");
strcpy(buffer + offset, upper ? "INF" : "inf");
return;
}
@ -205,10 +210,6 @@ static void floating_point_to_string(char* buffer, T value, bool upper, const fo
template<BAN::floating_point T>
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;
// Add sign if needed