forked from Bananymous/banan-os
Kernel: Remove is_in_syscall from Thread
This commit is contained in:
parent
5e434f5131
commit
6f7d97cf94
|
@ -161,7 +161,7 @@ namespace IDT
|
||||||
Kernel::Thread::current().set_return_rip(interrupt_stack.rip);
|
Kernel::Thread::current().set_return_rip(interrupt_stack.rip);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tid && Kernel::Thread::current().is_userspace() && !Kernel::Thread::current().is_in_syscall())
|
if (tid && Kernel::Thread::current().is_userspace())
|
||||||
{
|
{
|
||||||
// TODO: Confirm and fix the exception to signal mappings
|
// TODO: Confirm and fix the exception to signal mappings
|
||||||
|
|
||||||
|
|
|
@ -80,10 +80,7 @@ namespace Kernel
|
||||||
Process& process();
|
Process& process();
|
||||||
bool has_process() const { return m_process; }
|
bool has_process() const { return m_process; }
|
||||||
|
|
||||||
void set_in_syscall(bool b) { m_in_syscall = b; }
|
|
||||||
|
|
||||||
bool is_userspace() const { return m_is_userspace; }
|
bool is_userspace() const { return m_is_userspace; }
|
||||||
bool is_in_syscall() const { return m_in_syscall; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Thread(pid_t tid, Process*);
|
Thread(pid_t tid, Process*);
|
||||||
|
@ -102,7 +99,6 @@ namespace Kernel
|
||||||
const pid_t m_tid { 0 };
|
const pid_t m_tid { 0 };
|
||||||
State m_state { State::NotStarted };
|
State m_state { State::NotStarted };
|
||||||
Process* m_process { nullptr };
|
Process* m_process { nullptr };
|
||||||
bool m_in_syscall { false };
|
|
||||||
bool m_is_userspace { false };
|
bool m_is_userspace { false };
|
||||||
|
|
||||||
uintptr_t* m_return_rsp { nullptr };
|
uintptr_t* m_return_rsp { nullptr };
|
||||||
|
|
|
@ -20,7 +20,6 @@ namespace Kernel
|
||||||
|
|
||||||
extern "C" long cpp_syscall_handler(int syscall, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, InterruptStack& interrupt_stack)
|
extern "C" long cpp_syscall_handler(int syscall, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5, InterruptStack& interrupt_stack)
|
||||||
{
|
{
|
||||||
Thread::current().set_in_syscall(true);
|
|
||||||
Thread::current().set_return_rsp(interrupt_stack.rsp);
|
Thread::current().set_return_rsp(interrupt_stack.rsp);
|
||||||
Thread::current().set_return_rip(interrupt_stack.rip);
|
Thread::current().set_return_rip(interrupt_stack.rip);
|
||||||
|
|
||||||
|
@ -173,8 +172,6 @@ namespace Kernel
|
||||||
|
|
||||||
asm volatile("cli");
|
asm volatile("cli");
|
||||||
|
|
||||||
Thread::current().set_in_syscall(false);
|
|
||||||
|
|
||||||
if (ret.is_error())
|
if (ret.is_error())
|
||||||
return -ret.error().get_error_code();
|
return -ret.error().get_error_code();
|
||||||
return ret.value();
|
return ret.value();
|
||||||
|
|
|
@ -153,7 +153,6 @@ namespace Kernel
|
||||||
thread->m_stack = TRY(m_stack->clone(new_process->page_table()));
|
thread->m_stack = TRY(m_stack->clone(new_process->page_table()));
|
||||||
|
|
||||||
thread->m_state = State::Executing;
|
thread->m_state = State::Executing;
|
||||||
thread->m_in_syscall = true;
|
|
||||||
|
|
||||||
thread->m_rip = rip;
|
thread->m_rip = rip;
|
||||||
thread->m_rsp = rsp;
|
thread->m_rsp = rsp;
|
||||||
|
|
Loading…
Reference in New Issue