diff --git a/src/emu/kernel/event.c b/src/emu/kernel/event.c index cfc5a29..c6d60f3 100644 --- a/src/emu/kernel/event.c +++ b/src/emu/kernel/event.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) +/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ #include "kernel_priv.h" @@ -19,8 +19,10 @@ context_switch(struct emu *emu) switch (emu->ev->v) { case 'O': + emu->thread->is_out_of_cpu = 1; return chan_push(ch, value_int64(ST_CSOUT)); case 'I': + emu->thread->is_out_of_cpu = 0; return chan_pop(ch, value_int64(ST_CSOUT)); default: err("unknown context switch event"); diff --git a/src/emu/thread.h b/src/emu/thread.h index 97bc6ae..dd0ac46 100644 --- a/src/emu/thread.h +++ b/src/emu/thread.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) +/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ #ifndef THREAD_H @@ -54,6 +54,9 @@ struct thread { int is_running; int is_active; + /* Out of CPU as informed by the kernel */ + int is_out_of_cpu; + /* Current cpu, NULL if not unique affinity */ struct cpu *cpu;