Kernel: better handle kernel errors

This commit is contained in:
Bananymous 2023-08-29 00:13:21 +03:00
parent 8032824054
commit 250789aa20
2 changed files with 8 additions and 0 deletions

View File

@ -48,6 +48,11 @@ namespace BAN
{
return (Kernel::ErrorCode)(m_error_code & ~kernel_error_mask);
}
bool is_kernel_error() const
{
return m_error_code & kernel_error_mask;
}
#endif
uint64_t get_error_code() const { return m_error_code; }

View File

@ -186,6 +186,9 @@ namespace Kernel
asm volatile("cli");
if (ret.is_error() && ret.error().is_kernel_error())
Kernel::panic("Kernel error while returning to userspace {}", ret.error());
ASSERT(Kernel::Thread::current().state() == Kernel::Thread::State::Executing);
Thread::current().load_sse();