Compare commits
2 Commits
991ae4383a
...
7c4b9218f2
Author | SHA1 | Date |
---|---|---|
Bananymous | 7c4b9218f2 | |
Bananymous | 72f8138ca1 |
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#define DEBUG_SCHEDULER 0
|
#define DEBUG_SCHEDULER 0
|
||||||
#define SCHEDULER_ASSERT 1
|
#define SCHEDULER_ASSERT 1
|
||||||
|
#define SCHEDULER_LOAD_BALANCE 0
|
||||||
|
|
||||||
#if SCHEDULER_ASSERT == 0
|
#if SCHEDULER_ASSERT == 0
|
||||||
#undef ASSERT
|
#undef ASSERT
|
||||||
|
@ -295,6 +296,7 @@ namespace Kernel
|
||||||
{
|
{
|
||||||
ASSERT(Processor::get_interrupt_state() == InterruptState::Disabled);
|
ASSERT(Processor::get_interrupt_state() == InterruptState::Disabled);
|
||||||
|
|
||||||
|
if constexpr(SCHEDULER_LOAD_BALANCE)
|
||||||
if (Processor::is_smp_enabled())
|
if (Processor::is_smp_enabled())
|
||||||
do_load_balancing();
|
do_load_balancing();
|
||||||
|
|
||||||
|
@ -386,6 +388,7 @@ namespace Kernel
|
||||||
return least_loaded_id;
|
return least_loaded_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if SCHEDULER_LOAD_BALANCE
|
||||||
void Scheduler::do_load_balancing()
|
void Scheduler::do_load_balancing()
|
||||||
{
|
{
|
||||||
ASSERT(Processor::get_interrupt_state() == InterruptState::Disabled);
|
ASSERT(Processor::get_interrupt_state() == InterruptState::Disabled);
|
||||||
|
@ -563,6 +566,7 @@ namespace Kernel
|
||||||
|
|
||||||
m_last_load_balance_ns += s_load_balance_interval_ns;
|
m_last_load_balance_ns += s_load_balance_interval_ns;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
BAN::ErrorOr<void> Scheduler::add_thread(Thread* thread)
|
BAN::ErrorOr<void> Scheduler::add_thread(Thread* thread)
|
||||||
{
|
{
|
||||||
|
|
|
@ -221,8 +221,9 @@ namespace Kernel
|
||||||
for (uint32_t row = 0; row < m_height; row++)
|
for (uint32_t row = 0; row < m_height; row++)
|
||||||
for (uint32_t col = 0; col < m_width; col++)
|
for (uint32_t col = 0; col < m_width; col++)
|
||||||
putchar_at(' ', col, row);
|
putchar_at(' ', col, row);
|
||||||
|
return reset_ansi();
|
||||||
}
|
}
|
||||||
else if (m_ansi_state.nums[0] == 1)
|
if (m_ansi_state.nums[0] == 1)
|
||||||
{
|
{
|
||||||
// Clear from cursor to the beginning of screen
|
// Clear from cursor to the beginning of screen
|
||||||
for (uint32_t row = 0; row < m_row; row++)
|
for (uint32_t row = 0; row < m_row; row++)
|
||||||
|
@ -230,29 +231,27 @@ namespace Kernel
|
||||||
putchar_at(' ', col, row);
|
putchar_at(' ', col, row);
|
||||||
for (uint32_t i = 0; i <= m_column; i++)
|
for (uint32_t i = 0; i <= m_column; i++)
|
||||||
putchar_at(' ', i, m_row);
|
putchar_at(' ', i, m_row);
|
||||||
}
|
|
||||||
else if (m_ansi_state.nums[0] == 2 || m_ansi_state.nums[0] == 3)
|
|
||||||
{
|
|
||||||
// Clean entire screen
|
|
||||||
clear();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
dprintln("Unsupported ANSI CSI character J");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_ansi_state.nums[0] == 3)
|
|
||||||
{
|
|
||||||
// FIXME: Clear scroll backbuffer if/when added
|
|
||||||
}
|
|
||||||
return reset_ansi();
|
return reset_ansi();
|
||||||
|
}
|
||||||
|
if (m_ansi_state.nums[0] == 2 || m_ansi_state.nums[0] == 3)
|
||||||
|
{
|
||||||
|
// FIXME: if num == 3 clear scrollback buffer
|
||||||
|
clear();
|
||||||
|
return reset_ansi();
|
||||||
|
}
|
||||||
|
reset_ansi();
|
||||||
|
dprintln("Unsupported ANSI CSI character J");
|
||||||
|
return;
|
||||||
case 'K': // Erase in Line
|
case 'K': // Erase in Line
|
||||||
if (m_ansi_state.nums[0] == -1 || m_ansi_state.nums[0] == 0)
|
if (m_ansi_state.nums[0] == -1 || m_ansi_state.nums[0] == 0)
|
||||||
|
{
|
||||||
for (uint32_t i = m_column; i < m_width; i++)
|
for (uint32_t i = m_column; i < m_width; i++)
|
||||||
putchar_at(' ', i, m_row);
|
putchar_at(' ', i, m_row);
|
||||||
else
|
|
||||||
dprintln("Unsupported ANSI CSI character K");
|
|
||||||
return reset_ansi();
|
return reset_ansi();
|
||||||
|
}
|
||||||
|
reset_ansi();
|
||||||
|
dprintln("Unsupported ANSI CSI character K");
|
||||||
|
return;
|
||||||
case 'L': // Insert Line
|
case 'L': // Insert Line
|
||||||
if (m_ansi_state.nums[0] == -1)
|
if (m_ansi_state.nums[0] == -1)
|
||||||
m_ansi_state.nums[0] = 1;
|
m_ansi_state.nums[0] = 1;
|
||||||
|
@ -286,14 +285,17 @@ namespace Kernel
|
||||||
putchar_at(' ', x, m_height - y_off - 1);
|
putchar_at(' ', x, m_height - y_off - 1);
|
||||||
return reset_ansi();
|
return reset_ansi();
|
||||||
case 'S': // Scroll Up
|
case 'S': // Scroll Up
|
||||||
|
reset_ansi();
|
||||||
dprintln("Unsupported ANSI CSI character S");
|
dprintln("Unsupported ANSI CSI character S");
|
||||||
return reset_ansi();
|
return;
|
||||||
case 'T': // Scroll Down
|
case 'T': // Scroll Down
|
||||||
|
reset_ansi();
|
||||||
dprintln("Unsupported ANSI CSI character T");
|
dprintln("Unsupported ANSI CSI character T");
|
||||||
return reset_ansi();
|
return;
|
||||||
case 'f': // Horizontal Vertical Position
|
case 'f': // Horizontal Vertical Position
|
||||||
|
reset_ansi();
|
||||||
dprintln("Unsupported ANSI CSI character f");
|
dprintln("Unsupported ANSI CSI character f");
|
||||||
return reset_ansi();
|
return;
|
||||||
case 'm':
|
case 'm':
|
||||||
handle_ansi_csi_color();
|
handle_ansi_csi_color();
|
||||||
return reset_ansi();
|
return reset_ansi();
|
||||||
|
@ -331,25 +333,28 @@ namespace Kernel
|
||||||
m_row = BAN::Math::clamp<uint32_t>(m_ansi_state.nums[0], 1, m_height) - 1;
|
m_row = BAN::Math::clamp<uint32_t>(m_ansi_state.nums[0], 1, m_height) - 1;
|
||||||
return reset_ansi();
|
return reset_ansi();
|
||||||
case '?':
|
case '?':
|
||||||
if (m_ansi_state.index != 0 || m_ansi_state.nums[0] != -1)
|
if (m_ansi_state.index == 0 || m_ansi_state.nums[0] == -1)
|
||||||
{
|
{
|
||||||
dprintln("invalid ANSI CSI ?");
|
m_ansi_state.question = true;
|
||||||
return reset_ansi();
|
return reset_ansi();
|
||||||
}
|
}
|
||||||
m_ansi_state.question = true;
|
reset_ansi();
|
||||||
|
dprintln("invalid ANSI CSI ?");
|
||||||
return;
|
return;
|
||||||
case 'h':
|
case 'h':
|
||||||
case 'l':
|
case 'l':
|
||||||
if (!m_ansi_state.question || m_ansi_state.nums[0] != 25)
|
if (m_ansi_state.question && m_ansi_state.nums[0] == 25)
|
||||||
{
|
{
|
||||||
dprintln("invalid ANSI CSI ?{}{}", m_ansi_state.nums[0], (char)ch);
|
|
||||||
return reset_ansi();
|
|
||||||
}
|
|
||||||
m_show_cursor = (ch == 'h');
|
m_show_cursor = (ch == 'h');
|
||||||
return reset_ansi();
|
return reset_ansi();
|
||||||
|
}
|
||||||
|
reset_ansi();
|
||||||
|
dprintln("invalid ANSI CSI ?{}{}", m_ansi_state.nums[0], (char)ch);
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
|
reset_ansi();
|
||||||
dprintln("Unsupported ANSI CSI character {}", ch);
|
dprintln("Unsupported ANSI CSI character {}", ch);
|
||||||
return reset_ansi();
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue