Skip to contentSkip to conversation

linux-user/sparc/signal.c: Remove unnecessary comment

PATCH Applied Peter Maydell 3 participants 4 messages Oct 9, 2018 – Oct 12, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-user/sparc/signal.c: Remove unnecessary comment

Remove a comment suggesting that we need to call tb_flush() after writing the SPARC signal frame trampoline insns. This isn't necessary in QEMU, because (even if the guest architecture requires explicit icache maintenance) we ensure that memory writes result in invalidation of translated code from that memory.

---
Found (with grep) while looking at what parts of the tree call tb_flush()...

 linux-user/sparc/signal.c | 4 ----
 1 file changed, 4 deletions(-)
linux-user/sparc/signal.c +0 -4
index b4c60aa4468..e44e99993c6 100644
@@ -258,10 +258,6 @@ void setup_frame(int sig, struct target_sigaction *ka,
         __put_user(val32, &sf->insns[1]);
         if (err)
             goto sigsegv;
-
-        /* Flush instruction space. */
-        // flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0]));
-        // tb_flush(env);
     }
     unlock_user(sf, sf_addr, sizeof(struct target_signal_frame));
     return;
Signature · 1 line
2.19.0
#1 lore raw

Le 09/10/2018 à 20:40, Peter Maydell a écrit :

Quoted 6 lines

Remove a comment suggesting that we need to call tb_flush() after writing the SPARC signal frame trampoline insns. This isn't necessary in QEMU, because (even if the guest architecture requires explicit icache maintenance) we ensure that memory writes result in invalidation of translated code from that memory.

By curiosity, where/how is it done?

Thanks,
Laurent

#2 lore raw
Quoted 9 lines · Laurent Vivier

Le 09/10/2018 à 20:40, Peter Maydell a écrit :

Quoted 6 lines

Remove a comment suggesting that we need to call tb_flush() after writing the SPARC signal frame trampoline insns. This isn't necessary in QEMU, because (even if the guest architecture requires explicit icache maintenance) we ensure that memory writes result in invalidation of translated code from that memory.

By curiosity, where/how is it done?

Guest pages that have had code translated from them are mprotect'd read-only. The host SIGSEGV handler notices writes to such pages, invalidates the translated code, and marks the page read-write again. At which point the guest program continues.

r~

#3 lore raw
In reply to Peter Maydell
Quoted 7 lines · Peter Maydell

Remove a comment suggesting that we need to call tb_flush() after writing the SPARC signal frame trampoline insns. This isn't necessary in QEMU, because (even if the guest architecture requires explicit icache maintenance) we ensure that memory writes result in invalidation of translated code from that memory.

Quoted 6 lines

---
Found (with grep) while looking at what parts of the tree call tb_flush()...

 linux-user/sparc/signal.c | 4 ----

Applied to my branch linux-user-for-3.1

Thanks,
Laurent