Skip to contentSkip to conversation

Get tcg-hppa working

PATCH In review Richard Henderson 3 participants 11 messages Feb 20, 2010

lore
Share & tools
lore
#1 lore raw

PATCH 1/3 tcg-hppa: Fix const errors in hppa-dis.c.

In reply to Richard Henderson
---
 hppa-dis.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hppa-dis.c +2 -2
index 9d96d72..49f99c8 100644
@@ -576,7 +576,7 @@ struct pa_opcode
     const char *name;
     unsigned long int match;	/* Bits that must be set...  */
     unsigned long int mask;	/* ... in these bits. */
-    char *args;
+    const char *args;
     enum pa_arch arch;
     char flags;
 };
@@ -2753,7 +2753,7 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
 		    int sf = GET_FIELD (insn, 19, 20);
 		    const char * const * source = float_format_names;
 		    const char * const * dest = float_format_names;
-		    char *t = "";
+		    const char *t = "";
 
 		    if (sub == 4)
 		      {
Signature · 1 line
1.6.6
#2 lore raw

PATCH 2/3 tcg-hppa: Fix 64-bit argument ordering.

In reply to Richard Henderson
---
 tcg/tcg.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
tcg/tcg.c +11 -1
index e6a1caf..32345cc 100644
@@ -596,7 +596,17 @@ void tcg_gen_callN(TCGContext *s, TCGv_ptr func, unsigned int flags,
                 real_args++;
             }
 #endif
-#ifdef TCG_TARGET_WORDS_BIGENDIAN
+	    /* If stack grows up, then we will be placing successive
+	       arguments at lower addresses, which means we need to
+	       reverse the order compared to how we would normally
+	       treat either big or little-endian.  For those arguments
+	       that will wind up in registers, this still works for
+	       HPPA (the only current STACK_GROWSUP target) since the
+	       argument registers are *also* allocated in decreasing
+	       order.  If another such target is added, this logic may
+	       have to get more complicated to differentiate between
+	       stack arguments and register arguments.  */
+#if defined(TCG_TARGET_WORDS_BIGENDIAN) != defined(TCG_TARGET_STACK_GROWSUP)
             *gen_opparam_ptr++ = args[i] + 1;
             *gen_opparam_ptr++ = args[i];
 #else
Signature · 1 line
1.6.6
#0 lore raw

cover Get tcg-hppa working

Tested on debian/parisc (pa8600, 32-bit), and is good enough to run the linux-user-test-0.3 binaries for arm, armeb, i386, mips, mipsel, sh4, and sh4eb. It still fails for ppc and sparc userland; that'll take more debugging.

I had a go at sparc-test-0.2, since that's the only one that reliably works for me on x86_64 with -nographics, but there seems to be some sort of signalling problem. The trace makes it into the idle loop and never makes it out again.

Anyway, it's a distinct improvement over the current state of affairs, and at least mostly works.

r~

Richard Henderson (3):
tcg-hppa: Fix const errors in hppa-dis.c.
tcg-hppa: Fix 64-bit argument ordering.
tcg-hppa: Finish the port.

 configure             |    5 +-
 hppa-dis.c            |    4 +-
 tcg/hppa/tcg-target.c | 1847 +++++++++++++++++++++++++++++++++++--------------
 tcg/hppa/tcg-target.h |  141 +---
 tcg/tcg.c             |   12 +-
 5 files changed, 1356 insertions(+), 653 deletions(-)
#3 lore raw

PATCH 3/3 tcg-hppa: Finish the port.

Delete inline functions from tcg-target.h that don't need to be there, move the others to tcg-target.c. Add 'Z', 'I', 'J' constraints for 0, signed 11-bit, and signed 5-bit respectively. Add 'c' constraint for RET1 register. Add GUEST_BASE support similar to ppc64, with the value stored in a register. Add missing registers to reg_alloc_order. Add support for 12-bit branch relocations. Add functions for synthetic
operations: addi, mtctl, dep, shd, vshd, ori, andi, shifts, rotates, multiply, millicode calls, branches, setcond. Split out TLB reads from qemu_ld and qemu_st; fix argument loading for tlb external calls. Generate the prologue.

---
 configure             |    5 +-
 tcg/hppa/tcg-target.c | 1847 +++++++++++++++++++++++++++++++++++--------------
 tcg/hppa/tcg-target.h |  141 +---
 3 files changed, 1343 insertions(+), 650 deletions(-)
configure +4 -1
index 8eb5f5b..1a41bc3 100755
@@ -707,6 +707,9 @@ case "$cpu" in
     ppc*)
            host_guest_base="yes"
            ;;
+    hppa*)
+           host_guest_base="yes"
+           ;;
 esac
 
 [ -z "$guest_base" ] && guest_base="$host_guest_base"
@@ -2659,7 +2662,7 @@ if test "$target_linux_user" = "yes" -o "$target_bsd_user" = "yes" ; then
   ia64)
     ldflags="-Wl,-G0 $linker_script -static $ldflags"
     ;;
-  i386|x86_64|ppc|ppc64|s390|sparc64|alpha|arm|m68k|mips|mips64)
+  *)
     ldflags="$linker_script $ldflags"
     ;;
   esac
tcg/hppa/tcg-target.c +1312 -535

2,177 lines not on this page · raw message

tcg/hppa/tcg-target.h +27 -114

159 lines not on this page · raw message

Signature · 1 line
1.6.6
#4 lore raw
In reply to Richard Henderson
Quoted 9 lines · Richard Henderson

Tested on debian/parisc (pa8600, 32-bit), and is good enough to run the linux-user-test-0.3 binaries for arm, armeb, i386, mips, mipsel, sh4, and sh4eb. It still fails for ppc and sparc userland; that'll take more debugging.

I had a go at sparc-test-0.2, since that's the only one that reliably works for me on x86_64 with -nographics, but there seems to be some sort of signalling problem. The trace makes it into the idle loop and never makes it out again.

Nice!

The qemu_ld / qemu_st cleanup strikes me as something that would be appropriate for some other TCG targets too, once this has been applied.

The first thing that I do when I find the time will be to get TCI working fully on 32-bit archs... then I'll see what I can do to try to track down the remaining issues.

Cheers,

Signature · 1 line
Stuart Brady
#5 lore raw
Quoted 11 lines · Stuart Brady
Quoted 9 lines · Richard Henderson

Tested on debian/parisc (pa8600, 32-bit), and is good enough to run the linux-user-test-0.3 binaries for arm, armeb, i386, mips, mipsel, sh4, and sh4eb. It still fails for ppc and sparc userland; that'll take more debugging.

I had a go at sparc-test-0.2, since that's the only one that reliably works for me on x86_64 with -nographics, but there seems to be some sort of signalling problem. The trace makes it into the idle loop and never makes it out again.

Quoted 4 lines

Nice!

The qemu_ld / qemu_st cleanup strikes me as something that would be appropriate for some other TCG targets too, once this has been applied.

Care to point out what this cleanup is, my HPPA-fu is around zero.

Quoted 6 lines

The first thing that I do when I find the time will be to get TCI working fully on 32-bit archs... then I'll see what I can do to try to track down the remaining issues.

Cheers,

Signature · 1 line
mailto:[email protected]
#6 lore raw
Quoted 6 lines · malc
Quoted 2 lines · Stuart Brady

The qemu_ld / qemu_st cleanup strikes me as something that would be appropriate for some other TCG targets too, once this has been applied.

Care to point out what this cleanup is, my HPPA-fu is around zero.

The 'split out TLB reads from qemu_ld and qemu_st' part of patch 3, which adds a new tcg_out_tlb_read() function. That code is duplicated in tcg_out_qemu_ld() and tcg_out_qemu_st() for all archs except PPC64. It just makes the code that little bit more readable.

Cheers,

Signature · 1 line
Stuart Brady
#8 lore raw
In reply to malc
Quoted 4 lines · malc
Quoted 2 lines

The qemu_ld / qemu_st cleanup strikes me as something that would be appropriate for some other TCG targets too, once this has been applied.

Care to point out what this cleanup is, my HPPA-fu is around zero.

Split out a tlb_read function from qemu_ld/qemu_st, as is already done on ppc64.

r~

#9 lore raw
Quoted 9 lines · Richard Henderson
Quoted 4 lines · malc
Quoted 2 lines

The qemu_ld / qemu_st cleanup strikes me as something that would be appropriate for some other TCG targets too, once this has been applied.

Care to point out what this cleanup is, my HPPA-fu is around zero.

Split out a tlb_read function from qemu_ld/qemu_st, as is already done on ppc64.

Ah, so i already half did it, good to know.

Signature · 1 line
mailto:[email protected]
#7 lore raw
In reply to Stuart Brady
Quoted 6 lines · Stuart Brady
Quoted 5 lines · malc
Quoted 2 lines · Stuart Brady

The qemu_ld / qemu_st cleanup strikes me as something that would be appropriate for some other TCG targets too, once this has been applied.

Quoted 7 lines
Quoted 1 line

Care to point out what this cleanup is, my HPPA-fu is around zero.

The 'split out TLB reads from qemu_ld and qemu_st' part of patch 3, which adds a new tcg_out_tlb_read() function. That code is duplicated in tcg_out_qemu_ld() and tcg_out_qemu_st() for all archs except PPC64. It just makes the code that little bit more readable.

Thanks.

Signature · 1 line
mailto:[email protected]
#10 lore raw
In reply to malc
Quoted 1 line · malc

Ah, so i already half did it, good to know.

I stole several good ideas from the ppc64 port. ;-) That one and using indexed loads to handle GUEST_BASE.

r~