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
This commit is contained in:
Martin Stein 2015-08-31 16:53:35 +02:00 committed by Christian Helmuth
parent 91cb3decdb
commit 555835c95b
1 changed files with 3 additions and 3 deletions

View File

@ -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;