diff options
author | Ian Moffett <ian@osmora.org> | 2025-10-15 19:02:52 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2025-10-15 19:04:01 -0400 |
commit | 810b5c49ebfb3398a8d9a89dedba6b97cb8688b1 (patch) | |
tree | e95d4dc0b10f2552a654eefab0ee7c8f933aaeb7 /src/sys/arch/amd64 | |
parent | c3817dc16c1deab64756e4a9fcf8f7be91aaa12f (diff) |
kern/amd64: Introduce kernel threads
Introduces kernel threads. by using the proc_ktd() function, one can
spawn a CPL 0 running thread to the desired code.
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'src/sys/arch/amd64')
-rw-r--r-- | src/sys/arch/amd64/os/os_proc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/sys/arch/amd64/os/os_proc.c b/src/sys/arch/amd64/os/os_proc.c index 93e5d73..c658547 100644 --- a/src/sys/arch/amd64/os/os_proc.c +++ b/src/sys/arch/amd64/os/os_proc.c @@ -112,8 +112,14 @@ md_proc_init(struct proc *procp, int flags) return error; } - ds = USER_DS | 3; - cs = USER_CS | 3; + if (ISSET(flags, SPAWN_KTD)) { + ds = KERNEL_DS; + cs = KERNEL_CS; + procp->flags |= PROC_KTD; + } else { + ds = USER_DS | 3; + cs = USER_CS | 3; + } /* * Set up the mapping specifier, we'll use zero |