64 lines
1.1 KiB
C
64 lines
1.1 KiB
C
#pragma once
|
|
|
|
#include <stddef.h>
|
|
#include <vector.h>
|
|
#include <signal.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;
|
|
|
|
void *sigstack;
|
|
size_t sigstack_size;
|
|
|
|
bool sigstate[SIGNAL_NUM];
|
|
int32_t current_signal;
|
|
signal_handler_t sighandlers[SIGNAL_NUM];
|
|
|
|
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;
|
|
extern vector_t *global_processes;
|