From 2600acc96c0f8bc45d5bc1637bee41fab2b285bb Mon Sep 17 00:00:00 2001 From: apio Date: Mon, 26 Dec 2022 12:46:07 +0100 Subject: [PATCH] Thread: Add init_regs_user() --- kernel/src/arch/x86_64/Thread.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/src/arch/x86_64/Thread.cpp b/kernel/src/arch/x86_64/Thread.cpp index b9b76d59..042ef119 100644 --- a/kernel/src/arch/x86_64/Thread.cpp +++ b/kernel/src/arch/x86_64/Thread.cpp @@ -34,6 +34,14 @@ void Thread::init_regs_kernel() regs.rflags = 1 << 9; // IF (Interrupt enable flag) } +void Thread::init_regs_user() +{ + memset(®s, 0, sizeof(Registers)); + regs.cs = 0x18 | 3; + regs.ss = 0x20 | 3; + regs.rflags = 1 << 9; // IF (Interrupt enable flag) +} + void Thread::set_arguments(u64 arg1, u64 arg2, u64 arg3, u64 arg4) { regs.rdi = arg1;