Changeset ed7e057 in mainline for kernel/generic/src/proc/thread.c


Ignore:
Timestamp:
2024-01-16T15:46:47Z (16 months ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
master
Children:
29029ac0, a5b5f17
Parents:
4ed7870
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-15 20:09:30)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2024-01-16 15:46:47)
Message:

Add functions context_create(), context_replace() and context_swap()

and use them where appropriate, removing context_save() in the process.
Much like in userspace, context_swap() maintains natural control flow
as opposed to context_save()'s return-twice mechanic.

Beyond that, in the future, context_replace() and context_swap()
can be implemented more efficiently than the context_save()/
context_restore() pair. As of now, the original implementation is
retained.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/proc/thread.c

    r4ed7870 red7e057  
    6060#include <arch/interrupt.h>
    6161#include <smp/ipi.h>
    62 #include <arch/faddr.h>
    6362#include <atomic.h>
    6463#include <memw.h>
     
    310309        irq_spinlock_unlock(&tidlock, true);
    311310
    312         memset(&thread->saved_context, 0, sizeof(thread->saved_context));
    313         context_set(&thread->saved_context, FADDR(cushion),
    314             (uintptr_t) thread->kstack, STACK_SIZE);
     311        context_create(&thread->saved_context, cushion, thread->kstack, STACK_SIZE);
    315312
    316313        current_initialize((current_t *) thread->kstack);
Note: See TracChangeset for help on using the changeset viewer.