[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Minios-devel] [UNIKRAFT PATCH 05/23] plat: Hardware context - Yield thread to a previously yielding thread
This is the switching scenario that also occurs for cooperative scheduling, therefore the isn't anything special with it. We just use the hardware context instead of the software context. Signed-off-by: Costin Lupu <costin.lupu@xxxxxxxxx> --- plat/common/x86/hw_ctx.c | 10 ++++++++++ plat/common/x86/thread_start.S | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/plat/common/x86/hw_ctx.c b/plat/common/x86/hw_ctx.c index 778e546d..edee3aee 100644 --- a/plat/common/x86/hw_ctx.c +++ b/plat/common/x86/hw_ctx.c @@ -90,6 +90,8 @@ void hw_ctx_start(void *ctx) UK_CRASH("Thread did not start."); } +extern void asm_hw_ctx_switch(void *prevctx, void *nextctx); + static void hw_ctx_switch(void *prevctx, void *nextctx) { struct hw_ctx *prev_hw_ctx = prevctx; @@ -101,6 +103,14 @@ static void hw_ctx_switch(void *prevctx, void *nextctx) /* IRQ context */ prev_hw_ctx->interrupted = true; next_hw_ctx->interrupted = false; + + } else { + /* yielding */ + if (next_hw_ctx->interrupted) { + + } else + /* switching yielding to yielding */ + asm_hw_ctx_switch(prevctx, nextctx); } } diff --git a/plat/common/x86/thread_start.S b/plat/common/x86/thread_start.S index 105691ee..363d86c3 100644 --- a/plat/common/x86/thread_start.S +++ b/plat/common/x86/thread_start.S @@ -68,3 +68,15 @@ ENTRY(asm_sw_ctx_switch) 1: PROTECTED_REGS_RESTORE ret + +ENTRY(asm_hw_ctx_switch) + PROTECTED_REGS_SAVE + movq %rsp, OFFSETOF_REGS_RSP(%rdi) /* save ESP */ + movq OFFSETOF_REGS_RSP(%rsi), %rsp /* restore ESP */ + movq $1f, OFFSETOF_REGS_RIP(%rdi) /* save EIP */ + pushq OFFSETOF_REGS_RIP(%rsi) /* restore EIP */ + ret +1: + PROTECTED_REGS_RESTORE + ret + -- 2.20.1 _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |