Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some of system registers are inaccessible via GDB if CPU is in UserMode #146

Open
kokas-a opened this issue Feb 13, 2023 · 0 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@kokas-a
Copy link

kokas-a commented Feb 13, 2023

Hi colleagues,
I found unclear behavior of QEMU while debugging Zephyr. While CPU is in UserSpace mode (STATUS32 & (1 << 7) ==1) it's impossible to get system registers values because of QEMU falls with error:

**
ERROR:../qemu/accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu)
Bail out! ERROR:../qemu/accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu)

How to reproduce

Build Zephyr with default GCC-compiler (or download prepared elf-example):

west build -b qemu_arc_hs samples/userspace/hello_world_user/

Start recent version of qemu (https://github.com/foss-for-synopsys-dwc-arc-processors/qemu):

qemu-system-arc -cpu archs -m 8M -nographic -no-reboot -monitor none -global cpu.firq=false -global cpu.num-irqlevels=15 -global cpu.num-irq=25 -global cpu.ext-irq=20 -global cpu.freq_hz=10000000 -global cpu.timer0=true -global cpu.timer1=true -global cpu.has-mpu=true -global cpu.mpu-numreg=16 -net none -pidfile qemu.pid -chardev stdio,id=con,mux=on -serial chardev:con -mon chardev=con,mode=readline -icount shift=6,align=off,sleep=off -rtc clock=vm -kernel <PATH_TO_ZEPHYR_USER_ELF> -s -S

Attach GDB:

target remote :1234
file <PATH_TO_ZEPHYR_USER_ELF>
b user_function
continue
info registers

Get GDB output:

timer_build    0x304               [ version=4 t0 t1 p0=0 p1=0 ]
irq_build      0xf141901           [ version=1 IRQs=25 exts=20 p=15 ]
mpy_build      0x1006              [ version32x32=6 type=0 cyc=0 DSP=1 version16x16=0 ]
vecbase_build  0x10                [ version=4 addr=0 ]
--Type <RET> for more, q to quit, c to continue without paging--
isa_config     0x12e47402          [ version=2 pc_size=4 lpc_size=7 addr_size=4 a n l c=2 d=1 ]
Remote connection closed

Get QEMU output:

**
ERROR:../qemu/accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu)
Bail out! ERROR:../qemu/accel/tcg/cpu-exec.c:933:cpu_exec: assertion failed: (cpu == current_cpu)

zephyr_user.zip

@abrodkin abrodkin added the bug Something isn't working label Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants