Added functions to portably manipulate process context

This commit is contained in:
2022-08-17 01:41:59 -05:00
parent bbf2325a60
commit bfb56fcbb3
2 changed files with 36 additions and 1 deletions

View File

@@ -42,4 +42,24 @@ void destroy_context(void *ctx)
void save_context(struct process_context_t *context)
{
store_active_context(context, sizeof(*context));
}
void set_context_pc(struct process_context_t *context, void *pc)
{
context->eip = pc;
}
void set_context_stack(struct process_context_t *context, void *stack)
{
context->esp = stack;
}
void set_context_flags(struct process_context_t *context, unsigned long flags)
{
context->flags = flags;
}
void set_context_return(struct process_context_t *context, unsigned long value)
{
context->eax = value;
}