kernel: Synchronize instructions before context execution
cd18ef8b3fa616df45960f40087591dc4c5184acd3275e0dbd7ebb5bffda215b
1 parent
a5b6779f
kernel/kernel/dispatch.rad
+2 -0
| 465 | 465 | frame: &mut trap::Frame, anchor: &mut trap::Hart, now: u64) -> Choice throws (abi::Error) |
|
| 466 | 466 | { |
|
| 467 | 467 | let choice = try select(windows, contexts, state.hart, now); |
|
| 468 | 468 | save(state, contexts, frame); |
|
| 469 | 469 | if let next = choice.context { |
|
| 470 | + | // The metadata lock makes published code visible before local fetch synchronization. |
|
| 471 | + | sync::syncInstructions(); |
|
| 470 | 472 | let context = contexts.contexts[next.index]; |
|
| 471 | 473 | assert context.kernelStack.start < context.kernelStack.end; |
|
| 472 | 474 | set *frame = context.frame; |
|
| 473 | 475 | set anchor.stackBottom = context.kernelStack.start; |
|
| 474 | 476 | set anchor.stackTop = context.kernelStack.end; |