On 12/7/20 7:14 PM, Peter Maydell wrote: > On Mon, 7 Dec 2020 at 18:08, Claudio Fontana <[email protected]> wrote: >> what about also the existing code with qemu-arm (user mode)? >> >> In that case do_interrupt is not set at all in target/arm/cpu.c, since it's >> protected by #ifndef CONFIG_USER_ONLY >> >> Did we have a potential NULL pointer trying to be dereferenced there? > > No, because in user-mode there are never any interrupts or > exceptions invoked this way. The code in these methods is > strictly system-emulation only. > >> Commit 0adf7d3cc3f724e1e9ce5aaa008bd9daeb90f19 says: >> >> target-arm: do not set do_interrupt handlers for ARM and AArch64 user modes >> >> User mode emulation should never get interrupts and thus should not >> use the system emulation exception handler function. >> >> -- >> >> But this was 2014. Is the comment above true today? > > Yes. > >> Looking at this commit in 2017, it does not seem to me to be the case: >> >> commit 17b50b0c299f1266578b01f7134810362418ac2e >> Author: Pavel Dovgaluk <[email protected]> >> Date: Tue Nov 14 11:18:18 2017 +0300 >> >> cpu-exec: avoid cpu_exec_nocache infinite loop with record/replay >> >> This patch >> [...] >> Second, try to cause the exception at the beginning of >> cpu_handle_exception, and exit immediately if the TB cannot >> execute. With this change, interrupts are processed and >> cpu_exec_nocache can make process. > > This code only invokes cc->do_interrupt() in CONFIG_USER_ONLY > if TARGET_I386 is true. i386 does this stuff in a weird way > that's different to all the other target architectures. > (One day we should fix this inconsistency I suppose.) > >> Is cc->do_interrupt supposed to be !CONFIG_USER_ONLY or not? > > It's !CONFIG_USER_ONLY. > > thanks > -- PMM >
Ah right, I somehow missed the #if defined(TARGET_I386), thanks!
