From 555835c95b5603f0573b26a1cd80b437ea75c3a2 Mon Sep 17 00:00:00 2001 From: Martin Stein Date: Mon, 31 Aug 2015 16:53:35 +0200 Subject: [PATCH] hw: unlock kernel before context propagation Propagating the user context-pointer from C++ code to the mode transition assembly doesn't touch any CPU global data. Thus, we can reduce the in-sync window. Fixes #1223 --- repos/base-hw/src/core/kernel/pd.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/repos/base-hw/src/core/kernel/pd.cc b/repos/base-hw/src/core/kernel/pd.cc index c92a92199d..279d692d2d 100644 --- a/repos/base-hw/src/core/kernel/pd.cc +++ b/repos/base-hw/src/core/kernel/pd.cc @@ -69,14 +69,14 @@ void Mode_transition_control::switch_to(Cpu::Context * const context, addr_t const entry_raw, addr_t const context_ptr_base) { + /* unlock kernel data */ + data_lock().unlock(); + /* override client-context pointer of the executing CPU */ size_t const context_ptr_offset = cpu * sizeof(context); addr_t const context_ptr = context_ptr_base + context_ptr_offset; *(void * *)context_ptr = context; - /* unlock kernel data */ - data_lock().unlock(); - /* call assembly code that applies the virtual-machine context */ typedef void (* Entry)(); Entry __attribute__((noreturn)) const entry = (Entry)entry_raw;