qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 1/7] alpha: Implement IMB; add placeholders for other userspace PALcalls.
  2009-12-10  0:05 [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Richard Henderson
@ 2009-12-09 23:38 ` Richard Henderson
  2009-12-13 19:28   ` Aurelien Jarno
  2009-12-09 23:39 ` [Qemu-devel] [PATCH 2/7] alpha: Drop bogus UNIQ initial value on Linux Richard Henderson
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 18+ messages in thread
From: Richard Henderson @ 2009-12-09 23:38 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 hw/alpha_palcode.c |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/hw/alpha_palcode.c b/hw/alpha_palcode.c
index c48a297..44b2ca4 100644
--- a/hw/alpha_palcode.c
+++ b/hw/alpha_palcode.c
@@ -1062,6 +1062,16 @@ void call_pal (CPUState *env, int palcode)
 
     qemu_log("%s: palcode %02x\n", __func__, palcode);
     switch (palcode) {
+    case 0x80:
+        /* BPT */
+        qemu_log("BPT\n");
+        /* FIXME: Sends SIGTRAP, si_code=TRAP_BRKPT.  */
+        exit(1);
+    case 0x81:
+        /* BUGCHK */
+        qemu_log("BUGCHK\n");
+        /* FIXME: Sends SIGTRAP, si_code=SI_FAULT.  */
+        exit(1);
     case 0x83:
         /* CALLSYS */
         qemu_log("CALLSYS n " TARGET_FMT_ld "\n", env->ir[0]);
@@ -1076,6 +1086,11 @@ void call_pal (CPUState *env, int palcode)
             env->ir[IR_V0] = -ret;
         }
         break;
+    case 0x86:
+        /* IMB */
+        qemu_log("IMB\n");
+        tb_flush(env);
+        break;
     case 0x9E:
         /* RDUNIQUE */
         env->ir[IR_V0] = env->unique;
@@ -1086,9 +1101,19 @@ void call_pal (CPUState *env, int palcode)
         env->unique = env->ir[IR_A0];
         qemu_log("WRUNIQUE: " TARGET_FMT_lx "\n", env->unique);
         break;
+    case 0xAA:
+        /* GENTRAP */
+        qemu_log("GENTRAP: " TARGET_FMT_lx "\n", env->ir[IR_A0]);
+        /* FIXME: This is supposed to send a signal:
+           SIGFPE:
+             GEN_INTOVF, GEN_INTDIV, GEN_FLTOVF, GEN_FLTDIV,
+             GEN_FLTUND, GEN_FLTINV, GEN_FLTINE, GEN_ROPRAND
+           SIGTRAP:
+             others
+           with various settings of si_code.  */
+        exit(1);
     default:
-        qemu_log("%s: unhandled palcode %02x\n",
-                    __func__, palcode);
+        qemu_log("%s: unhandled palcode %02x\n", __func__, palcode);
         exit(1);
     }
 }
-- 
1.6.5.2

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

* [Qemu-devel] [PATCH 2/7] alpha: Drop bogus UNIQ initial value on Linux.
  2009-12-10  0:05 [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Richard Henderson
  2009-12-09 23:38 ` [Qemu-devel] [PATCH 1/7] alpha: Implement IMB; add placeholders for other userspace PALcalls Richard Henderson
@ 2009-12-09 23:39 ` Richard Henderson
  2009-12-09 23:40 ` [Qemu-devel] [PATCH 3/7] alpha: Add binfmt entry Richard Henderson
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2009-12-09 23:39 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 linux-user/elfload.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 682a813..f47ec1e 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -677,9 +677,6 @@ static inline void init_thread(struct target_pt_regs *regs, struct image_info *i
     regs->pc = infop->entry;
     regs->ps = 8;
     regs->usp = infop->start_stack;
-    regs->unique = infop->start_data; /* ? */
-    printf("Set unique value to " TARGET_FMT_lx " (" TARGET_FMT_lx ")\n",
-           regs->unique, infop->start_data);
 }
 
 #define ELF_EXEC_PAGESIZE        8192
-- 
1.6.5.2

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

* [Qemu-devel] [PATCH 3/7] alpha: Add binfmt entry.
  2009-12-10  0:05 [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Richard Henderson
  2009-12-09 23:38 ` [Qemu-devel] [PATCH 1/7] alpha: Implement IMB; add placeholders for other userspace PALcalls Richard Henderson
  2009-12-09 23:39 ` [Qemu-devel] [PATCH 2/7] alpha: Drop bogus UNIQ initial value on Linux Richard Henderson
@ 2009-12-09 23:40 ` Richard Henderson
  2009-12-09 23:44 ` [Qemu-devel] [PATCH 4/7] alpha: Remove bogus DO_TB_FLUSH code from translator Richard Henderson
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2009-12-09 23:40 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 qemu-binfmt-conf.sh |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/qemu-binfmt-conf.sh b/qemu-binfmt-conf.sh
index 941f0cf..ba916ac 100644
--- a/qemu-binfmt-conf.sh
+++ b/qemu-binfmt-conf.sh
@@ -34,6 +34,9 @@ if [ $cpu != "i386" ] ; then
     echo ':i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
     echo ':i486:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x06\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-i386:' > /proc/sys/fs/binfmt_misc/register
 fi
+if [ $cpu != "alpha" ] ; then
+    echo ':alpha:M::\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x26\x90:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-alpha:' > /proc/sys/fs/binfmt_misc/register
+fi
 if [ $cpu != "arm" ] ; then
     echo   ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/local/bin/qemu-arm:' > /proc/sys/fs/binfmt_misc/register
     echo   ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/local/bin/qemu-armeb:' > /proc/sys/fs/binfmt_misc/register
-- 
1.6.5.2

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

* [Qemu-devel] [PATCH 4/7] alpha: Remove bogus DO_TB_FLUSH code from translator.
  2009-12-10  0:05 [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Richard Henderson
                   ` (2 preceding siblings ...)
  2009-12-09 23:40 ` [Qemu-devel] [PATCH 3/7] alpha: Add binfmt entry Richard Henderson
@ 2009-12-09 23:44 ` Richard Henderson
  2009-12-09 23:46 ` [Qemu-devel] [PATCH 5/7] alpha: Honor the -cpu command line argument Richard Henderson
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2009-12-09 23:44 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-alpha/helper.h    |    2 --
 target-alpha/op_helper.c |    5 -----
 target-alpha/translate.c |    8 +-------
 3 files changed, 1 insertions(+), 14 deletions(-)

diff --git a/target-alpha/helper.h b/target-alpha/helper.h
index a4faca2..9c60be1 100644
--- a/target-alpha/helper.h
+++ b/target-alpha/helper.h
@@ -1,7 +1,5 @@
 #include "def-helper.h"
 
-DEF_HELPER_0(tb_flush, void)
-
 DEF_HELPER_2(excp, void, int, int)
 DEF_HELPER_0(load_pcc, i64)
 DEF_HELPER_0(rc, i64)
diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c
index fe222dc..508272c 100644
--- a/target-alpha/op_helper.c
+++ b/target-alpha/op_helper.c
@@ -22,11 +22,6 @@
 #include "softfloat.h"
 #include "helper.h"
 
-void helper_tb_flush (void)
-{
-    tb_flush(env);
-}
-
 /*****************************************************************************/
 /* Exceptions processing helpers */
 void helper_excp (int excp, int error)
diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 9e7e9b2..ae1f5a8 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -32,10 +32,7 @@
 #define GEN_HELPER 1
 #include "helper.h"
 
-/* #define DO_SINGLE_STEP */
-#define ALPHA_DEBUG_DISAS
-/* #define DO_TB_FLUSH */
-
+#undef ALPHA_DEBUG_DISAS
 
 #ifdef ALPHA_DEBUG_DISAS
 #  define LOG_DISAS(...) qemu_log(__VA_ARGS__)
@@ -2428,9 +2425,6 @@ static inline void gen_intermediate_code_internal(CPUState *env,
     if (ret != 1 && ret != 3) {
         tcg_gen_movi_i64(cpu_pc, ctx.pc);
     }
-#if defined (DO_TB_FLUSH)
-    gen_helper_tb_flush();
-#endif
     if (tb->cflags & CF_LAST_IO)
         gen_io_end();
     /* Generate the return instruction */
-- 
1.6.5.2

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

* [Qemu-devel] [PATCH 5/7] alpha: Honor the -cpu command line argument.
  2009-12-10  0:05 [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Richard Henderson
                   ` (3 preceding siblings ...)
  2009-12-09 23:44 ` [Qemu-devel] [PATCH 4/7] alpha: Remove bogus DO_TB_FLUSH code from translator Richard Henderson
@ 2009-12-09 23:46 ` Richard Henderson
  2009-12-09 23:48 ` [Qemu-devel] [PATCH 6/7] alpha: Enable softfloat Richard Henderson
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2009-12-09 23:46 UTC (permalink / raw)
  To: qemu-devel


Also change the default cpu to ev67.


Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-alpha/translate.c |   44 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index ae1f5a8..3f8d1b2 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -2460,17 +2460,57 @@ void gen_intermediate_code_pc (CPUState *env, struct TranslationBlock *tb)
     gen_intermediate_code_internal(env, tb, 1);
 }
 
+struct cpu_def_t {
+    const char *name;
+    int implver, amask;
+};
+
+static const struct cpu_def_t cpu_defs[] = {
+    { "ev4",   IMPLVER_2106x, 0 },
+    { "ev5",   IMPLVER_21164, 0 },
+    { "ev56",  IMPLVER_21164, AMASK_BWX },
+    { "pca56", IMPLVER_21164, AMASK_BWX | AMASK_MVI },
+    { "ev6",   IMPLVER_21264, AMASK_BWX | AMASK_FIX | AMASK_MVI | AMASK_TRAP },
+    { "ev67",  IMPLVER_21264, (AMASK_BWX | AMASK_FIX | AMASK_CIX
+			       | AMASK_MVI | AMASK_TRAP | AMASK_PREFETCH), },
+    { "ev68",  IMPLVER_21264, (AMASK_BWX | AMASK_FIX | AMASK_CIX
+			       | AMASK_MVI | AMASK_TRAP | AMASK_PREFETCH), },
+    { "21064", IMPLVER_2106x, 0 },
+    { "21164", IMPLVER_21164, 0 },
+    { "21164a", IMPLVER_21164, AMASK_BWX },
+    { "21164pc", IMPLVER_21164, AMASK_BWX | AMASK_MVI },
+    { "21264", IMPLVER_21264, AMASK_BWX | AMASK_FIX | AMASK_MVI | AMASK_TRAP },
+    { "21264a", IMPLVER_21264, (AMASK_BWX | AMASK_FIX | AMASK_CIX
+				| AMASK_MVI | AMASK_TRAP | AMASK_PREFETCH), }
+};
+
 CPUAlphaState * cpu_alpha_init (const char *cpu_model)
 {
     CPUAlphaState *env;
     uint64_t hwpcb;
+    int implver, amask, i, max;
 
     env = qemu_mallocz(sizeof(CPUAlphaState));
     cpu_exec_init(env);
     alpha_translate_init();
     tlb_flush(env, 1);
-    /* XXX: should not be hardcoded */
-    env->implver = IMPLVER_2106x;
+
+    /* Default to ev67; no reason not to emulate insns by default.  */
+    implver = IMPLVER_21264;
+    amask = (AMASK_BWX | AMASK_FIX | AMASK_CIX | AMASK_MVI
+	     | AMASK_TRAP | AMASK_PREFETCH);
+
+    max = ARRAY_SIZE(cpu_defs);
+    for (i = 0; i < max; i++) {
+        if (strcmp (cpu_model, cpu_defs[i].name) == 0) {
+            implver = cpu_defs[i].implver;
+            amask = cpu_defs[i].amask;
+            break;
+        }
+    }
+    env->implver = implver;
+    env->amask = amask;
+
     env->ps = 0x1F00;
 #if defined (CONFIG_USER_ONLY)
     env->ps |= 1 << 3;
-- 
1.6.5.2

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

* [Qemu-devel] [PATCH 6/7] alpha: Enable softfloat.
  2009-12-10  0:05 [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Richard Henderson
                   ` (4 preceding siblings ...)
  2009-12-09 23:46 ` [Qemu-devel] [PATCH 5/7] alpha: Honor the -cpu command line argument Richard Henderson
@ 2009-12-09 23:48 ` Richard Henderson
  2009-12-09 23:56 ` [Qemu-devel] [PATCH 7/7] alpha: Fixes for alpha-linux syscalls Richard Henderson
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2009-12-09 23:48 UTC (permalink / raw)
  To: qemu-devel


Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 configure                  |    2 +-
 fpu/softfloat-specialize.h |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure b/configure
index a29839e..2d46abb 100755
--- a/configure
+++ b/configure
@@ -2432,7 +2432,7 @@ if test ! -z "$gdb_xml_files" ; then
 fi
 
 case "$target_arch2" in
-  arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
+  alpha|arm|armeb|m68k|microblaze|mips|mipsel|mipsn32|mipsn32el|mips64|mips64el|ppc|ppc64|ppc64abi32|ppcemb|s390x|sparc|sparc64|sparc32plus)
     echo "CONFIG_SOFTFLOAT=y" >> $config_target_mak
     ;;
   *)
diff --git a/fpu/softfloat-specialize.h b/fpu/softfloat-specialize.h
index f607e19..8e6aceb 100644
--- a/fpu/softfloat-specialize.h
+++ b/fpu/softfloat-specialize.h
@@ -61,7 +61,7 @@ typedef struct {
 *----------------------------------------------------------------------------*/
 #if defined(TARGET_SPARC)
 #define float32_default_nan make_float32(0x7FFFFFFF)
-#elif defined(TARGET_POWERPC) || defined(TARGET_ARM)
+#elif defined(TARGET_POWERPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA)
 #define float32_default_nan make_float32(0x7FC00000)
 #elif defined(TARGET_HPPA)
 #define float32_default_nan make_float32(0x7FA00000)
@@ -189,7 +189,7 @@ static float32 propagateFloat32NaN( float32 a, float32 b STATUS_PARAM)
 *----------------------------------------------------------------------------*/
 #if defined(TARGET_SPARC)
 #define float64_default_nan make_float64(LIT64( 0x7FFFFFFFFFFFFFFF ))
-#elif defined(TARGET_POWERPC) || defined(TARGET_ARM)
+#elif defined(TARGET_POWERPC) || defined(TARGET_ARM) || defined(TARGET_ALPHA)
 #define float64_default_nan make_float64(LIT64( 0x7FF8000000000000 ))
 #elif defined(TARGET_HPPA)
 #define float64_default_nan make_float64(LIT64( 0x7FF4000000000000 ))
-- 
1.6.5.2

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

* [Qemu-devel] [PATCH 7/7] alpha: Fixes for alpha-linux syscalls.
  2009-12-10  0:05 [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Richard Henderson
                   ` (5 preceding siblings ...)
  2009-12-09 23:48 ` [Qemu-devel] [PATCH 6/7] alpha: Enable softfloat Richard Henderson
@ 2009-12-09 23:56 ` Richard Henderson
  2009-12-10  7:11 ` [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Laurent Desnogues
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2009-12-09 23:56 UTC (permalink / raw)
  To: qemu-devel


1. Add correct definitions of error numbers.
2. Implement SYS_osf_sigprocmask
3. Implement SYS_osf_get/setsysinfo for IEEE_FP_CONTROL.

This last requires exposing the FPCR value to do_syscall.
Since this value is actually split up into the float_status,
expose routines from helper.c to access it.

Finally, also add a float_exception_mask field to float_status.
We don't actually use it to control delivery of exceptions to
the emulator yet, but simply hold the value that we placed there
when loading/storing the FPCR.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 fpu/softfloat.h            |    1 +
 linux-user/alpha/syscall.h |  212 ++++++++++++++++++++++++++++++++++++++++++++
 linux-user/syscall.c       |  137 ++++++++++++++++++++++++++--
 target-alpha/cpu.h         |   49 ++++++++++
 target-alpha/helper.c      |   77 ++++++++++++++++
 target-alpha/op_helper.c   |   41 +--------
 6 files changed, 468 insertions(+), 49 deletions(-)

diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 636591b..9d82694 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -187,6 +187,7 @@ typedef struct float_status {
     signed char float_detect_tininess;
     signed char float_rounding_mode;
     signed char float_exception_flags;
+    signed char float_exception_mask;
 #ifdef FLOATX80
     signed char floatx80_rounding_precision;
 #endif
diff --git a/linux-user/alpha/syscall.h b/linux-user/alpha/syscall.h
index 394afec..15a0100 100644
--- a/linux-user/alpha/syscall.h
+++ b/linux-user/alpha/syscall.h
@@ -39,3 +39,215 @@ struct target_pt_regs {
 };
 
 #define UNAME_MACHINE "alpha"
+
+#undef TARGET_EDEADLK
+#define TARGET_EDEADLK		11
+#undef TARGET_EAGAIN
+#define TARGET_EAGAIN		35
+#undef TARGET_EINPROGRESS
+#define TARGET_EINPROGRESS	36
+#undef TARGET_EALREADY
+#define TARGET_EALREADY		37
+#undef TARGET_ENOTSOCK
+#define TARGET_ENOTSOCK		38
+#undef TARGET_EDESTADDRREQ
+#define TARGET_EDESTADDRREQ	39
+#undef TARGET_EMSGSIZE
+#define TARGET_EMSGSIZE		40
+#undef TARGET_EPROTOTYPE
+#define TARGET_EPROTOTYPE	41
+#undef TARGET_ENOPROTOOPT
+#define TARGET_ENOPROTOOPT	42
+#undef TARGET_EPROTONOSUPPORT
+#define TARGET_EPROTONOSUPPORT	43
+#undef TARGET_ESOCKTNOSUPPORT
+#define TARGET_ESOCKTNOSUPPORT	44
+#undef TARGET_EOPNOTSUPP
+#define TARGET_EOPNOTSUPP	45
+#undef TARGET_EPFNOSUPPORT
+#define TARGET_EPFNOSUPPORT	46
+#undef TARGET_EAFNOSUPPORT
+#define TARGET_EAFNOSUPPORT	47
+#undef TARGET_EADDRINUSE
+#define TARGET_EADDRINUSE	48
+#undef TARGET_EADDRNOTAVAIL
+#define TARGET_EADDRNOTAVAIL	49
+#undef TARGET_ENETDOWN
+#define TARGET_ENETDOWN		50
+#undef TARGET_ENETUNREACH
+#define TARGET_ENETUNREACH	51
+#undef TARGET_ENETRESET
+#define TARGET_ENETRESET	52
+#undef TARGET_ECONNABORTED
+#define TARGET_ECONNABORTED	53
+#undef TARGET_ECONNRESET
+#define TARGET_ECONNRESET	54
+#undef TARGET_ENOBUFS
+#define TARGET_ENOBUFS		55
+#undef TARGET_EISCONN
+#define TARGET_EISCONN		56
+#undef TARGET_ENOTCONN
+#define TARGET_ENOTCONN		57
+#undef TARGET_ESHUTDOWN
+#define TARGET_ESHUTDOWN	58
+#undef TARGET_ETOOMANYREFS
+#define TARGET_ETOOMANYREFS	59
+#undef TARGET_ETIMEDOUT
+#define TARGET_ETIMEDOUT	60
+#undef TARGET_ECONNREFUSED
+#define TARGET_ECONNREFUSED	61
+#undef TARGET_ELOOP
+#define TARGET_ELOOP		62
+#undef TARGET_ENAMETOOLONG
+#define TARGET_ENAMETOOLONG	63
+#undef TARGET_EHOSTDOWN
+#define TARGET_EHOSTDOWN	64
+#undef TARGET_EHOSTUNREACH
+#define TARGET_EHOSTUNREACH	65
+#undef TARGET_ENOTEMPTY
+#define TARGET_ENOTEMPTY	66
+// Unused			67
+#undef TARGET_EUSERS
+#define TARGET_EUSERS		68
+#undef TARGET_EDQUOT
+#define TARGET_EDQUOT		69
+#undef TARGET_ESTALE
+#define TARGET_ESTALE		70
+#undef TARGET_EREMOTE
+#define TARGET_EREMOTE		71
+// Unused			72-76
+#undef TARGET_ENOLCK
+#define TARGET_ENOLCK		77
+#undef TARGET_ENOSYS
+#define TARGET_ENOSYS		78
+// Unused			79
+#undef TARGET_ENOMSG
+#define TARGET_ENOMSG		80
+#undef TARGET_EIDRM
+#define TARGET_EIDRM		81
+#undef TARGET_ENOSR
+#define TARGET_ENOSR		82
+#undef TARGET_ETIME
+#define TARGET_ETIME		83
+#undef TARGET_EBADMSG
+#define TARGET_EBADMSG		84
+#undef TARGET_EPROTO
+#define TARGET_EPROTO		85
+#undef TARGET_ENODATA
+#define TARGET_ENODATA		86
+#undef TARGET_ENOSTR
+#define TARGET_ENOSTR		87
+#undef TARGET_ECHRNG
+#define TARGET_ECHRNG		88
+#undef TARGET_EL2NSYNC
+#define TARGET_EL2NSYNC		89
+#undef TARGET_EL3HLT
+#define TARGET_EL3HLT		90
+#undef TARGET_EL3RST
+#define TARGET_EL3RST		91
+#undef TARGET_ENOPKG
+#define TARGET_ENOPKG		92
+#undef TARGET_ELNRNG
+#define TARGET_ELNRNG		93
+#undef TARGET_EUNATCH
+#define TARGET_EUNATCH		94
+#undef TARGET_ENOCSI
+#define TARGET_ENOCSI		95
+#undef TARGET_EL2HLT
+#define TARGET_EL2HLT		96
+#undef TARGET_EBADE
+#define TARGET_EBADE		97
+#undef TARGET_EBADR
+#define TARGET_EBADR		98
+#undef TARGET_EXFULL
+#define TARGET_EXFULL		99
+#undef TARGET_ENOANO
+#define TARGET_ENOANO		100
+#undef TARGET_EBADRQC
+#define TARGET_EBADRQC		101
+#undef TARGET_EBADSLT
+#define TARGET_EBADSLT		102
+// Unused			103
+#undef TARGET_EBFONT
+#define TARGET_EBFONT		104
+#undef TARGET_ENONET
+#define TARGET_ENONET		105
+#undef TARGET_ENOLINK
+#define TARGET_ENOLINK		106
+#undef TARGET_EADV
+#define TARGET_EADV		107
+#undef TARGET_ESRMNT
+#define TARGET_ESRMNT		108
+#undef TARGET_ECOMM
+#define TARGET_ECOMM		109
+#undef TARGET_EMULTIHOP
+#define TARGET_EMULTIHOP	110
+#undef TARGET_EDOTDOT
+#define TARGET_EDOTDOT		111
+#undef TARGET_EOVERFLOW
+#define TARGET_EOVERFLOW	112
+#undef TARGET_ENOTUNIQ
+#define TARGET_ENOTUNIQ		113
+#undef TARGET_EBADFD
+#define TARGET_EBADFD		114
+#undef TARGET_EREMCHG
+#define TARGET_EREMCHG		115
+#undef TARGET_EILSEQ
+#define TARGET_EILSEQ		116
+
+// Same as default		117-121
+
+#undef TARGET_ELIBACC
+#define TARGET_ELIBACC		122
+#undef TARGET_ELIBBAD
+#define TARGET_ELIBBAD		123
+#undef TARGET_ELIBSCN
+#define TARGET_ELIBSCN		124
+#undef TARGET_ELIBMAX
+#define TARGET_ELIBMAX		125
+#undef TARGET_ELIBEXEC
+#define TARGET_ELIBEXEC		126
+#undef TARGET_ERESTART
+#define TARGET_ERESTART		127
+#undef TARGET_ESTRPIPE
+#define TARGET_ESTRPIPE		128
+#undef TARGET_ENOMEDIUM
+#define TARGET_ENOMEDIUM	129
+#undef TARGET_EMEDIUMTYPE
+#define TARGET_EMEDIUMTYPE	130
+#undef TARGET_ECANCELED
+#define TARGET_ECANCELED	131
+#undef TARGET_ENOKEY
+#define TARGET_ENOKEY		132
+#undef TARGET_EKEYEXPIRED
+#define TARGET_EKEYEXPIRED	133
+#undef TARGET_EKEYREVOKED
+#define TARGET_EKEYREVOKED	134
+#undef TARGET_EKEYREJECTED
+#define TARGET_EKEYREJECTED	135
+#undef TARGET_EOWNERDEAD
+#define TARGET_EOWNERDEAD	136
+#undef TARGET_ENOTRECOVERABLE
+#define TARGET_ENOTRECOVERABLE	137
+#undef TARGET_ERFKILL
+#define TARGET_ERFKILL		138
+
+// For sys_osf_getsysinfo
+#define TARGET_GSI_UACPROC		8
+#define TARGET_GSI_IEEE_FP_CONTROL	45
+#define TARGET_GSI_IEEE_STATE_AT_SIGNAL	46
+#define TARGET_GSI_PROC_TYPE		60
+#define TARGET_GSI_GET_HWRPB		101
+
+// For sys_ofs_setsysinfo
+#define TARGET_SSI_NVPAIRS		1
+#define TARGET_SSI_IEEE_FP_CONTROL	14
+#define TARGET_SSI_IEEE_STATE_AT_SIGNAL	15
+#define TARGET_SSI_IEEE_IGNORE_STATE_AT_SIGNAL 16
+#define TARGET_SSI_IEEE_RAISE_EXCEPTION	1001
+
+#define TARGET_SSIN_UACPROC		6
+
+#define TARGET_UAC_NOPRINT		1
+#define TARGET_UAC_NOFIX		2
+#define TARGET_UAC_SIGBUS		4
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index e38552c..1acf1f5 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6390,25 +6390,142 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
 #if defined(TARGET_NR_getxuid) && defined(TARGET_ALPHA)
    /* Alpha specific */
     case TARGET_NR_getxuid:
-	 {
-	    uid_t euid;
-	    euid=geteuid();
-	    ((CPUAlphaState *)cpu_env)->ir[IR_A4]=euid;
-	 }
+         {
+            uid_t euid;
+            euid=geteuid();
+            ((CPUAlphaState *)cpu_env)->ir[IR_A4]=euid;
+         }
         ret = get_errno(getuid());
         break;
 #endif
 #if defined(TARGET_NR_getxgid) && defined(TARGET_ALPHA)
    /* Alpha specific */
     case TARGET_NR_getxgid:
-	 {
-	    uid_t egid;
-	    egid=getegid();
-	    ((CPUAlphaState *)cpu_env)->ir[IR_A4]=egid;
-	 }
+         {
+            uid_t egid;
+            egid=getegid();
+            ((CPUAlphaState *)cpu_env)->ir[IR_A4]=egid;
+         }
         ret = get_errno(getgid());
         break;
 #endif
+#if defined(TARGET_NR_osf_getsysinfo) && defined(TARGET_ALPHA)
+    /* Alpha specific */
+    case TARGET_NR_osf_getsysinfo:
+        ret = -TARGET_EOPNOTSUPP;
+        switch (arg1) {
+          case TARGET_GSI_IEEE_FP_CONTROL:
+            {
+                uint64_t swcr, fpcr = cpu_alpha_load_fpcr (cpu_env);
+
+                /* Copied from linux ieee_fpcr_to_swcr.  */
+                swcr = (fpcr >> 35) & SWCR_STATUS_MASK;
+                swcr |= (fpcr >> 36) & SWCR_MAP_DMZ;
+                swcr |= (~fpcr >> 48) & (SWCR_TRAP_ENABLE_INV
+                                        | SWCR_TRAP_ENABLE_DZE
+                                        | SWCR_TRAP_ENABLE_OVF);
+                swcr |= (~fpcr >> 57) & (SWCR_TRAP_ENABLE_UNF
+                                        | SWCR_TRAP_ENABLE_INE);
+                swcr |= (fpcr >> 47) & SWCR_MAP_UMZ;
+                swcr |= (~fpcr >> 41) & SWCR_TRAP_ENABLE_DNO;
+
+                if (put_user_u64 (swcr, arg2))
+                        goto efault;
+                ret = 0;
+            }
+            break;
+
+          /* case GSI_IEEE_STATE_AT_SIGNAL:
+             -- Not implemented in linux kernel.
+             case GSI_UACPROC:
+             -- Retrieves current unaligned access state; not much used.
+             case GSI_PROC_TYPE:
+             -- Retrieves implver information; surely not used.
+             case GSI_GET_HWRPB:
+             -- Grabs a copy of the HWRPB; surely not used.
+          */
+        }
+        break;
+#endif
+#if defined(TARGET_NR_osf_setsysinfo) && defined(TARGET_ALPHA)
+    /* Alpha specific */
+    case TARGET_NR_osf_setsysinfo:
+        ret = -TARGET_EOPNOTSUPP;
+        switch (arg1) {
+          case TARGET_SSI_IEEE_FP_CONTROL:
+          case TARGET_SSI_IEEE_RAISE_EXCEPTION:
+            {
+                uint64_t swcr, fpcr, orig_fpcr;
+
+                if (get_user_u64 (swcr, arg2))
+                    goto efault;
+                orig_fpcr = cpu_alpha_load_fpcr (cpu_env);
+                fpcr = orig_fpcr & FPCR_DYN_MASK;
+
+                /* Copied from linux ieee_swcr_to_fpcr.  */
+                fpcr |= (swcr & SWCR_STATUS_MASK) << 35;
+                fpcr |= (swcr & SWCR_MAP_DMZ) << 36;
+                fpcr |= (~swcr & (SWCR_TRAP_ENABLE_INV
+                                  | SWCR_TRAP_ENABLE_DZE
+                                  | SWCR_TRAP_ENABLE_OVF)) << 48;
+                fpcr |= (~swcr & (SWCR_TRAP_ENABLE_UNF
+                                  | SWCR_TRAP_ENABLE_INE)) << 57;
+                fpcr |= (swcr & SWCR_MAP_UMZ ? FPCR_UNDZ | FPCR_UNFD : 0);
+                fpcr |= (~swcr & SWCR_TRAP_ENABLE_DNO) << 41;
+
+                cpu_alpha_store_fpcr (cpu_env, fpcr);
+                ret = 0;
+
+                if (arg1 == TARGET_SSI_IEEE_RAISE_EXCEPTION) {
+                    /* Old exceptions are not signaled.  */
+                    fpcr &= ~(orig_fpcr & FPCR_STATUS_MASK);
+
+                    /* If any exceptions set by this call, and are unmasked,
+                       send a signal.  */
+                    /* ??? FIXME */
+                }
+            }
+            break;
+
+          /* case SSI_NVPAIRS:
+             -- Used with SSIN_UACPROC to enable unaligned accesses.
+             case SSI_IEEE_STATE_AT_SIGNAL:
+             case SSI_IEEE_IGNORE_STATE_AT_SIGNAL:
+             -- Not implemented in linux kernel
+          */
+        }
+        break;
+#endif
+#ifdef TARGET_NR_osf_sigprocmask
+    /* Alpha specific.  */
+    case TARGET_NR_osf_sigprocmask:
+        {
+            abi_ulong mask;
+            int how = arg1;
+            sigset_t set, oldset;
+
+            switch(arg1) {
+            case TARGET_SIG_BLOCK:
+                how = SIG_BLOCK;
+                break;
+            case TARGET_SIG_UNBLOCK:
+                how = SIG_UNBLOCK;
+                break;
+            case TARGET_SIG_SETMASK:
+                how = SIG_SETMASK;
+                break;
+            default:
+                ret = -TARGET_EINVAL;
+                goto fail;
+            }
+            mask = arg2;
+            target_to_host_old_sigset(&set, &mask);
+            sigprocmask(arg1, &set, &oldset);
+            host_to_target_old_sigset(&mask, &oldset);
+            ret = mask;
+        }
+        break;
+#endif
 
 #ifdef TARGET_NR_getgid32
     case TARGET_NR_getgid32:
diff --git a/target-alpha/cpu.h b/target-alpha/cpu.h
index ca9dfe2..c0dff4b 100644
--- a/target-alpha/cpu.h
+++ b/target-alpha/cpu.h
@@ -139,6 +139,53 @@ enum {
     FP_ROUND_DYNAMIC = 0x3,
 };
 
+/* FPCR bits */
+#define FPCR_SUM		(1ULL << 63)
+#define FPCR_INED		(1ULL << 62)
+#define FPCR_UNFD		(1ULL << 61)
+#define FPCR_UNDZ		(1ULL << 60)
+#define FPCR_DYN_SHIFT		58
+#define FPCR_DYN_MASK		(3ULL << FPCR_DYN_SHIFT)
+#define FPCR_IOV		(1ULL << 57)
+#define FPCR_INE		(1ULL << 56)
+#define FPCR_UNF		(1ULL << 55)
+#define FPCR_OVF		(1ULL << 54)
+#define FPCR_DZE		(1ULL << 53)
+#define FPCR_INV		(1ULL << 52)
+#define FPCR_OVFD		(1ULL << 51)
+#define FPCR_DZED		(1ULL << 50)
+#define FPCR_INVD		(1ULL << 49)
+#define FPCR_DNZ		(1ULL << 48)
+#define FPCR_DNOD		(1ULL << 47)
+#define FPCR_STATUS_MASK	(FPCR_IOV | FPCR_INE | FPCR_UNF \
+				 | FPCR_OVF | FPCR_DZE | FPCR_INV)
+
+/* The silly software trap enables implemented by the kernel emulation.
+   These are more or less architecturally required, since the real hardware
+   has read-as-zero bits in the FPCR when the features aren't implemented.
+   For the purposes of QEMU, we pretend the FPCR can hold everything.  */
+#define SWCR_TRAP_ENABLE_INV	(1ULL << 1)
+#define SWCR_TRAP_ENABLE_DZE	(1ULL << 2)
+#define SWCR_TRAP_ENABLE_OVF	(1ULL << 3)
+#define SWCR_TRAP_ENABLE_UNF	(1ULL << 4)
+#define SWCR_TRAP_ENABLE_INE	(1ULL << 5)
+#define SWCR_TRAP_ENABLE_DNO	(1ULL << 6)
+#define SWCR_TRAP_ENABLE_MASK	((1ULL << 7) - (1ULL << 1))
+
+#define SWCR_MAP_DMZ		(1ULL << 12)
+#define SWCR_MAP_UMZ		(1ULL << 13)
+#define SWCR_MAP_MASK		(SWCR_MAP_DMZ | SWCR_MAP_UMZ)
+
+#define SWCR_STATUS_INV		(1ULL << 17)
+#define SWCR_STATUS_DZE		(1ULL << 18)
+#define SWCR_STATUS_OVF		(1ULL << 19)
+#define SWCR_STATUS_UNF		(1ULL << 20)
+#define SWCR_STATUS_INE		(1ULL << 21)
+#define SWCR_STATUS_DNO		(1ULL << 22)
+#define SWCR_STATUS_MASK	((1ULL << 23) - (1ULL << 17))
+
+#define SWCR_MASK  (SWCR_TRAP_ENABLE_MASK | SWCR_MAP_MASK | SWCR_STATUS_MASK)
+
 /* Internal processor registers */
 /* XXX: TOFIX: most of those registers are implementation dependant */
 enum {
@@ -436,6 +483,8 @@ int cpu_alpha_handle_mmu_fault (CPUState *env, uint64_t address, int rw,
 #define cpu_handle_mmu_fault cpu_alpha_handle_mmu_fault
 void do_interrupt (CPUState *env);
 
+uint64_t cpu_alpha_load_fpcr (CPUState *env);
+void cpu_alpha_store_fpcr (CPUState *env, uint64_t val);
 int cpu_alpha_mfpr (CPUState *env, int iprn, uint64_t *valp);
 int cpu_alpha_mtpr (CPUState *env, int iprn, uint64_t val, uint64_t *oldvalp);
 void pal_init (CPUState *env);
diff --git a/target-alpha/helper.c b/target-alpha/helper.c
index fcd5841..a658f97 100644
--- a/target-alpha/helper.c
+++ b/target-alpha/helper.c
@@ -23,6 +23,83 @@
 
 #include "cpu.h"
 #include "exec-all.h"
+#include "softfloat.h"
+
+uint64_t cpu_alpha_load_fpcr (CPUState *env)
+{
+    uint64_t ret = 0;
+    int flags, mask;
+
+    flags = env->fp_status.float_exception_flags;
+    ret |= (uint64_t) flags << 52;
+    if (flags)
+        ret |= FPCR_SUM;
+    env->ipr[IPR_EXC_SUM] &= ~0x3E;
+    env->ipr[IPR_EXC_SUM] |= flags << 1;
+
+    mask = env->fp_status.float_exception_mask;
+    if (mask & float_flag_invalid)
+        ret |= FPCR_INVD;
+    if (mask & float_flag_divbyzero)
+        ret |= FPCR_DZED;
+    if (mask & float_flag_overflow)
+        ret |= FPCR_OVFD;
+    if (mask & float_flag_underflow)
+        ret |= FPCR_UNFD;
+    if (mask & float_flag_inexact)
+        ret |= FPCR_INED;
+
+    switch (env->fp_status.float_rounding_mode) {
+    case float_round_nearest_even:
+        ret |= 2ULL << FPCR_DYN_SHIFT;
+        break;
+    case float_round_down:
+        ret |= 1ULL << FPCR_DYN_SHIFT;
+        break;
+    case float_round_up:
+        ret |= 3ULL << FPCR_DYN_SHIFT;
+        break;
+    case float_round_to_zero:
+        break;
+    }
+    return ret;
+}
+
+void cpu_alpha_store_fpcr (CPUState *env, uint64_t val)
+{
+    int round_mode, mask;
+
+    set_float_exception_flags((val >> 52) & 0x3F, &env->fp_status);
+
+    mask = 0;
+    if (val & FPCR_INVD)
+        mask |= float_flag_invalid;
+    if (val & FPCR_DZED)
+        mask |= float_flag_divbyzero;
+    if (val & FPCR_OVFD)
+        mask |= float_flag_overflow;
+    if (val & FPCR_UNFD)
+        mask |= float_flag_underflow;
+    if (val & FPCR_INED)
+        mask |= float_flag_inexact;
+    env->fp_status.float_exception_mask = mask;
+
+    switch ((val >> FPCR_DYN_SHIFT) & 3) {
+    case 0:
+        round_mode = float_round_to_zero;
+        break;
+    case 1:
+        round_mode = float_round_down;
+        break;
+    case 2:
+        round_mode = float_round_nearest_even;
+        break;
+    case 3:
+        round_mode = float_round_up;
+        break;
+    }
+    set_float_rounding_mode(round_mode, &env->fp_status);
+}
 
 #if defined(CONFIG_USER_ONLY)
 
diff --git a/target-alpha/op_helper.c b/target-alpha/op_helper.c
index 508272c..999a8ab 100644
--- a/target-alpha/op_helper.c
+++ b/target-alpha/op_helper.c
@@ -39,49 +39,12 @@ uint64_t helper_load_pcc (void)
 
 uint64_t helper_load_fpcr (void)
 {
-    uint64_t ret = 0;
-#ifdef CONFIG_SOFTFLOAT
-    ret |= env->fp_status.float_exception_flags << 52;
-    if (env->fp_status.float_exception_flags)
-        ret |= 1ULL << 63;
-    env->ipr[IPR_EXC_SUM] &= ~0x3E:
-    env->ipr[IPR_EXC_SUM] |= env->fp_status.float_exception_flags << 1;
-#endif
-    switch (env->fp_status.float_rounding_mode) {
-    case float_round_nearest_even:
-        ret |= 2ULL << 58;
-        break;
-    case float_round_down:
-        ret |= 1ULL << 58;
-        break;
-    case float_round_up:
-        ret |= 3ULL << 58;
-        break;
-    case float_round_to_zero:
-        break;
-    }
-    return ret;
+    return cpu_alpha_load_fpcr (env);
 }
 
 void helper_store_fpcr (uint64_t val)
 {
-#ifdef CONFIG_SOFTFLOAT
-    set_float_exception_flags((val >> 52) & 0x3F, &FP_STATUS);
-#endif
-    switch ((val >> 58) & 3) {
-    case 0:
-        set_float_rounding_mode(float_round_to_zero, &FP_STATUS);
-        break;
-    case 1:
-        set_float_rounding_mode(float_round_down, &FP_STATUS);
-        break;
-    case 2:
-        set_float_rounding_mode(float_round_nearest_even, &FP_STATUS);
-        break;
-    case 3:
-        set_float_rounding_mode(float_round_up, &FP_STATUS);
-        break;
-    }
+    cpu_alpha_store_fpcr (env, val);
 }
 
 static spinlock_t intr_cpu_lock = SPIN_LOCK_UNLOCKED;
-- 
1.6.5.2

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

* [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation
@ 2009-12-10  0:05 Richard Henderson
  2009-12-09 23:38 ` [Qemu-devel] [PATCH 1/7] alpha: Implement IMB; add placeholders for other userspace PALcalls Richard Henderson
                   ` (9 more replies)
  0 siblings, 10 replies; 18+ messages in thread
From: Richard Henderson @ 2009-12-10  0:05 UTC (permalink / raw)
  To: qemu-devel


The following patch series results in an emulator that's good enough
to run a good bit of the GCC testsuite, dynamic linking and all.
There are more failures than native hardware.  At first glance they
appear to be fpu related, but I havn't investigated properly yet.


r~
--


Richard Henderson (7):
  alpha: Implement IMB; add placeholders for other userspace PALcalls.
  alpha: Drop bogus UNIQ initial value on Linux.
  alpha: Add binfmt entry.
  alpha: Remove bogus DO_TB_FLUSH code from translator.
  alpha: Honor the -cpu command line argument. Also change the default
    cpu to ev67.
  alpha: Enable softfloat.
  alpha: Fixes for alpha-linux syscalls.

 configure                  |    2 +-
 fpu/softfloat-specialize.h |    4 +-
 fpu/softfloat.h            |    1 +
 hw/alpha_palcode.c         |   29 ++++++-
 linux-user/alpha/syscall.h |  212 ++++++++++++++++++++++++++++++++++++++++++++
 linux-user/elfload.c       |    3 -
 linux-user/syscall.c       |  137 ++++++++++++++++++++++++++--
 qemu-binfmt-conf.sh        |    3 +
 target-alpha/cpu.h         |   49 ++++++++++
 target-alpha/helper.c      |   77 ++++++++++++++++
 target-alpha/helper.h      |    2 -
 target-alpha/op_helper.c   |   46 +---------
 target-alpha/translate.c   |   52 +++++++++--
 13 files changed, 544 insertions(+), 73 deletions(-)

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

* Re: [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation
  2009-12-10  0:05 [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Richard Henderson
                   ` (6 preceding siblings ...)
  2009-12-09 23:56 ` [Qemu-devel] [PATCH 7/7] alpha: Fixes for alpha-linux syscalls Richard Henderson
@ 2009-12-10  7:11 ` Laurent Desnogues
  2009-12-10 16:54   ` Richard Henderson
  2009-12-11 10:08 ` Tristan Gingold
  2009-12-13 19:46 ` Aurelien Jarno
  9 siblings, 1 reply; 18+ messages in thread
From: Laurent Desnogues @ 2009-12-10  7:11 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel

On Thu, Dec 10, 2009 at 1:05 AM, Richard Henderson <rth@twiddle.net> wrote:
>
> The following patch series results in an emulator that's good enough
> to run a good bit of the GCC testsuite, dynamic linking and all.
> There are more failures than native hardware.  At first glance they
> appear to be fpu related, but I havn't investigated properly yet.

I don't know what FPU instructions gcc emits, but QEMU doesn't
handle the rounding mode encoding.  If you're interested I started
implementing that, though it's not complete (and it didn't fix the
SPEC2k equake failure I had).


Laurent

>
> r~
> --
>
>
> Richard Henderson (7):
>  alpha: Implement IMB; add placeholders for other userspace PALcalls.
>  alpha: Drop bogus UNIQ initial value on Linux.
>  alpha: Add binfmt entry.
>  alpha: Remove bogus DO_TB_FLUSH code from translator.
>  alpha: Honor the -cpu command line argument. Also change the default
>    cpu to ev67.
>  alpha: Enable softfloat.
>  alpha: Fixes for alpha-linux syscalls.
>
>  configure                  |    2 +-
>  fpu/softfloat-specialize.h |    4 +-
>  fpu/softfloat.h            |    1 +
>  hw/alpha_palcode.c         |   29 ++++++-
>  linux-user/alpha/syscall.h |  212 ++++++++++++++++++++++++++++++++++++++++++++
>  linux-user/elfload.c       |    3 -
>  linux-user/syscall.c       |  137 ++++++++++++++++++++++++++--
>  qemu-binfmt-conf.sh        |    3 +
>  target-alpha/cpu.h         |   49 ++++++++++
>  target-alpha/helper.c      |   77 ++++++++++++++++
>  target-alpha/helper.h      |    2 -
>  target-alpha/op_helper.c   |   46 +---------
>  target-alpha/translate.c   |   52 +++++++++--
>  13 files changed, 544 insertions(+), 73 deletions(-)
>
>
>
>

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

* Re: [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation
  2009-12-10  7:11 ` [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Laurent Desnogues
@ 2009-12-10 16:54   ` Richard Henderson
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2009-12-10 16:54 UTC (permalink / raw)
  To: Laurent Desnogues; +Cc: qemu-devel

On 12/09/2009 11:11 PM, Laurent Desnogues wrote:
> I don't know what FPU instructions gcc emits, but QEMU doesn't
> handle the rounding mode encoding.

Ah yes, GCC does make use of those.

> If you're interested I started
> implementing that, though it's not complete (and it didn't fix the
> SPEC2k equake failure I had).

Sure, I'm interested.  Pass it along.


r~

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

* Re: [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation
  2009-12-10  0:05 [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Richard Henderson
                   ` (7 preceding siblings ...)
  2009-12-10  7:11 ` [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Laurent Desnogues
@ 2009-12-11 10:08 ` Tristan Gingold
  2009-12-11 23:49   ` Richard Henderson
  2009-12-13 19:46 ` Aurelien Jarno
  9 siblings, 1 reply; 18+ messages in thread
From: Tristan Gingold @ 2009-12-11 10:08 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel


On Dec 10, 2009, at 1:05 AM, Richard Henderson wrote:

> 
> The following patch series results in an emulator that's good enough
> to run a good bit of the GCC testsuite, dynamic linking and all.
> There are more failures than native hardware.  At first glance they
> appear to be fpu related, but I havn't investigated properly yet.

Richard,

just in case you weren't aware and are interested: I was able to make an es40 emulation in qemu good enough
to start Linux.  I did this work several months ago, so it need revival.
At this time the main limitation was the absence of IOMMU abstraction in qemu.

Tristan.

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

* Re: [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation
  2009-12-11 10:08 ` Tristan Gingold
@ 2009-12-11 23:49   ` Richard Henderson
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2009-12-11 23:49 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: qemu-devel

On 12/11/2009 02:08 AM, Tristan Gingold wrote:
> just in case you weren't aware and are interested: I was able to make
> an es40 emulation in qemu good enough to start Linux.  I did this
> work several months ago, so it need revival. At this time the main
> limitation was the absence of IOMMU abstraction in qemu.

At the moment I'm most interested in being able to test gcc, so 
user-level is enough.  However, being able to boot a real kernel would 
be a Really Cool Thing.

BTW, who takes care of reviewing and committing patches to 
non-mainstream cpus like this?


r~

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

* Re: [Qemu-devel] [PATCH 1/7] alpha: Implement IMB; add placeholders for other userspace PALcalls.
  2009-12-09 23:38 ` [Qemu-devel] [PATCH 1/7] alpha: Implement IMB; add placeholders for other userspace PALcalls Richard Henderson
@ 2009-12-13 19:28   ` Aurelien Jarno
  2009-12-13 19:54     ` Richard Henderson
  0 siblings, 1 reply; 18+ messages in thread
From: Aurelien Jarno @ 2009-12-13 19:28 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel

On Wed, Dec 09, 2009 at 03:38:40PM -0800, Richard Henderson wrote:
> 
> Signed-off-by: Richard Henderson <rth@twiddle.net>
> ---
>  hw/alpha_palcode.c |   29 +++++++++++++++++++++++++++--
>  1 files changed, 27 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/alpha_palcode.c b/hw/alpha_palcode.c
> index c48a297..44b2ca4 100644
> --- a/hw/alpha_palcode.c
> +++ b/hw/alpha_palcode.c
> @@ -1062,6 +1062,16 @@ void call_pal (CPUState *env, int palcode)
>  
>      qemu_log("%s: palcode %02x\n", __func__, palcode);
>      switch (palcode) {
> +    case 0x80:
> +        /* BPT */
> +        qemu_log("BPT\n");
> +        /* FIXME: Sends SIGTRAP, si_code=TRAP_BRKPT.  */
> +        exit(1);
> +    case 0x81:
> +        /* BUGCHK */
> +        qemu_log("BUGCHK\n");
> +        /* FIXME: Sends SIGTRAP, si_code=SI_FAULT.  */
> +        exit(1);
>      case 0x83:
>          /* CALLSYS */
>          qemu_log("CALLSYS n " TARGET_FMT_ld "\n", env->ir[0]);
> @@ -1076,6 +1086,11 @@ void call_pal (CPUState *env, int palcode)
>              env->ir[IR_V0] = -ret;
>          }
>          break;
> +    case 0x86:
> +        /* IMB */
> +        qemu_log("IMB\n");
> +        tb_flush(env);

Is it really necessary to flush all the TB here? QEMU should already
discard TB that have been modified.

On other architecture this kind of memory barrier instruction is simply
ignored.

> +        break;
>      case 0x9E:
>          /* RDUNIQUE */
>          env->ir[IR_V0] = env->unique;
> @@ -1086,9 +1101,19 @@ void call_pal (CPUState *env, int palcode)
>          env->unique = env->ir[IR_A0];
>          qemu_log("WRUNIQUE: " TARGET_FMT_lx "\n", env->unique);
>          break;
> +    case 0xAA:
> +        /* GENTRAP */
> +        qemu_log("GENTRAP: " TARGET_FMT_lx "\n", env->ir[IR_A0]);
> +        /* FIXME: This is supposed to send a signal:
> +           SIGFPE:
> +             GEN_INTOVF, GEN_INTDIV, GEN_FLTOVF, GEN_FLTDIV,
> +             GEN_FLTUND, GEN_FLTINV, GEN_FLTINE, GEN_ROPRAND
> +           SIGTRAP:
> +             others
> +           with various settings of si_code.  */
> +        exit(1);
>      default:
> -        qemu_log("%s: unhandled palcode %02x\n",
> -                    __func__, palcode);
> +        qemu_log("%s: unhandled palcode %02x\n", __func__, palcode);
>          exit(1);
>      }
>  }
> -- 
> 1.6.5.2
> 
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

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

* Re: [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation
  2009-12-10  0:05 [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Richard Henderson
                   ` (8 preceding siblings ...)
  2009-12-11 10:08 ` Tristan Gingold
@ 2009-12-13 19:46 ` Aurelien Jarno
  2009-12-13 20:16   ` Andreas Färber
  9 siblings, 1 reply; 18+ messages in thread
From: Aurelien Jarno @ 2009-12-13 19:46 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel

On Wed, Dec 09, 2009 at 04:05:22PM -0800, Richard Henderson wrote:
> 
> The following patch series results in an emulator that's good enough
> to run a good bit of the GCC testsuite, dynamic linking and all.
> There are more failures than native hardware.  At first glance they
> appear to be fpu related, but I havn't investigated properly yet.
> 

Thanks for the patches, I have applied all of them except the first one
(see my comment on this patch).

> 
> 
> Richard Henderson (7):
>   alpha: Implement IMB; add placeholders for other userspace PALcalls.
>   alpha: Drop bogus UNIQ initial value on Linux.
>   alpha: Add binfmt entry.
>   alpha: Remove bogus DO_TB_FLUSH code from translator.
>   alpha: Honor the -cpu command line argument. Also change the default
>     cpu to ev67.
>   alpha: Enable softfloat.
>   alpha: Fixes for alpha-linux syscalls.
> 
>  configure                  |    2 +-
>  fpu/softfloat-specialize.h |    4 +-
>  fpu/softfloat.h            |    1 +
>  hw/alpha_palcode.c         |   29 ++++++-
>  linux-user/alpha/syscall.h |  212 ++++++++++++++++++++++++++++++++++++++++++++
>  linux-user/elfload.c       |    3 -
>  linux-user/syscall.c       |  137 ++++++++++++++++++++++++++--
>  qemu-binfmt-conf.sh        |    3 +
>  target-alpha/cpu.h         |   49 ++++++++++
>  target-alpha/helper.c      |   77 ++++++++++++++++
>  target-alpha/helper.h      |    2 -
>  target-alpha/op_helper.c   |   46 +---------
>  target-alpha/translate.c   |   52 +++++++++--
>  13 files changed, 544 insertions(+), 73 deletions(-)
> 
> 
> 
> 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

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

* Re: [Qemu-devel] [PATCH 1/7] alpha: Implement IMB; add placeholders for other userspace PALcalls.
  2009-12-13 19:28   ` Aurelien Jarno
@ 2009-12-13 19:54     ` Richard Henderson
  2009-12-13 20:47       ` Aurelien Jarno
  0 siblings, 1 reply; 18+ messages in thread
From: Richard Henderson @ 2009-12-13 19:54 UTC (permalink / raw)
  To: Aurelien Jarno; +Cc: qemu-devel

On 12/13/2009 11:28 AM, Aurelien Jarno wrote:
> Is it really necessary to flush all the TB here? QEMU should already
> discard TB that have been modified.

No.  But I meant to look into this more carefully with a view to 
disabling the other checking within QEMU and speed things up a tad.  It 
seems to me that the explicit checking with each memory write ought to 
only be necessary on architectures like x86 that don't architecturally 
require a flush insn to be used.

I can drop this fragment if necessary for patch acceptance, however.


r~

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

* Re: [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation
  2009-12-13 19:46 ` Aurelien Jarno
@ 2009-12-13 20:16   ` Andreas Färber
  2009-12-14  0:43     ` Richard Henderson
  0 siblings, 1 reply; 18+ messages in thread
From: Andreas Färber @ 2009-12-13 20:16 UTC (permalink / raw)
  To: Richard Henderson; +Cc: QEMU Developers, Aurélien Jarno

Hello,

Am 13.12.2009 um 20:46 schrieb Aurelien Jarno:

> On Wed, Dec 09, 2009 at 04:05:22PM -0800, Richard Henderson wrote:
>>
>> The following patch series results in an emulator that's good enough
>> to run a good bit of the GCC testsuite, dynamic linking and all.

>> There are more failures than native hardware.

;-)

>> At first glance they
>> appear to be fpu related, but I havn't investigated properly yet.
>>
>
> Thanks for the patches, I have applied all of them except the first  
> one

I've checked the linux-user testsuite 0.3 on master:
The message "Set unique value to 0000000120060e38 (0000000120060e38)"  
is gone now, but `ls -l dummyfile` doesn't list the file yet.

Would this be fpu related? If there were missing syscalls or  
something, I would expect an error/warning message rather than silent  
failure.

Andreas

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

* Re: [Qemu-devel] [PATCH 1/7] alpha: Implement IMB; add placeholders for other userspace PALcalls.
  2009-12-13 19:54     ` Richard Henderson
@ 2009-12-13 20:47       ` Aurelien Jarno
  0 siblings, 0 replies; 18+ messages in thread
From: Aurelien Jarno @ 2009-12-13 20:47 UTC (permalink / raw)
  To: Richard Henderson; +Cc: qemu-devel

On Sun, Dec 13, 2009 at 11:54:02AM -0800, Richard Henderson wrote:
> On 12/13/2009 11:28 AM, Aurelien Jarno wrote:
> >Is it really necessary to flush all the TB here? QEMU should already
> >discard TB that have been modified.
> 
> No.  But I meant to look into this more carefully with a view to
> disabling the other checking within QEMU and speed things up a tad.
> It seems to me that the explicit checking with each memory write
> ought to only be necessary on architectures like x86 that don't
> architecturally require a flush insn to be used.

This is actually done only on the first write access to a page and not
to each write, so it should not be so costly. It is however something
to investigate, as I agree that removing the checks can add some 
speed-up.

> I can drop this fragment if necessary for patch acceptance, however.
> 

I think it is better to drop it until we have a better view of the whole
thing. You can add a comment saying that an optimisation might be
possible here. 

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

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

* Re: [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation
  2009-12-13 20:16   ` Andreas Färber
@ 2009-12-14  0:43     ` Richard Henderson
  0 siblings, 0 replies; 18+ messages in thread
From: Richard Henderson @ 2009-12-14  0:43 UTC (permalink / raw)
  To: Andreas Färber; +Cc: =?ISO-8859-1?Q?Aur=E9lien_?=, QEMU Developers, Jarno

On 12/13/2009 12:16 PM, Andreas Färber wrote:
> I've checked the linux-user testsuite 0.3 on master:
> The message "Set unique value to 0000000120060e38 (0000000120060e38)" is
> gone now, but `ls -l dummyfile` doesn't list the file yet.

Checking...

Alpha doesn't use __NR_getdents64, it uses __NR_osf_getdirentries which 
isn't implemented.


r~

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

end of thread, other threads:[~2009-12-14  0:43 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-10  0:05 [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Richard Henderson
2009-12-09 23:38 ` [Qemu-devel] [PATCH 1/7] alpha: Implement IMB; add placeholders for other userspace PALcalls Richard Henderson
2009-12-13 19:28   ` Aurelien Jarno
2009-12-13 19:54     ` Richard Henderson
2009-12-13 20:47       ` Aurelien Jarno
2009-12-09 23:39 ` [Qemu-devel] [PATCH 2/7] alpha: Drop bogus UNIQ initial value on Linux Richard Henderson
2009-12-09 23:40 ` [Qemu-devel] [PATCH 3/7] alpha: Add binfmt entry Richard Henderson
2009-12-09 23:44 ` [Qemu-devel] [PATCH 4/7] alpha: Remove bogus DO_TB_FLUSH code from translator Richard Henderson
2009-12-09 23:46 ` [Qemu-devel] [PATCH 5/7] alpha: Honor the -cpu command line argument Richard Henderson
2009-12-09 23:48 ` [Qemu-devel] [PATCH 6/7] alpha: Enable softfloat Richard Henderson
2009-12-09 23:56 ` [Qemu-devel] [PATCH 7/7] alpha: Fixes for alpha-linux syscalls Richard Henderson
2009-12-10  7:11 ` [Qemu-devel] [PATCH 0/7] Improve alpha-linux userspace emulation Laurent Desnogues
2009-12-10 16:54   ` Richard Henderson
2009-12-11 10:08 ` Tristan Gingold
2009-12-11 23:49   ` Richard Henderson
2009-12-13 19:46 ` Aurelien Jarno
2009-12-13 20:16   ` Andreas Färber
2009-12-14  0:43     ` Richard Henderson

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).