21270a3cc8
- Implement custom 'HOT!' binary format and Rust-based elf2hot converter. - Upgrade kernel loader with segment-based loading and BSS zeroing. - Refactor scheduler for Ring 3 IRET frames and fix CS/SS selector swap. - Add user stack allocation (0x70000000) and linker scripts for binary cleanup.
32 lines
627 B
C
32 lines
627 B
C
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
// Copyright (c) 2025 0xKarinyash
|
|
|
|
#pragma once
|
|
#include <types.h>
|
|
|
|
typedef enum process_state {
|
|
DEAD,
|
|
RUNNING,
|
|
} process_state;
|
|
|
|
typedef struct process {
|
|
u64 pid;
|
|
process_state state;
|
|
u64 pml4_phys;
|
|
struct process* parent;
|
|
char name[32];
|
|
} process;
|
|
|
|
typedef struct task {
|
|
u64 rsp;
|
|
struct task* next;
|
|
u32 id;
|
|
u32 sleep_ticks;
|
|
u64 kernel_stack_top;
|
|
process* proc;
|
|
} task;
|
|
|
|
void sched_init();
|
|
task* sched_spawn(void(*entry)(), process* owner, bool is_user, u64 fixed_user_stack);
|
|
u64 sched_next(u64 curr_rsp);
|
|
void yield(u64 ticks); |