Draft: lab 5 failed

This commit is contained in:
2025-05-03 20:45:34 +08:00
parent 981cae803b
commit e73f90395d
39 changed files with 588 additions and 429 deletions

53
kernel/include/process.h Normal file
View File

@@ -0,0 +1,53 @@
#pragma once
#include <stddef.h>
typedef struct {
uint64_t x0, x1;
uint64_t x2, x3;
uint64_t x4, x5;
uint64_t x6, x7;
uint64_t x8, x9;
uint64_t x10, x11;
uint64_t x12, x13;
uint64_t x14, x15;
uint64_t x16, x17;
uint64_t x18, x19;
uint64_t x20, x21;
uint64_t x22, x23;
uint64_t x24, x25;
uint64_t x26, x27;
uint64_t x28, fp;
uint64_t lr, spsr_el1;
uint64_t elr_el1;
uint64_t esr_el1;
uint64_t sp_el0;
} trapframe_t;
struct thread;
typedef struct process {
int32_t pid;
struct thread *th;
int32_t exitcode;
void *stack;
size_t stack_size;
void *mem;
size_t mem_size;
trapframe_t *regs;
} process_t;
// thread_func_t, cast from
// void run_process_by_name(const char *filename)
int32_t run_process_by_name(uint64_t filename);
// void run_process(process_t *)
int32_t run_process(uint64_t process);
process_t *fork_process(const process_t *from);
extern int32_t global_pid_counter;