Skip to contentSkip to conversation

[4199] HPPA (PA-RISC) host support

Qemu-devel Aurelien Jarno 1 participant 1 message Apr 12, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

Revision: 4199

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4199
Author:   aurel32
Date:     2008-04-12 20:14:54 +0000 (Sat, 12 Apr 2008)

Log Message:
-----------
HPPA (PA-RISC) host support

(Stuart Brady)

Modified Paths:
--------------

    trunk/Makefile.target
    trunk/configure
    trunk/cpu-all.h
    trunk/cpu-exec.c
    trunk/dis-asm.h
    trunk/disas.c
    trunk/dyngen-exec.h
    trunk/dyngen.c
    trunk/tcg/i386/tcg-target.c
    trunk/tcg/sparc/tcg-target.c
    trunk/tcg/tcg-dyngen.c
    trunk/tcg/tcg.c
    trunk/tcg/x86_64/tcg-target.c

Added Paths:
-----------
trunk/hppa-dis.c
trunk/hppa.ld
trunk/tcg/hppa/
trunk/tcg/hppa/tcg-target.c
trunk/tcg/hppa/tcg-target.h

Modified: trunk/Makefile.target
===================================================================

Makefile.target +8 -0
@@ -128,6 +128,11 @@
 CFLAGS+=-msmall-data
 endif
 
+ifeq ($(ARCH),hppa)
+OP_CFLAGS=-O1 -fno-delayed-branch
+BASE_LDFLAGS+=-Wl,-T,$(SRC_PATH)/$(ARCH).ld
+endif
+
 ifeq ($(ARCH),ia64)
 CFLAGS+=-mno-sdata
 OP_CFLAGS+=-mno-sdata
@@ -267,6 +272,9 @@
 ifeq ($(findstring sh4, $(TARGET_ARCH) $(ARCH)),sh4)
 LIBOBJS+=sh4-dis.o
 endif
+ifeq ($(findstring hppa, $(TARGET_BASE_ARCH) $(ARCH)),hppa)
+LIBOBJS+=hppa-dis.o
+endif
 ifeq ($(findstring s390, $(TARGET_ARCH) $(ARCH)),s390)
 LIBOBJS+=s390-dis.o
 endif

Modified: trunk/configure
===================================================================

configure +7 -0
@@ -50,6 +50,9 @@
   cris)
     cpu="cris"
   ;;
+  parisc|parisc64)
+    cpu="hppa"
+  ;;
   ia64)
     cpu="ia64"
   ;;
@@ -576,6 +579,7 @@
 
 # if cross compiling, cannot launch a program, so make a static guess
 if test "$cpu" = "armv4b" \
+     -o "$cpu" = "hppa" \
      -o "$cpu" = "m68k" \
      -o "$cpu" = "mips" \
      -o "$cpu" = "mips64" \
@@ -865,6 +869,9 @@
 elif test "$cpu" = "cris" ; then
   echo "ARCH=cris" >> $config_mak
   echo "#define HOST_CRIS 1" >> $config_h
+elif test "$cpu" = "hppa" ; then
+  echo "ARCH=hppa" >> $config_mak
+  echo "#define HOST_HPPA 1" >> $config_h
 elif test "$cpu" = "ia64" ; then
   echo "ARCH=ia64" >> $config_mak
   echo "#define HOST_IA64 1" >> $config_h

Modified: trunk/cpu-all.h
===================================================================

cpu-all.h +10 -1
@@ -20,7 +20,7 @@
 #ifndef CPU_ALL_H
 #define CPU_ALL_H
 
-#if defined(__arm__) || defined(__sparc__) || defined(__mips__)
+#if defined(__arm__) || defined(__sparc__) || defined(__mips__) || defined(__hppa__)
 #define WORDS_ALIGNED
 #endif
 
@@ -952,6 +952,15 @@
     return val;
 }
 
+#elif defined(__hppa__)
+
+static inline int64_t cpu_get_real_ticks(void)
+{
+    int val;
+    asm volatile ("mfctl %%cr16, %0" : "=r"(val));
+    return val;
+}
+
 #elif defined(__ia64)
 
 static inline int64_t cpu_get_real_ticks(void)

Modified: trunk/cpu-exec.c
===================================================================

cpu-exec.c +29 -0
@@ -657,6 +657,17 @@
                                        "o0", "o1", "o2", "o3", "o4", "o5",
                                        "l0", "l1", "l2", "l3", "l4", "l5",
                                        "l6", "l7");
+#elif defined(__hppa__)
+                asm volatile ("ble  0(%%sr4,%1)\n"
+                              "copy %%r31,%%r18\n"
+                              "copy %%r28,%0\n"
+                              : "=r" (T0)
+                              : "r" (gen_func)
+                              : "r1", "r2", "r3", "r4", "r5", "r6", "r7",
+                                "r8", "r9", "r10", "r11", "r12", "r13",
+                                "r18", "r19", "r20", "r21", "r22", "r23",
+                                "r24", "r25", "r26", "r27", "r28", "r29",
+                                "r30", "r31");
 #elif defined(__arm__)
                 asm volatile ("mov pc, %0\n\t"
                               ".global exec_loop\n\t"
@@ -1488,6 +1499,24 @@
                              is_write, &uc->uc_sigmask, puc);
 }
 
+#elif defined(__hppa__)
+
+int cpu_signal_handler(int host_signum, void *pinfo,
+                       void *puc)
+{
+    struct siginfo *info = pinfo;
+    struct ucontext *uc = puc;
+    unsigned long pc;
+    int is_write;
+
+    pc = uc->uc_mcontext.sc_iaoq[0];
+    /* FIXME: compute is_write */
+    is_write = 0;
+    return handle_cpu_signal(pc, (unsigned long)info->si_addr, 
+                             is_write,
+                             &uc->uc_sigmask, puc);
+}
+
 #else
 
 #error host CPU specific signal handler needed

Modified: trunk/dis-asm.h
===================================================================

dis-asm.h +4 -0
@@ -157,6 +157,10 @@
 #define bfd_mach_ppc_7400      7400
   bfd_arch_rs6000,     /* IBM RS/6000 */
   bfd_arch_hppa,       /* HP PA RISC */
+#define bfd_mach_hppa10        10
+#define bfd_mach_hppa11        11
+#define bfd_mach_hppa20        20
+#define bfd_mach_hppa20w       25
   bfd_arch_d10v,       /* Mitsubishi D10V */
   bfd_arch_z8k,        /* Zilog Z8000 */
 #define bfd_mach_z8001         1

Modified: trunk/disas.c
===================================================================

disas.c +2 -0
@@ -279,6 +279,8 @@
     print_insn = print_insn_m68k;
 #elif defined(__s390__)
     print_insn = print_insn_s390;
+#elif defined(__hppa__)
+    print_insn = print_insn_hppa;
 #else
     fprintf(out, "0x%lx: Asm output not supported on this arch\n",
 	    (long) code);

Modified: trunk/dyngen-exec.h
===================================================================

dyngen-exec.h +7 -0
@@ -124,6 +124,11 @@
 #define AREG1 "r4"
 #define AREG2 "r5"
 #define AREG3 "r6"
+#elif defined(__hppa__)
+#define AREG0 "r17"
+#define AREG1 "r14"
+#define AREG2 "r15"
+#define AREG3 "r16"
 #elif defined(__mips__)
 #define AREG0 "fp"
 #define AREG1 "s0"
@@ -279,6 +284,8 @@
 #elif defined(__mips__)
 #define EXIT_TB() asm volatile ("jr $ra")
 #define GOTO_LABEL_PARAM(n) asm volatile (".set noat; la $1, " ASM_NAME(__op_gen_label) #n "; jr $1; .set at")
+#elif defined(__hppa__)
+#define GOTO_LABEL_PARAM(n) asm volatile ("b,n " ASM_NAME(__op_gen_label) #n)
 #else
 #error unsupported CPU
 #endif

Modified: trunk/dyngen.c
===================================================================

dyngen.c +127 -2

167 lines not on this page · raw message

Added: trunk/hppa-dis.c
===================================================================

hppa-dis.c +2834 -0

2,687 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Added: trunk/hppa.ld
===================================================================

hppa.ld +214 -0

214 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Added: trunk/tcg/hppa/tcg-target.c
===================================================================

tcg/hppa/tcg-target.c +980 -0

980 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Added: trunk/tcg/hppa/tcg-target.h
===================================================================

tcg/hppa/tcg-target.h +204 -0

204 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Modified: trunk/tcg/i386/tcg-target.c
===================================================================

tcg/i386/tcg-target.c +2 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Modified: trunk/tcg/sparc/tcg-target.c
===================================================================

tcg/sparc/tcg-target.c +2 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Modified: trunk/tcg/tcg-dyngen.c
===================================================================

tcg/tcg-dyngen.c +50 -0

50 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Modified: trunk/tcg/tcg.c
===================================================================

tcg/tcg.c +23 -7

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Modified: trunk/tcg/x86_64/tcg-target.c
===================================================================

tcg/x86_64/tcg-target.c +2 -1

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Part of the diff is not shown here. View the raw message.