summaryrefslogtreecommitdiff
path: root/sys/include
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-07 22:47:49 -0500
committerIan Moffett <ian@osmora.org>2024-03-07 23:00:20 -0500
commit39ed0640f0e33b8a48ba82334de219e9fe4ed0e6 (patch)
treee027a5b155707bfc2bc2710a4a3dfe72f01cef38 /sys/include
parent3154c067ebd5e23b8be9693a1a790c70a9634344 (diff)
kernel: sched: Add support for user threads
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include')
-rw-r--r--sys/include/arch/amd64/frame.h7
-rw-r--r--sys/include/sys/proc.h2
2 files changed, 9 insertions, 0 deletions
diff --git a/sys/include/arch/amd64/frame.h b/sys/include/arch/amd64/frame.h
index a2e1a05..298a836 100644
--- a/sys/include/arch/amd64/frame.h
+++ b/sys/include/arch/amd64/frame.h
@@ -67,5 +67,12 @@ struct trapframe {
(FRAME)->rsp = SP; \
(FRAME)->ss = 0x10; \
+#define init_frame_user(FRAME, IP, SP) \
+ (FRAME)->rip = IP; \
+ (FRAME)->cs = 0x18 | 3; \
+ (FRAME)->rflags = 0x202; \
+ (FRAME)->rsp = SP; \
+ (FRAME)->ss = 0x20 | 3; \
+
#endif /* !defined(__ASSEMBLER__) */
#endif /* !_AMD64_FRAME_H_ */
diff --git a/sys/include/sys/proc.h b/sys/include/sys/proc.h
index f45e4c6..0d3b45e 100644
--- a/sys/include/sys/proc.h
+++ b/sys/include/sys/proc.h
@@ -34,6 +34,7 @@
#include <sys/queue.h>
#include <machine/cpu.h>
#include <machine/frame.h>
+#include <vm/vm.h>
/*
* A task running on the CPU e.g., a process or
@@ -43,6 +44,7 @@ struct proc {
pid_t pid;
struct cpu_info *cpu;
struct trapframe *tf;
+ struct vas addrsp;
TAILQ_ENTRY(proc) link;
};