From 47672b4c9341b905d18d3c2a435061f9a59a4918 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 15 Jul 2020 17:44:24 -0400 Subject: [PATCH] fix: correct bugs --- runtime/include/arch/x86_64/context.h | 2 +- runtime/src/arch_context.c | 1 - runtime/src/software_interrupt.c | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/runtime/include/arch/x86_64/context.h b/runtime/include/arch/x86_64/context.h index fa8f50f..7bcbce5 100644 --- a/runtime/include/arch/x86_64/context.h +++ b/runtime/include/arch/x86_64/context.h @@ -93,7 +93,7 @@ arch_context_switch(struct arch_context *current, struct arch_context *next) * Check if the variant of the context we're trying to switch to is SLOW (mcontext-based) * If it is, jump to label 1 to restore the preempted sandbox */ - "cmpq $2, (%%rcx)\n\t" /* if (next->variant == ARCH_CONTEXT_SLOW); */ + "cmpq $2, (%%rdx)\n\t" /* if (next->variant == ARCH_CONTEXT_SLOW); */ "je 1f\n\t" /* goto 1; restore the existing sandbox using mcontext */ /* diff --git a/runtime/src/arch_context.c b/runtime/src/arch_context.c index c0eb746..a1851a9 100644 --- a/runtime/src/arch_context.c +++ b/runtime/src/arch_context.c @@ -11,7 +11,6 @@ */ void __attribute__((noinline)) __attribute__((noreturn)) arch_context_mcontext_restore(void) { - debuglog("Sending SIGUSR1"); pthread_kill(pthread_self(), SIGUSR1); assert(false); } diff --git a/runtime/src/software_interrupt.c b/runtime/src/software_interrupt.c index 3eeac2a..7a93a8a 100644 --- a/runtime/src/software_interrupt.c +++ b/runtime/src/software_interrupt.c @@ -125,8 +125,8 @@ software_interrupt_handle_signals(int signal_type, siginfo_t *signal_info, void /* Extra checks to verify that preemption properly set context state */ assert(current_sandbox->ctxt.variant == ARCH_CONTEXT_SLOW); - assert(current_sandbox->ctxt.regs[UREG_RSP] != 0); - assert(current_sandbox->ctxt.regs[UREG_RIP] != 0); + assert(current_sandbox->ctxt.regs[UREG_RSP] == 0); + assert(current_sandbox->ctxt.regs[UREG_RIP] == 0); software_interrupt_SIGUSR_count++; debuglog("usr1:%d\n", software_interrupt_SIGUSR_count);