Skip to contentSkip to conversation

QEMU Port (Help needed)

parisc-linux Stuart Brady 3 participants 5 messages Jun 4, 2006

lore
Share & tools
lore
#1 lore raw
Quoted 8 lines · Stuart Brady

Hi,

I've had a stab at porting QEMU to PA-RISC... I've uploaded a patch against QEMU 0.8.1 to:

http://homepage.ntlworld.com/wholehog/stuart/qemu/qemu-hppa-guest.diff

It compiles, but I can't figure out why it's crashing. Any ideas?

That's awesome to hear that you are working on QEMU for PARISC! It would rock to have a fast simulator. Even a semi-hosted environment would be a cool toy to play with.

Does QEMU crash?
Does the emulated userspace crash?

A couple of comments about your patch:

1. Remember 32-bit PARISC executables have both function pointers and function descriptors.

2. The "gp" is r19, the "dp" is r27. I don't know what your reference to the "__dlt" is?

3. You can copy testandset from glibc linuxthreads pthread.h

4. flush_icache_range can probably be copied from the kernel implementation.

Other than that, there are *all* sorts of things which could be wrong :)

Cheers,
Carlos.
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

#2 lore raw
Quoted 11 lines · Carlos O'Donell
Quoted 6 lines · Stuart Brady

I've had a stab at porting QEMU to PA-RISC... I've uploaded a patch against QEMU 0.8.1 to:

http://homepage.ntlworld.com/wholehog/stuart/qemu/qemu-hppa-guest.diff

It compiles, but I can't figure out why it's crashing. Any ideas?

That's awesome to hear that you are working on QEMU for PARISC! It would rock to have a fast simulator. Even a semi-hosted environment would be a cool toy to play with.

It would be nice. But I'm not sure if I _can_ finish this. :(

Quoted 2 lines

Does QEMU crash?
Does the emulated userspace crash?

QEMU crashes. So far, I've only tried system emulation, not userspace emulation.

An illegal instruction is being executed, and this appears to be for the very first instruction that is emulated. I get the following:

Program received signal SIGILL, Illegal instruction. [Switching to Thread 16384 (LWP 6905)] 0x00b30f40 in stdout ()
(gdb)

bt makes gdb hang! :( Unfortunately, my gdb-fu is pretty weak.

Quoted 4 lines

A couple of comments about your patch:

1. Remember 32-bit PARISC executables have both function pointers and function descriptors.

Ow. I really have no idea about how this works.

Quoted 2 lines

2. The "gp" is r19, the "dp" is r27. I don't know what your reference to the "__dlt" is?

I don't know, either. I was mainly guessing, based on what I saw in the PA ELF supplement. After changing it to use r19, gcc warns that r19 is call-clobbered, but I don't know whether that's relevant. I see the same behaviour as before, though...

Quoted 1 line

3. You can copy testandset from glibc linuxthreads pthread.h

Okay, I will do. (I don't think this is the immediate problem, though.)

Quoted 1 line

4. flush_icache_range can probably be copied from the kernel implementation.

Probably. Much of QEMU is LGPLed, though... but I can certainly try using the kernel implementation.

Quoted 1 line

Other than that, there are *all* sorts of things which could be wrong :)

Hmm... and they probably *are* wrong, too! :)

Thanks,

Signature · 5 lines
Stuart Brady
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux
#3 lore raw
In reply to Carlos O'Donell
Quoted 1 line · Carlos O'Donell

4. flush_icache_range can probably be copied from the kernel implementation.

Why are we still talking about doing flush_icache_range() in userspace? Why does qemu not use mprotect() to set either PROT_EXEC or PROT_WRITE (and never both at the same time)? The kernel will flush userspace appopriately (and if it doesn't, that's a bug).
_______________________________________________
parisc-linux mailing list [email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux

#4 lore raw
Quoted 8 lines · Matthew Wilcox
Quoted 1 line · Carlos O'Donell

4. flush_icache_range can probably be copied from the kernel implementation.

Why are we still talking about doing flush_icache_range() in userspace? Why does qemu not use mprotect() to set either PROT_EXEC or PROT_WRITE (and never both at the same time)? The kernel will flush userspace appopriately (and if it doesn't, that's a bug).

Blame QEMU for letting you override the default implementation! It's always tempting to see if you can do it faster in userspace?

Cheers,
Carlos.
_______________________________________________
parisc-linux mailing list
[email protected]
http://lists.parisc-linux.org/mailman/listinfo/parisc-linux