32 lines
583 B
C
32 lines
583 B
C
#include <stddef.h>
|
|
#ifndef PROCESS_H
|
|
#include <stdint.h>
|
|
|
|
#define PROCESS_H
|
|
#define MAX_PROCESS 16
|
|
|
|
#define STACK_SIZE 32
|
|
#define STACK_START(stack) (&stack[STACK_SIZE-1])
|
|
|
|
typedef struct {
|
|
uint32_t stack_size;
|
|
uint32_t stack[];
|
|
} ProcessStack;
|
|
|
|
typedef struct {
|
|
int (*entrypoint)();
|
|
ProcessStack* stack;
|
|
} Process;
|
|
|
|
typedef struct {
|
|
Process process_list[MAX_PROCESS];
|
|
int entries;
|
|
} ProcessTable;
|
|
|
|
void create_process_table(ProcessTable **table);
|
|
|
|
ProcessStack* create_stack(size_t size);
|
|
|
|
int create_process(ProcessTable *table, void *entrypoint);
|
|
#endif
|