On Mon, Feb 6, 2012 at 5:35 PM, Peter Maydell peter.maydell@linaro.org wrote:
No, qemu will correctly pass the atags in r2 if it is booting a linux kernel (ie if you pass it a non ELF file via the -kernel argument). Otherwise we wouldn't be able to boot Linux. How are you starting qemu ?
Well it's a bit complex:
sudo "$QEMU" -daemonize -no-quit -pidfile "$PIDFILE" $* \ -serial telnet:localhost:${SERIAL_PORT_BASE},server,nowait,ipv4 \ -serial telnet:localhost:$(($SERIAL_PORT_BASE + 1)),server,nowait,ipv4 \ -serial telnet:localhost:$(($SERIAL_PORT_BASE + 2)),server,nowait,ipv4 \ -serial telnet:localhost:$(($SERIAL_PORT_BASE + 3)),server,nowait,ipv4 \ $QEMU_LOCAL_ARCH_ARGS \ -net nic -net tap,script="$ROOT/tools/qemu-ifup,downscript=$ROOT/tools/qemu-ifdown" \ -gdb tcp:127.0.0.1:${GDB_PORT},server,ipv4 \ -monitor telnet:127.0.0.1:${MONITOR_PORT},server,ipv4,nowait \ -kernel "$FINAL_IMAGE" \ $QEMU_ARCH_ARGS -S || { if [ -f "$PIDFILE" ]; then sudo rm -f "$PIDFILE" fi exit 1 }
FINAL_IMAGE is elf or uImage (tried both), the uImage is supposed to work. -initrd along with -sd and some architecture specific arguments are passed in QEMU_ARCH_ARGS
When I'm attaching gdb and doing "info registers" I get 0x0 in all registers except PC.
I've analyzed the source, added some printfs and the image is correctly detected as Linux.
In the sourcode (current release) I couldn't find any place where any register except PC is being modified.
I've found some comments about some Linux header file that no longer exists and the code suggest that atags data is put into some pre-defined memory location, with no pointer being passed in r2.