qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Qemu atags passing in register.
@ 2012-02-06 12:19 dpc
  2012-02-06 16:35 ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: dpc @ 2012-02-06 12:19 UTC (permalink / raw)
  To: qemu-devel, linaro-toolchain

Hi,

I'm doing some tricks with Linux kernel and I'm dependent on
bootloader atags passing.

On PandaBoard the u-boot is always passing DTF/Atags pointer in r2
register, and I'm kind of depending on it. I need to emulate this
behavior by -initrd qemu's argument. However it seems that
qemu-system-arm zeros the registers on the start, and places atags in
some hardcoded memory address no matter what.

Is this behaviour really OK? Isn't r2 register a proper way to pass
atags on ARM platform? If so, would you merge into mainline a patch
that implement this? I could write it, but I don't want end-users of
my work to have to patch and compile Qemu manually.

Please CC me, I'm not following actively these mailinglists.

Regards,
-- 
Dawid Ciężarkiewicz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Qemu atags passing in register.
  2012-02-06 12:19 [Qemu-devel] Qemu atags passing in register dpc
@ 2012-02-06 16:35 ` Peter Maydell
  2012-02-06 17:48   ` dpc
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2012-02-06 16:35 UTC (permalink / raw)
  To: dpc@ucore.info; +Cc: qemu-devel, linaro-toolchain

On 6 February 2012 12:19, dpc@ucore.info <dpc@ucore.info> wrote:
> On PandaBoard the u-boot is always passing DTF/Atags pointer in r2
> register, and I'm kind of depending on it. I need to emulate this
> behavior by -initrd qemu's argument. However it seems that
> qemu-system-arm zeros the registers on the start, and places atags in
> some hardcoded memory address no matter what.

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 ?

-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Qemu atags passing in register.
  2012-02-06 16:35 ` Peter Maydell
@ 2012-02-06 17:48   ` dpc
  2012-02-06 17:59     ` dpc
  0 siblings, 1 reply; 4+ messages in thread
From: dpc @ 2012-02-06 17:48 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, linaro-toolchain

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.


-- 
Dawid Ciężarkiewicz

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] Qemu atags passing in register.
  2012-02-06 17:48   ` dpc
@ 2012-02-06 17:59     ` dpc
  0 siblings, 0 replies; 4+ messages in thread
From: dpc @ 2012-02-06 17:59 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, linaro-toolchain

On Mon, Feb 6, 2012 at 6:48 PM, dpc@ucore.info <dpc@ucore.info> wrote:
> In the sourcode (current release) I couldn't find any place where any
> register except PC is being modified.

While looking for some data to paste here, I've notice that the
pointers should be set by "the smallest bootlader in the world". I
wasn't expecting it and checked status of the registers right after
emulation start.

I now see that registers are OK if I step 4 times in gdb.

Please disregard my email.

Regards,
-- 
Dawid Ciężarkiewicz

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-06 17:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-06 12:19 [Qemu-devel] Qemu atags passing in register dpc
2012-02-06 16:35 ` Peter Maydell
2012-02-06 17:48   ` dpc
2012-02-06 17:59     ` dpc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).