Add base code for custom stack length
This commit is contained in:
@@ -1,15 +1,23 @@
|
||||
#include "process.h"
|
||||
#include "alloc.h"
|
||||
#include <stdint.h>
|
||||
|
||||
void create_process_table(ProcessTable **table) {
|
||||
*table = malloc(sizeof(ProcessTable));
|
||||
(*table)->entries = 0;
|
||||
}
|
||||
|
||||
ProcessStack* create_stack(size_t size) {
|
||||
ProcessStack* stack = malloc(sizeof(ProcessStack) + size*sizeof(uint32_t));
|
||||
stack->stack_size = size;
|
||||
return stack;
|
||||
}
|
||||
|
||||
int create_process(ProcessTable *table, void *entrypoint) {
|
||||
if (table->entries>=MAX_PROCESS) return 1;
|
||||
|
||||
Process *pentry = &table->process_list[table->entries++];
|
||||
pentry->entrypoint = entrypoint;
|
||||
pentry->stack = create_stack(STACK_SIZE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user