mirror of
https://github.com/rdmsr/zag.git
synced 2026-10-30 23:08:21 +00:00
ps: initial process subsystem
This commit is contained in:
+2
-1
@@ -14,8 +14,9 @@ pub fn init(boot_info: *pl.BootInfo) linksection(r.init) void {
|
||||
std.log.info("Welcome to the machine", .{});
|
||||
pl.early_init(boot_info);
|
||||
ki.cpu.init_cpu(0);
|
||||
ki.turnstile.init_turnstiles();
|
||||
|
||||
thread0.init(@intFromPtr(&stack), r.kib(16), ki.sched.idle, null);
|
||||
thread0.init(@intFromPtr(&stack), r.kib(16), ke.Thread.Priority.idle, ki.sched.idle, null);
|
||||
thread0.priority = 0;
|
||||
thread0.base_priority = 0;
|
||||
thread0.pinned = true;
|
||||
|
||||
+4
-3
@@ -111,15 +111,16 @@ pub const Thread = struct {
|
||||
/// Initialize a thread.
|
||||
/// - `stack`: Address of the **base** of the stack on which the initial context for the thread is built
|
||||
/// - `stack_size`: Size of the stack
|
||||
/// - `prio`: Base priority of the thread
|
||||
/// - `entry`: Entry point of the thread
|
||||
/// - `arg`: Extraneous argument to be passed to `entry`
|
||||
pub fn init(thread: *Thread, stack: r.VAddr, stack_size: usize, entry: *const fn (?*anyopaque) void, arg: ?*anyopaque) void {
|
||||
pub fn init(thread: *Thread, stack: r.VAddr, stack_size: usize, prio: u8, entry: *const fn (?*anyopaque) void, arg: ?*anyopaque) void {
|
||||
thread.* = .{
|
||||
.context = .init(stack, stack_size, entry, arg),
|
||||
.lock = .init(),
|
||||
.nice = 0,
|
||||
.priority = Thread.Priority.default,
|
||||
.base_priority = Thread.Priority.default,
|
||||
.priority = prio,
|
||||
.base_priority = prio,
|
||||
.inherited_prio = 0,
|
||||
.sleep_start = 0,
|
||||
.sleep_time = 0,
|
||||
|
||||
Reference in New Issue
Block a user