diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-10-21 17:43:31 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2022-10-21 17:43:31 +0300 |
| commit | ec989bbe7d9bb7a844eeddeceaeb7bb7e4d5dab6 (patch) | |
| tree | 51221980ad2d4c8701e1a6e762a47495dec289de /include | |
| parent | a06dbb8a63d825ebb1ad65372ce1ce1f572891bc (diff) | |
| download | kmi-ec989bbe7d9bb7a844eeddeceaeb7bb7e4d5dab6.tar.gz kmi-ec989bbe7d9bb7a844eeddeceaeb7bb7e4d5dab6.zip | |
initial implementation of swap
+ Slightly unsure if it should be a syscall, or if assign would be
enough. Also, which thread should run in a fork/spawn? For now, old
thread, though this might increase latency. Or add swap flag to these
calls?
Diffstat (limited to 'include')
| -rw-r--r-- | include/apos/utils.h | 11 | ||||
| -rw-r--r-- | include/arch/proc.h | 28 |
2 files changed, 29 insertions, 10 deletions
diff --git a/include/apos/utils.h b/include/apos/utils.h index 29969c4..6eeb54f 100644 --- a/include/apos/utils.h +++ b/include/apos/utils.h @@ -187,6 +187,17 @@ #endif /** + * Signal to the compiler that some region is unreachable. + * Mainly used for debugging with instrumentation, though it could provide some + * micro-optimisations. +*/ +#if __has_builtin(__builtin_unreachable) +#define unreachable() __builtin_unreachable() +#else +#define unreachable() +#endif + +/** * Get container of some member. * * @param ptr Pointer to member in some structure. diff --git a/include/arch/proc.h b/include/arch/proc.h index d5367f6..5ea0f0f 100644 --- a/include/arch/proc.h +++ b/include/arch/proc.h @@ -15,18 +15,28 @@ #include "../../arch/riscv32/include/proc.h" #endif +#include <apos/uapi.h> + /** - * Attach IPC data to load into argument registers when returning to userspace. + * Attach argument data to thread. * * @param t Thread that will run after return. - * @param pid Process ID. - * @param tid Thread ID. - * @return \ref OK. + * @param a Arguments to attach. + */ +void set_args(struct tcb *t, struct sys_ret a); + +/** + * Get argument data attached to thread. + * To some extent a hack, used by swap. + * + * @todo is swap necessary? Would assign be enough? + * + * @param t Thread to read data from. + * @return Args associated with thread. */ -stat_t set_ipc(struct tcb *t, id_t pid, id_t tid); +struct sys_ret get_args(struct tcb *t); /** \todo Should these be in arch/tcb.h or something? */ -/** \todo Should these be void? */ /** * Attach thread stack and thread local storage when returning to userspace. @@ -35,17 +45,15 @@ stat_t set_ipc(struct tcb *t, id_t pid, id_t tid); * actualizes the information. * * @param t Thread that will run after return. - * @return \ref OK. */ -stat_t set_thread(struct tcb *t); +void set_thread(struct tcb *t); /** * Run \c init program. * * @param t Thread that \c init is attached to. * @param fdt Pointer to FDT that is passed to \c init. - * @return \ref ERR_ADDR, as it shouldn't return- */ -stat_t run_init(struct tcb *t, void *fdt); +__noreturn void run_init(struct tcb *t, void *fdt); #endif /* APOS_ARCH_PROC_H */ |
