On Tue, Mar 22, 2022 at 11:56 PM Peter Maydell <peter.mayd...@linaro.org> wrote: > > On Tue, 22 Mar 2022 at 15:43, Bin Meng <bmeng...@gmail.com> wrote: > > > > When accessing the per-CPU register bank of some devices (e.g.: GIC) > > from the GDB stub context, a segfault occurs. This is due to current_cpu > > is not set, as the contect is not a guest CPU. > > > > Let's set current_cpu before doing the acutal memory read write. > > > > Resolves: https://gitlab.com/qemu-project/qemu/-/issues/124 > > Signed-off-by: Bin Meng <bmeng...@gmail.com> > > --- > > This works, but I worry a bit that it might have unexpected > side effects, and setting globals (even if thread-local) to > cause side-effects elsewhere isn't ideal... >
The functions modified are local to the gdbstub or monitor thread, so modifying the thread-local variable should have no side-effects. Regards, Bin