bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH gnumach] ast: Implement cause_ast_check() by switching cpus


From: Damien Zammit
Subject: [PATCH gnumach] ast: Implement cause_ast_check() by switching cpus
Date: Sat, 05 Aug 2023 16:16:41 +0000

If the current processor is not the one we want to run an ast on,
we can bind the current thread to the processor we want, and force a
thread switch to that one, then run the ast_check() on the right cpu.

---
 i386/i386/ast_check.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/i386/i386/ast_check.c b/i386/i386/ast_check.c
index 5121abf1..1b80ea4a 100644
--- a/i386/i386/ast_check.c
+++ b/i386/i386/ast_check.c
@@ -28,12 +28,11 @@
 
 /*
  * Handle signalling ASTs on other processors.
- *
- * Initial i386 implementation does nothing.
  */
 
 #include <kern/ast.h>
 #include <kern/processor.h>
+#include <kern/thread.h>
 
 /*
  * Initialize for remote invocation of ast_check.
@@ -47,6 +46,16 @@ void init_ast_check(const processor_t processor)
  */
 void cause_ast_check(const processor_t processor)
 {
+    thread_t this_thread = current_thread();
+
+    if (current_processor() != processor) {
+        thread_bind(this_thread, processor);
+        thread_block(thread_no_continuation);
+    }
+
+    ast_check();
+
+    thread_bind(this_thread, PROCESSOR_NULL);
 }
 
 #endif /* NCPUS > 1 */
-- 
2.40.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]