Skip to contentSkip to conversation

Adding support for Mac OS X ppc64 host

Qemu-devel Superseded Andreas Faerber 4 participants 28 messages Dec 6, 2009 – Dec 15, 2009

lore
Share & tools
lore
#0 lore raw

Hello,

This mini series adds TCG target support for OSX/ppc64 and fixes the Cocoa frontend for ppc64.

With these patches applied, qemu and qemu-system-x86_64 are usable. Tested on Mac OS X v10.5 with a Haiku disk image and a Fedora 12 installation disk.

qemu-system-sparc works fine, too.

qemu-system-sparc64 works on ppc64 while it didn't on ppc! qemu-system-ppc appears to hang on ppc64 but doesn't on ppc.

I suggest we start applying these patches and try to fix these weird issues afterwards.

Regards,

Andreas

#1 lore raw

PATCH 1/3 TCG: Mac OS X support for ppc64 target

Darwin/ppc64 does not use function descriptors, adapt prologue and tcg_out_call accordingly. GPR2 is available for general use, so let's use it.

http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/LowLevelABI/110-64-bit_PowerPC_Function_Calling_Conventions/64bitPowerPC.html

---
 tcg/ppc64/tcg-target.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
tcg/ppc64/tcg-target.c +30 -0
index a612e10..bf9b7d9 100644
@@ -104,6 +104,9 @@ static const int tcg_target_reg_alloc_order[] = {
     TCG_REG_R29,
     TCG_REG_R30,
     TCG_REG_R31,
+#ifdef __APPLE__
+    TCG_REG_R2,
+#endif
     TCG_REG_R3,
     TCG_REG_R4,
     TCG_REG_R5,
@@ -112,7 +115,9 @@ static const int tcg_target_reg_alloc_order[] = {
     TCG_REG_R8,
     TCG_REG_R9,
     TCG_REG_R10,
+#ifndef __APPLE__
     TCG_REG_R11,
+#endif
     TCG_REG_R12,
     TCG_REG_R24,
     TCG_REG_R25,
@@ -136,6 +141,10 @@ static const int tcg_target_call_oarg_regs[2] = {
 };
 
 static const int tcg_target_callee_save_regs[] = {
+#ifdef __APPLE__
+    TCG_REG_R11,
+    TCG_REG_R13,
+#endif
     TCG_REG_R14,
     TCG_REG_R15,
     TCG_REG_R16,
@@ -477,8 +486,21 @@ static void tcg_out_movi (TCGContext *s, TCGType type,
     }
 }
 
+#ifdef __APPLE__
+static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target);
+#endif
+
 static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
 {
+#ifdef __APPLE__
+    if (const_arg) {
+        tcg_out_b (s, LK, arg);
+    }
+    else {
+        tcg_out32 (s, MTSPR | RS (arg) | LR);
+        tcg_out32 (s, BCLR | BO_ALWAYS | LK);
+    }
+#else
     int reg;
 
     if (const_arg) {
@@ -492,6 +514,7 @@ static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
     tcg_out32 (s, LD | RT (11) | RA (reg) | 16);
     tcg_out32 (s, LD | RT (2) | RA (reg) | 8);
     tcg_out32 (s, BCCTR | BO_ALWAYS | LK);
+#endif
 }
 
 static void tcg_out_ldst (TCGContext *s, int ret, int addr,
@@ -859,10 +882,12 @@ void tcg_target_qemu_prologue (TCGContext *s)
         ;
     frame_size = (frame_size + 15) & ~15;
 
+#ifndef __APPLE__
     /* First emit adhoc function descriptor */
     addr = (uint64_t) s->code_ptr + 24;
     tcg_out32 (s, addr >> 32); tcg_out32 (s, addr); /* entry point */
     s->code_ptr += 16;          /* skip TOC and environment pointer */
+#endif
 
     /* Prologue */
     tcg_out32 (s, MFSPR | RT (0) | LR);
@@ -1516,6 +1541,9 @@ void tcg_target_init (TCGContext *s)
     tcg_regset_set32 (tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffffffff);
     tcg_regset_set32 (tcg_target_call_clobber_regs, 0,
                      (1 << TCG_REG_R0) |
+#ifdef __APPLE__
+                     (1 << TCG_REG_R2) |
+#endif
                      (1 << TCG_REG_R3) |
                      (1 << TCG_REG_R4) |
                      (1 << TCG_REG_R5) |
@@ -1531,7 +1559,9 @@ void tcg_target_init (TCGContext *s)
     tcg_regset_clear (s->reserved_regs);
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R0);
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R1);
+#ifndef __APPLE__
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R2);
+#endif
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R13);
 
 #ifdef CONFIG_USE_GUEST_BASE
Signature · 1 line
1.6.5.3
#2 lore raw

PATCH 2/3 Cocoa: ppc64 host support

Fix integer usage in the Cocoa backend: NSInteger is long on LP64.

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/doc/uid/20000014-BBCFHHCD

This makes the graphical display show up on a ppc64 host.

Cc Alexander Graf <[email protected]>
Cc Mike Kronenberg <[email protected]>
---
 cocoa.m |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
cocoa.m +1 -1
index 55ff2b4..7062571 100644
@@ -337,7 +337,7 @@ int cocoa_keycode_to_qemu(int keycode)
         } else {
             // selective drawing code (draws only dirty rectangles) (OS X >= 10.4)
             const NSRect *rectList;
-            int rectCount;
+            NSInteger rectCount;
             int i;
             CGImageRef clipImageRef;
             CGRect clipRect;
Signature · 1 line
1.6.5.3
#3 lore raw

PATCH 3/3 Cocoa: Silence warnings

Missing static for cocoa_keycode_to_qemu.
Missing const for character constant.

__LITTLE_ENDIAN__ is undefined on Big Endian host.

---
 cocoa.m |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
cocoa.m +3 -3
index 7062571..05f507d 100644
@@ -229,7 +229,7 @@ int keymap[] =
 */
 };
 
-int cocoa_keycode_to_qemu(int keycode)
+static int cocoa_keycode_to_qemu(int keycode)
 {
     if((sizeof(keymap)/sizeof(int)) <= keycode)
     {
@@ -315,7 +315,7 @@ int cocoa_keycode_to_qemu(int keycode)
             screen.bitsPerComponent, //bitsPerComponent
             screen.bitsPerPixel, //bitsPerPixel
             (screen.width * (screen.bitsPerComponent/2)), //bytesPerRow
-#if __LITTLE_ENDIAN__
+#ifdef __LITTLE_ENDIAN__
             CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB), //colorspace for OS X >= 10.4
             kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
 #else
@@ -783,7 +783,7 @@ int cocoa_keycode_to_qemu(int keycode)
     if(returnCode == NSCancelButton) {
         exit(0);
     } else if(returnCode == NSOKButton) {
-        char *bin = "qemu";
+        const char *bin = "qemu";
         char *img = (char*)[ [ sheet filename ] cStringUsingEncoding:NSASCIIStringEncoding];
 
         char **argv = (char**)malloc( sizeof(char*)*3 );
Signature · 1 line
1.6.5.3
#4 lore raw

[Qemu-devel] Re: [PATCH 1/3] TCG: Mac OS X support for ppc64 target

In reply to Andreas Faerber
Quoted 37 lines · Andreas Faerber

Darwin/ppc64 does not use function descriptors, adapt prologue and tcg_out_call accordingly. GPR2 is available for general use, so let's use it.

http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/LowLevelABI/110-64-bit_PowerPC_Function_Calling_Conventions/64bitPowerPC.html

---
 tcg/ppc64/tcg-target.c |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)
tcg/ppc64/tcg-target.c +5 -0
index a612e10..bf9b7d9 100644
@@ -104,6 +104,9 @@ static const int tcg_target_reg_alloc_order[] = {
     TCG_REG_R29,
     TCG_REG_R30,
     TCG_REG_R31,
+#ifdef __APPLE__
+    TCG_REG_R2,
+#endif
     TCG_REG_R3,
     TCG_REG_R4,
     TCG_REG_R5,
@@ -112,7 +115,9 @@ static const int tcg_target_reg_alloc_order[] = {
     TCG_REG_R8,
     TCG_REG_R9,
     TCG_REG_R10,
+#ifndef __APPLE__
     TCG_REG_R11,
+#endif
     TCG_REG_R12,
     TCG_REG_R24,
     TCG_REG_R25,

tcg/ppc64/tcg-target.c static const int tcg_target_call_oarg_regs[2] = { · line 147

Quoted 7 lines
tcg/ppc64/tcg-target.c +4 -0
@@ -136,6 +141,10 @@ static const int tcg_target_call_oarg_regs[2] = {
 };
 
 static const int tcg_target_callee_save_regs[] = {
+#ifdef __APPLE__
+    TCG_REG_R11,
+    TCG_REG_R13,
+#endif

No need to add R13, it's reserved anyhow.

Quoted 36 lines
tcg/ppc64/tcg-target.c +14 -0
     TCG_REG_R14,
     TCG_REG_R15,
     TCG_REG_R16,
@@ -477,8 +486,21 @@ static void tcg_out_movi (TCGContext *s, TCGType type,
     }
 }
 
+#ifdef __APPLE__
+static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target);
+#endif
+
 static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
 {
+#ifdef __APPLE__
+    if (const_arg) {
+        tcg_out_b (s, LK, arg);
+    }
+    else {
+        tcg_out32 (s, MTSPR | RS (arg) | LR);
+        tcg_out32 (s, BCLR | BO_ALWAYS | LK);
+    }
+#else
     int reg;
 
     if (const_arg) {
@@ -492,6 +514,7 @@ static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
     tcg_out32 (s, LD | RT (11) | RA (reg) | 16);
     tcg_out32 (s, LD | RT (2) | RA (reg) | 8);
     tcg_out32 (s, BCCTR | BO_ALWAYS | LK);
+#endif
 }
 
 static void tcg_out_ldst (TCGContext *s, int ret, int addr,
@@ -859,10 +882,12 @@ void tcg_target_qemu_prologue (TCGContext *s)
         ;
     frame_size = (frame_size + 15) & ~15;

tcg/ppc64/tcg-target.c void tcg_target_qemu_prologue (TCGContext *s) · line 893

Quoted 10 lines
tcg/ppc64/tcg-target.c +2 -0
 
+#ifndef __APPLE__
     /* First emit adhoc function descriptor */
     addr = (uint64_t) s->code_ptr + 24;
     tcg_out32 (s, addr >> 32); tcg_out32 (s, addr); /* entry point */
     s->code_ptr += 16;          /* skip TOC and environment pointer */
+#endif
 
     /* Prologue */
     tcg_out32 (s, MFSPR | RT (0) | LR);

The frame format is different to that of PPC-elf64abi, shouldn't really make a difference here, then again i don't have access to PPC64 Mac OSX, so can't really verify that.

Quoted 12 lines
tcg/ppc64/tcg-target.c +3 -0
@@ -1516,6 +1541,9 @@ void tcg_target_init (TCGContext *s)
     tcg_regset_set32 (tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffffffff);
     tcg_regset_set32 (tcg_target_call_clobber_regs, 0,
                      (1 << TCG_REG_R0) |
+#ifdef __APPLE__
+                     (1 << TCG_REG_R2) |
+#endif
                      (1 << TCG_REG_R3) |
                      (1 << TCG_REG_R4) |
                      (1 << TCG_REG_R5) |

tcg/ppc64/tcg-target.c void tcg_target_init (TCGContext *s) · line 1567

Quoted 9 lines
tcg/ppc64/tcg-target.c +2 -0
@@ -1531,7 +1559,9 @@ void tcg_target_init (TCGContext *s)
     tcg_regset_clear (s->reserved_regs);
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R0);
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R1);
+#ifndef __APPLE__
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R2);
+#endif
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R13);
 
 #ifdef CONFIG_USE_GUEST_BASE

Otherwise looks good.. Should i commit it with R13 fixed?

Signature · 1 line
mailto:[email protected]
#5 lore raw

[Qemu-devel] Re: [PATCH 1/3] TCG: Mac OS X support for ppc64 target

Am 06.12.2009 um 06:13 schrieb malc:

Quoted 31 lines · Andreas Faerber
Quoted 30 lines

Darwin/ppc64 does not use function descriptors, adapt prologue and tcg_out_call accordingly. GPR2 is available for general use, so let's use it.

http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/LowLevelABI/110-64-bit_PowerPC_Function_Calling_Conventions/64bitPowerPC.html

---
tcg/ppc64/tcg-target.c | 30 ++++++++++++++++++++++++++++++

1 files changed, 30 insertions(+), 0 deletions(-)
tcg/ppc64/tcg-target.c +2 -0
index a612e10..bf9b7d9 100644
@@ -859,10 +882,12 @@ void tcg_target_qemu_prologue (TCGContext *s)
        ;
    frame_size = (frame_size + 15) & ~15;
 
+#ifndef __APPLE__
    /* First emit adhoc function descriptor */
    addr = (uint64_t) s->code_ptr + 24;
    tcg_out32 (s, addr >> 32); tcg_out32 (s, addr); /* entry point */
    s->code_ptr += 16;          /* skip TOC and environment pointer  
 */
+#endif
 
Quoted 6 lines
Quoted 2 lines
tcg/ppc64/tcg-target.c +0 -0
    /* Prologue */
    tcg_out32 (s, MFSPR | RT (0) | LR);

The frame format is different to that of PPC-elf64abi, shouldn't really make a difference here, then again i don't have access to PPC64 Mac OSX, so can't really verify that.

I checked that the linkage area is 48, too, the LR offset is 16, too. The parameter area was depicted as 64 < 128.
So I guess we're good there.

Quoted 1 line

Otherwise looks good.. Should i commit it with R13 fixed?

About the callee-save stuff I was less certain. Feel free to make modifications (e.g., moving tcg_out_call up?) or have me resubmit.

Thanks,
Andreas

#6 lore raw

[Qemu-devel] Re: [PATCH 1/3] TCG: Mac OS X support for ppc64 target

Quoted 40 lines · Andreas F?rber

Am 06.12.2009 um 06:13 schrieb malc:

Quoted 30 lines · Andreas Faerber
Quoted 29 lines

Darwin/ppc64 does not use function descriptors, adapt prologue and tcg_out_call accordingly. GPR2 is available for general use, so let's use it.

http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/LowLevelABI/110-64-bit_PowerPC_Function_Calling_Conventions/64bitPowerPC.html

---
tcg/ppc64/tcg-target.c | 30 ++++++++++++++++++++++++++++++

1 files changed, 30 insertions(+), 0 deletions(-)
tcg/ppc64/tcg-target.c +2 -0
index a612e10..bf9b7d9 100644
@@ -859,10 +882,12 @@ void tcg_target_qemu_prologue (TCGContext *s)
       ;
   frame_size = (frame_size + 15) & ~15;
 
+#ifndef __APPLE__
   /* First emit adhoc function descriptor */
   addr = (uint64_t) s->code_ptr + 24;
   tcg_out32 (s, addr >> 32); tcg_out32 (s, addr); /* entry point */
   s->code_ptr += 16;          /* skip TOC and environment pointer */
+#endif
 
Quoted 6 lines

tcg/ppc64/tcg-target.c void tcg_target_qemu_prologue (TCGContext *s) · line 893

Quoted 2 lines
tcg/ppc64/tcg-target.c +0 -0
   /* Prologue */
   tcg_out32 (s, MFSPR | RT (0) | LR);

The frame format is different to that of PPC-elf64abi, shouldn't really make a difference here, then again i don't have access to PPC64 Mac OSX, so can't really verify that.

Quoted 8 lines

I checked that the linkage area is 48, too, the LR offset is 16, too. The parameter area was depicted as 64 < 128.
So I guess we're good there.

Quoted 1 line

Otherwise looks good.. Should i commit it with R13 fixed?

About the callee-save stuff I was less certain. Feel free to make modifications (e.g., moving tcg_out_call up?) or have me resubmit.

Sorry, i don't get this part, i was just thinking of removing R13 from the list. Moving tcg_out_call?

Signature · 1 line
mailto:[email protected]
#7 lore raw

PATCH v2 1/3 TCG: Mac OS X support for ppc64 target

Darwin/ppc64 does not use function descriptors, adapt prologue and tcg_out_call accordingly. GPR2 is available for general use, so let's use it.

http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/LowLevelABI/110-64-bit_PowerPC_Function_Calling_Conventions/64bitPowerPC.html

v2:
- Don't mark reserved GPR13 as callee-save.
- Move tcg_out_b up.
- Fix unused variable warning in prologue.

---
 tcg/ppc64/tcg-target.c |   55 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 41 insertions(+), 14 deletions(-)
tcg/ppc64/tcg-target.c +41 -14
index a612e10..0c11917 100644
@@ -104,6 +104,9 @@ static const int tcg_target_reg_alloc_order[] = {
     TCG_REG_R29,
     TCG_REG_R30,
     TCG_REG_R31,
+#ifdef __APPLE__
+    TCG_REG_R2,
+#endif
     TCG_REG_R3,
     TCG_REG_R4,
     TCG_REG_R5,
@@ -112,7 +115,9 @@ static const int tcg_target_reg_alloc_order[] = {
     TCG_REG_R8,
     TCG_REG_R9,
     TCG_REG_R10,
+#ifndef __APPLE__
     TCG_REG_R11,
+#endif
     TCG_REG_R12,
     TCG_REG_R24,
     TCG_REG_R25,
@@ -136,6 +141,9 @@ static const int tcg_target_call_oarg_regs[2] = {
 };
 
 static const int tcg_target_callee_save_regs[] = {
+#ifdef __APPLE__
+    TCG_REG_R11,
+#endif
     TCG_REG_R14,
     TCG_REG_R15,
     TCG_REG_R16,
@@ -477,8 +485,31 @@ static void tcg_out_movi (TCGContext *s, TCGType type,
     }
 }
 
+static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target)
+{
+    tcg_target_long disp;
+
+    disp = target - (tcg_target_long) s->code_ptr;
+    if ((disp << 38) >> 38 == disp)
+        tcg_out32 (s, B | (disp & 0x3fffffc) | mask);
+    else {
+        tcg_out_movi (s, TCG_TYPE_I64, 0, (tcg_target_long) target);
+        tcg_out32 (s, MTSPR | RS (0) | CTR);
+        tcg_out32 (s, BCCTR | BO_ALWAYS | mask);
+    }
+}
+
 static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
 {
+#ifdef __APPLE__
+    if (const_arg) {
+        tcg_out_b (s, LK, arg);
+    }
+    else {
+        tcg_out32 (s, MTSPR | RS (arg) | LR);
+        tcg_out32 (s, BCLR | BO_ALWAYS | LK);
+    }
+#else
     int reg;
 
     if (const_arg) {
@@ -492,6 +523,7 @@ static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
     tcg_out32 (s, LD | RT (11) | RA (reg) | 16);
     tcg_out32 (s, LD | RT (2) | RA (reg) | 8);
     tcg_out32 (s, BCCTR | BO_ALWAYS | LK);
+#endif
 }
 
 static void tcg_out_ldst (TCGContext *s, int ret, int addr,
@@ -516,20 +548,6 @@ static void tcg_out_ldsta (TCGContext *s, int ret, int addr,
     }
 }
 
-static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target)
-{
-    tcg_target_long disp;
-
-    disp = target - (tcg_target_long) s->code_ptr;
-    if ((disp << 38) >> 38 == disp)
-        tcg_out32 (s, B | (disp & 0x3fffffc) | mask);
-    else {
-        tcg_out_movi (s, TCG_TYPE_I64, 0, (tcg_target_long) target);
-        tcg_out32 (s, MTSPR | RS (0) | CTR);
-        tcg_out32 (s, BCCTR | BO_ALWAYS | mask);
-    }
-}
-
 #if defined (CONFIG_SOFTMMU)
 
 #include "../../softmmu_defs.h"
@@ -845,7 +863,9 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
 void tcg_target_qemu_prologue (TCGContext *s)
 {
     int i, frame_size;
+#ifndef __APPLE__
     uint64_t addr;
+#endif
 
     frame_size = 0
         + 8                     /* back chain */
@@ -859,10 +879,12 @@ void tcg_target_qemu_prologue (TCGContext *s)
         ;
     frame_size = (frame_size + 15) & ~15;
 
+#ifndef __APPLE__
     /* First emit adhoc function descriptor */
     addr = (uint64_t) s->code_ptr + 24;
     tcg_out32 (s, addr >> 32); tcg_out32 (s, addr); /* entry point */
     s->code_ptr += 16;          /* skip TOC and environment pointer */
+#endif
 
     /* Prologue */
     tcg_out32 (s, MFSPR | RT (0) | LR);
@@ -1516,6 +1538,9 @@ void tcg_target_init (TCGContext *s)
     tcg_regset_set32 (tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffffffff);
     tcg_regset_set32 (tcg_target_call_clobber_regs, 0,
                      (1 << TCG_REG_R0) |
+#ifdef __APPLE__
+                     (1 << TCG_REG_R2) |
+#endif
                      (1 << TCG_REG_R3) |
                      (1 << TCG_REG_R4) |
                      (1 << TCG_REG_R5) |
@@ -1531,7 +1556,9 @@ void tcg_target_init (TCGContext *s)
     tcg_regset_clear (s->reserved_regs);
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R0);
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R1);
+#ifndef __APPLE__
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R2);
+#endif
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R13);
 
 #ifdef CONFIG_USE_GUEST_BASE
Signature · 1 line
1.6.5.3
#8 lore raw

PATCH v2 2/3 Cocoa: ppc64 host support

Fix integer usage in the Cocoa backend: NSInteger is long on LP64.

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/doc/uid/20000014-BBCFHHCD

This makes the graphical display show up on a ppc64 host.

Cc Alexander Graf <[email protected]>
Cc Mike Kronenberg <[email protected]>
---
 cocoa.m |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
cocoa.m +1 -1
index 55ff2b4..7062571 100644
@@ -337,7 +337,7 @@ int cocoa_keycode_to_qemu(int keycode)
         } else {
             // selective drawing code (draws only dirty rectangles) (OS X >= 10.4)
             const NSRect *rectList;
-            int rectCount;
+            NSInteger rectCount;
             int i;
             CGImageRef clipImageRef;
             CGRect clipRect;
Signature · 1 line
1.6.5.3
#9 lore raw

PATCH v2 3/3 Cocoa: Silence warnings

Missing static for cocoa_keycode_to_qemu.
Missing const for character constant.

__LITTLE_ENDIAN__ is undefined on Big Endian host.

---
 cocoa.m |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
cocoa.m +3 -3
index 7062571..05f507d 100644
@@ -229,7 +229,7 @@ int keymap[] =
 */
 };
 
-int cocoa_keycode_to_qemu(int keycode)
+static int cocoa_keycode_to_qemu(int keycode)
 {
     if((sizeof(keymap)/sizeof(int)) <= keycode)
     {
@@ -315,7 +315,7 @@ int cocoa_keycode_to_qemu(int keycode)
             screen.bitsPerComponent, //bitsPerComponent
             screen.bitsPerPixel, //bitsPerPixel
             (screen.width * (screen.bitsPerComponent/2)), //bytesPerRow
-#if __LITTLE_ENDIAN__
+#ifdef __LITTLE_ENDIAN__
             CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB), //colorspace for OS X >= 10.4
             kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
 #else
@@ -783,7 +783,7 @@ int cocoa_keycode_to_qemu(int keycode)
     if(returnCode == NSCancelButton) {
         exit(0);
     } else if(returnCode == NSOKButton) {
-        char *bin = "qemu";
+        const char *bin = "qemu";
         char *img = (char*)[ [ sheet filename ] cStringUsingEncoding:NSASCIIStringEncoding];
 
         char **argv = (char**)malloc( sizeof(char*)*3 );
Signature · 1 line
1.6.5.3
#10 lore raw

[Qemu-devel] Re: [PATCH v2 2/3] Cocoa: ppc64 host support

In reply to Andreas Faerber
Quoted 5 lines · Andreas Faerber

Fix integer usage in the Cocoa backend: NSInteger is long on LP64.

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/doc/uid/20000014-BBCFHHCD

This makes the graphical display show up on a ppc64 host.

Interesting! Unfortunately I don't have a PPC64 Apple machine handy, so I can't test it.

Alex

#11 lore raw

[Qemu-devel] Re: [PATCH v2 2/3] Cocoa: ppc64 host support

Hi Alex,

Am 06.12.2009 um 14:02 schrieb Alexander Graf:

Quoted 10 lines · Andreas Faerber
Quoted 6 lines

Fix integer usage in the Cocoa backend: NSInteger is long on LP64.

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/doc/uid/20000014-BBCFHHCD

This makes the graphical display show up on a ppc64 host.

Interesting! Unfortunately I don't have a PPC64 Apple machine handy, so I can't test it.

I cc'ed you so that you could check your earlier x86_64 Mac patch series, if you care. I don't have an x86_64 Mac at hands myself.

Btw I'll be looking into bringing the Cocoa frontend on par with SDL, namely closing the app when closing the window and not creating the window in -nographic mode. That's awful when debugging!

Andreas

#12 lore raw

[Qemu-devel] Re: [PATCH v2 2/3] Cocoa: ppc64 host support

Quoted 9 lines · Andreas Färber

Hi Alex,

Am 06.12.2009 um 14:02 schrieb Alexander Graf:

Quoted 5 lines · Andreas Faerber
Quoted 3 lines

Fix integer usage in the Cocoa backend: NSInteger is long on LP64.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/doc/uid/20000014-BBCFHHCD

This makes the graphical display show up on a ppc64 host.

Interesting! Unfortunately I don't have a PPC64 Apple machine handy, so I can't test it.

I cc'ed you so that you could check your earlier x86_64 Mac patch series, if you care. I don't have an x86_64 Mac at hands myself.

Oh I see, I'll test it later today or tomorrow.

Quoted 1 line

Btw I'll be looking into bringing the Cocoa frontend on par with SDL, namely closing the app when closing the window and not creating the window in -nographic mode. That's awful when debugging!

I agree. I did a patch for that once - might be worth searching the ML for that. Basically it searched the args for a "-nographic" parameter. Pretty hacky, but at least it worked.

Alex

#13 lore raw

[Qemu-devel] Re: [PATCH v2 2/3] Cocoa: ppc64 host support

In reply to Andreas Faerber

cocoa.m int cocoa_keycode_to_qemu(int keycode) · line 340

Quoted 2 lines · Andreas Faerber
cocoa.m +1 -1
-            int rectCount;
+            NSInteger rectCount;

I know that this is endorsed by apple since 10.5 but NSInteger will break compiling on Tiger and older. Int on the other hand is only throwing a warning on Leopard if I'm not mistaken.

Especially with qemu, one has to have an eye on the type... NSInteger can be an int or a long, depending on the host...

#if __LP64__ || NS_BUILD_32_LIKE_64
	typedef long NSInteger;
	typedef unsigned long NSUInteger;
#else
	typedef int NSInteger;
	typedef unsigned int NSUInteger;

#endif

I have no G5 at hand to test either.

Mike

#14 lore raw

[Qemu-devel] Re: [PATCH v2 2/3] Cocoa: ppc64 host support

Am 06.12.2009 um 14:41 schrieb Mike Kronenberg:

Quoted 6 lines · Andreas Faerber

cocoa.m int cocoa_keycode_to_qemu(int keycode) · line 340

Quoted 3 lines
cocoa.m +1 -1
-            int rectCount;
+            NSInteger rectCount;

I know that this is endorsed by apple since 10.5 but NSInteger will break compiling on Tiger and older.

You appear to be right there... no trace of it in 10.4u SDK.

Quoted 1 line

Int on the other hand is only throwing a warning on Leopard if I'm not mistaken.

On Leopard ppc it just warns and works because NSInteger == int. On Leopard ppc64 it warns and fails at runtime because NSInteger != int.

Quoted 9 lines

Especially with qemu, one has to have an eye on the type... NSInteger can be an int or a long, depending on the host...

#if __LP64__ || NS_BUILD_32_LIKE_64
	typedef long NSInteger;
	typedef unsigned long NSUInteger;
#else
	typedef int NSInteger;
	typedef unsigned int NSUInteger;

#endif

Right, so we do need NSInteger - I'll add a version check. Thanks for the feedback!

Andreas

#15 lore raw

PATCH v3 1/3 TCG: Mac OS X support for ppc64 target

Darwin/ppc64 does not use function descriptors, adapt prologue and tcg_out_call accordingly. GPR2 is available for general use, so let's use it.

http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/LowLevelABI/110-64-bit_PowerPC_Function_Calling_Conventions/64bitPowerPC.html

v2:
- Don't mark reserved GPR13 as callee-save.
- Move tcg_out_b up.
- Fix unused variable warning in prologue.

---
 tcg/ppc64/tcg-target.c |   55 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 41 insertions(+), 14 deletions(-)
tcg/ppc64/tcg-target.c +41 -14
index a612e10..0c11917 100644
@@ -104,6 +104,9 @@ static const int tcg_target_reg_alloc_order[] = {
     TCG_REG_R29,
     TCG_REG_R30,
     TCG_REG_R31,
+#ifdef __APPLE__
+    TCG_REG_R2,
+#endif
     TCG_REG_R3,
     TCG_REG_R4,
     TCG_REG_R5,
@@ -112,7 +115,9 @@ static const int tcg_target_reg_alloc_order[] = {
     TCG_REG_R8,
     TCG_REG_R9,
     TCG_REG_R10,
+#ifndef __APPLE__
     TCG_REG_R11,
+#endif
     TCG_REG_R12,
     TCG_REG_R24,
     TCG_REG_R25,
@@ -136,6 +141,9 @@ static const int tcg_target_call_oarg_regs[2] = {
 };
 
 static const int tcg_target_callee_save_regs[] = {
+#ifdef __APPLE__
+    TCG_REG_R11,
+#endif
     TCG_REG_R14,
     TCG_REG_R15,
     TCG_REG_R16,
@@ -477,8 +485,31 @@ static void tcg_out_movi (TCGContext *s, TCGType type,
     }
 }
 
+static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target)
+{
+    tcg_target_long disp;
+
+    disp = target - (tcg_target_long) s->code_ptr;
+    if ((disp << 38) >> 38 == disp)
+        tcg_out32 (s, B | (disp & 0x3fffffc) | mask);
+    else {
+        tcg_out_movi (s, TCG_TYPE_I64, 0, (tcg_target_long) target);
+        tcg_out32 (s, MTSPR | RS (0) | CTR);
+        tcg_out32 (s, BCCTR | BO_ALWAYS | mask);
+    }
+}
+
 static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
 {
+#ifdef __APPLE__
+    if (const_arg) {
+        tcg_out_b (s, LK, arg);
+    }
+    else {
+        tcg_out32 (s, MTSPR | RS (arg) | LR);
+        tcg_out32 (s, BCLR | BO_ALWAYS | LK);
+    }
+#else
     int reg;
 
     if (const_arg) {
@@ -492,6 +523,7 @@ static void tcg_out_call (TCGContext *s, tcg_target_long arg, int const_arg)
     tcg_out32 (s, LD | RT (11) | RA (reg) | 16);
     tcg_out32 (s, LD | RT (2) | RA (reg) | 8);
     tcg_out32 (s, BCCTR | BO_ALWAYS | LK);
+#endif
 }
 
 static void tcg_out_ldst (TCGContext *s, int ret, int addr,
@@ -516,20 +548,6 @@ static void tcg_out_ldsta (TCGContext *s, int ret, int addr,
     }
 }
 
-static void tcg_out_b (TCGContext *s, int mask, tcg_target_long target)
-{
-    tcg_target_long disp;
-
-    disp = target - (tcg_target_long) s->code_ptr;
-    if ((disp << 38) >> 38 == disp)
-        tcg_out32 (s, B | (disp & 0x3fffffc) | mask);
-    else {
-        tcg_out_movi (s, TCG_TYPE_I64, 0, (tcg_target_long) target);
-        tcg_out32 (s, MTSPR | RS (0) | CTR);
-        tcg_out32 (s, BCCTR | BO_ALWAYS | mask);
-    }
-}
-
 #if defined (CONFIG_SOFTMMU)
 
 #include "../../softmmu_defs.h"
@@ -845,7 +863,9 @@ static void tcg_out_qemu_st (TCGContext *s, const TCGArg *args, int opc)
 void tcg_target_qemu_prologue (TCGContext *s)
 {
     int i, frame_size;
+#ifndef __APPLE__
     uint64_t addr;
+#endif
 
     frame_size = 0
         + 8                     /* back chain */
@@ -859,10 +879,12 @@ void tcg_target_qemu_prologue (TCGContext *s)
         ;
     frame_size = (frame_size + 15) & ~15;
 
+#ifndef __APPLE__
     /* First emit adhoc function descriptor */
     addr = (uint64_t) s->code_ptr + 24;
     tcg_out32 (s, addr >> 32); tcg_out32 (s, addr); /* entry point */
     s->code_ptr += 16;          /* skip TOC and environment pointer */
+#endif
 
     /* Prologue */
     tcg_out32 (s, MFSPR | RT (0) | LR);
@@ -1516,6 +1538,9 @@ void tcg_target_init (TCGContext *s)
     tcg_regset_set32 (tcg_target_available_regs[TCG_TYPE_I64], 0, 0xffffffff);
     tcg_regset_set32 (tcg_target_call_clobber_regs, 0,
                      (1 << TCG_REG_R0) |
+#ifdef __APPLE__
+                     (1 << TCG_REG_R2) |
+#endif
                      (1 << TCG_REG_R3) |
                      (1 << TCG_REG_R4) |
                      (1 << TCG_REG_R5) |
@@ -1531,7 +1556,9 @@ void tcg_target_init (TCGContext *s)
     tcg_regset_clear (s->reserved_regs);
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R0);
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R1);
+#ifndef __APPLE__
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R2);
+#endif
     tcg_regset_set_reg (s->reserved_regs, TCG_REG_R13);
 
 #ifdef CONFIG_USE_GUEST_BASE
Signature · 1 line
1.6.5.3
#16 lore raw

PATCH v3 2/3 Cocoa: ppc64 host support

Fix integer usage in the Cocoa backend: NSInteger is long on LP64.

http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html#//apple_ref/doc/uid/20000014-BBCFHHCD

This makes the graphical display show up on a ppc64 host.

v3:
- Confine NSInteger to Mac OS X v10.5 and later

Cc Alexander Graf <[email protected]>
Cc Mike Kronenberg <[email protected]>
Cc John Arbuckle <[email protected]>
---
 cocoa.m |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
cocoa.m +8 -0
index 55ff2b4..989efd5 100644
@@ -28,6 +28,10 @@
 #include "console.h"
 #include "sysemu.h"
 
+#ifndef MAC_OS_X_VERSION_10_5
+#define MAC_OS_X_VERSION_10_5 1050
+#endif
+
 
 //#define DEBUG
 
@@ -337,7 +341,11 @@ int cocoa_keycode_to_qemu(int keycode)
         } else {
             // selective drawing code (draws only dirty rectangles) (OS X >= 10.4)
             const NSRect *rectList;
+#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
+            NSInteger rectCount;
+#else
             int rectCount;
+#endif
             int i;
             CGImageRef clipImageRef;
             CGRect clipRect;
Signature · 1 line
1.6.5.3
#17 lore raw

PATCH v3 3/3 Cocoa: Silence warnings

Missing static for cocoa_keycode_to_qemu.
Missing const for character constant.

__LITTLE_ENDIAN__ is undefined on Big Endian host. MAC_OS_X_VERSION_10_4 is undefined on v10.3 and earlier.

v3:
- Silence warnings reported from Mac OS X v10.3.9

Cc John Arbuckle <[email protected]>
Cc Mike Kronenberg <[email protected]>
---
 cocoa.m |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
cocoa.m +6 -3
index 989efd5..ae2fd86 100644
@@ -28,6 +28,9 @@
 #include "console.h"
 #include "sysemu.h"
 
+#ifndef MAC_OS_X_VERSION_10_4
+#define MAC_OS_X_VERSION_10_4 1040
+#endif
 #ifndef MAC_OS_X_VERSION_10_5
 #define MAC_OS_X_VERSION_10_5 1050
 #endif
@@ -233,7 +236,7 @@ int keymap[] =
 */
 };
 
-int cocoa_keycode_to_qemu(int keycode)
+static int cocoa_keycode_to_qemu(int keycode)
 {
     if((sizeof(keymap)/sizeof(int)) <= keycode)
     {
@@ -319,7 +322,7 @@ int cocoa_keycode_to_qemu(int keycode)
             screen.bitsPerComponent, //bitsPerComponent
             screen.bitsPerPixel, //bitsPerPixel
             (screen.width * (screen.bitsPerComponent/2)), //bytesPerRow
-#if __LITTLE_ENDIAN__
+#ifdef __LITTLE_ENDIAN__
             CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB), //colorspace for OS X >= 10.4
             kCGBitmapByteOrder32Little | kCGImageAlphaNoneSkipFirst,
 #else
@@ -791,7 +794,7 @@ int cocoa_keycode_to_qemu(int keycode)
     if(returnCode == NSCancelButton) {
         exit(0);
     } else if(returnCode == NSOKButton) {
-        char *bin = "qemu";
+        const char *bin = "qemu";
         char *img = (char*)[ [ sheet filename ] cStringUsingEncoding:NSASCIIStringEncoding];
 
         char **argv = (char**)malloc( sizeof(char*)*3 );
Signature · 1 line
1.6.5.3
#18 lore raw

[Qemu-devel] Re: [PATCH 1/3] TCG: Mac OS X support for ppc64 target

In reply to malc

Am 06.12.2009 um 07:28 schrieb malc:

Quoted 26 lines · Andreas F?rber
Quoted 25 lines

Am 06.12.2009 um 06:13 schrieb malc:

Quoted 20 lines · Andreas Faerber

tcg/ppc64/tcg-target.c

Quoted 17 lines

Darwin/ppc64 does not use function descriptors, adapt prologue and tcg_out_call accordingly. GPR2 is available for general use, so let's use it.

http://developer.apple.com/mac/library/documentation/DeveloperTools/Conceptual/LowLevelABI/110-64-bit_PowerPC_Function_Calling_Conventions/64bitPowerPC.html

---
tcg/ppc64/tcg-target.c | 30 ++++++++++++++++++++++++++++++

1 files changed, 30 insertions(+), 0 deletions(-)
tcg/ppc64/tcg-target.c +0 -0
index a612e10..bf9b7d9 100644

Otherwise looks good.. Should i commit it with R13 fixed?

Quoted 5 lines
Quoted 2 lines

About the callee-save stuff I was less certain. Feel free to make modifications (e.g., moving tcg_out_call up?) or have me resubmit.

Sorry, i don't get this part, i was just thinking of removing R13 from the list. Moving tcg_out_call?

Sorry, I meant tcg_out_b. Just declaring it was the least intrusive patch.

I've sent a v2 series, doing the above plus silencing a warning.
They are also available for pulling from git://repo.or.cz/qemu/afaerber.git, branch tcg-osx-ppc64.

Andreas

#19 lore raw
In reply to Andreas Faerber
Quoted 5 lines · Andreas Faerber

Hello,

This mini series adds TCG target support for OSX/ppc64 and fixes the Cocoa frontend for ppc64.

Quoted 7 lines

With these patches applied, qemu and qemu-system-x86_64 are usable. Tested on Mac OS X v10.5 with a Haiku disk image and a Fedora 12 installation disk.

qemu-system-sparc works fine, too.

qemu-system-sparc64 works on ppc64 while it didn't on ppc!

Does it work on linux ppc64? If so how exactly did you test that (so that i can try to debug it here)

Quoted 1 line

qemu-system-ppc appears to hang on ppc64 but doesn't on ppc.

Ditto.

Quoted 9 lines

I suggest we start applying these patches and try to fix these weird issues afterwards.

Regards,

Andreas

Signature · 1 line
mailto:[email protected]
#20 lore raw

Am 06.12.2009 um 06:14 schrieb malc:

Quoted 5 lines · Andreas Faerber
Quoted 2 lines

qemu-system-sparc64 works on ppc64 while it didn't on ppc!

Does it work on linux ppc64? If so

Haven't had a chance to test on other ppc[64] platforms yet.

Quoted 2 lines

how exactly did you test that
(so that i can try to debug it here)

$ /Users/andreas/QEMU/latest64/bin/qemu-system-sparc64 -boot d -cdrom /Users/andreas/QEMU/sol-10-u3-ga-sparc-dvd.iso
$ /Users/andreas/QEMU/latest64/bin/qemu-system-sparc64 -boot d -cdrom /Users/andreas/QEMU/debian-40r3-sparc-CD-1.iso

All these (also MilaX, in case you don't have Solaris 10 around) are expected to enter OpenBIOS and result in OpenBIOS errors but not in QEMU crashes or hangs. On Linux add -nographic.

Quoted 3 lines
Quoted 1 line

qemu-system-ppc appears to hang on ppc64 but doesn't on ppc.

Ditto.

$ /Users/andreas/QEMU/latest64/bin/qemu-system-ppc -boot d -cdrom /Users/andreas/QEMU/debian-40r4a-powerpc-netinst.iso

On OSX/ppc64 this never got past the OpenBIOS banner and eventually crashed:

Starting program: /Users/andreas/QEMU/latest64/bin/qemu-system-ppc -boot d -cdrom /Users/andreas/QEMU/debian-40r4a-powerpc-netinst.iso -nographic Reading symbols for shared libraries ++++++++++++++++............................................................. done Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries . done
Reading symbols for shared libraries .. done

Quoted 7 lines
Quoted 7 lines

=============================================================
OpenBIOS 1.0 [Sep 11 2009 06:53] Configuration device id QEMU version 1 machine id 2
CPUs: 1
Memory: 128M
UUID: 00000000-0000-0000-0000-000000000000 CPU type PowerPC,750

Welcome to OpenBIOS v1.0 built on Sep 11 2009 06:53

Program received signal EXC_BAD_ACCESS, Could not access memory.

Reason: KERN_PROTECTION_FAILURE at address: 0x0000000012c3cab0

                                              0x0000000000157db4 in  
ldl_be_p [inlined] () at cpu-all.h:544
                          544	    return *(uint32_t *)ptr;

The upper bt showed something like helper_lsw only, iirc.

This is at QEMU 749717a0ea2f60d33d01c1e37fa24dfa7250dfc0, using the binary blobs on OSX/ppc64 and with or without latest OpenBIOS versions on OSX/ppc.

Andreas

#21 lore raw
Quoted 19 lines · Andreas F?rber

Am 06.12.2009 um 06:14 schrieb malc:

Quoted 5 lines · Andreas Faerber
Quoted 2 lines

qemu-system-sparc64 works on ppc64 while it didn't on ppc!

Does it work on linux ppc64? If so

Haven't had a chance to test on other ppc[64] platforms yet.

Quoted 2 lines

how exactly did you test that
(so that i can try to debug it here)

$ /Users/andreas/QEMU/latest64/bin/qemu-system-sparc64 -boot d -cdrom
/Users/andreas/QEMU/sol-10-u3-ga-sparc-dvd.iso
$ /Users/andreas/QEMU/latest64/bin/qemu-system-sparc64 -boot d -cdrom
/Users/andreas/QEMU/debian-40r3-sparc-CD-1.iso
Quoted 5 lines

All these (also MilaX, in case you don't have Solaris 10 around) are expected to enter OpenBIOS and result in OpenBIOS errors but not in QEMU crashes or hangs.
On Linux add -nographic.

I was only able to find debian-40r3-sparc-netinst.iso here on ppc/linux it boots (i think):

<snip snip>
boot: expert
Allocated 8 Megs of memory at 0x40000000 for kernel
Loaded kernel version 2.6.18
Loading initial ramdisk (3882238 bytes at 0xC00000 phys, 0x40C00000 virt)... -
Remapping the kernel... done.
Booting Linux...

And it sits there while i'm losing patience..

Can you retry with netinst, if it behaves like CD-1 in your case the problem is most likely confined to OSX, otherwise i would have to search for CD-1 better.

Quoted 12 lines
Quoted 3 lines
Quoted 1 line

qemu-system-ppc appears to hang on ppc64 but doesn't on ppc.

Ditto.

$ /Users/andreas/QEMU/latest64/bin/qemu-system-ppc -boot d -cdrom
/Users/andreas/QEMU/debian-40r4a-powerpc-netinst.iso

On OSX/ppc64 this never got past the OpenBIOS banner and eventually crashed:

Starting program: /Users/andreas/QEMU/latest64/bin/qemu-system-ppc -boot d -cdrom /Users/andreas/QEMU/debian-40r4a-powerpc-netinst.iso -nographic Reading symbols for shared libraries

[..snip..]

Quoted 5 lines

The upper bt showed something like helper_lsw only, iirc.

This is at QEMU 749717a0ea2f60d33d01c1e37fa24dfa7250dfc0, using the binary blobs on OSX/ppc64 and with or without latest OpenBIOS versions on OSX/ppc.

Thanks will try system-ppc later..

Signature · 1 line
mailto:[email protected]
#22 lore raw

Am 06.12.2009 um 07:37 schrieb malc:

Quoted 1 line

will try system-ppc later..

I've tried Debian 4.0r4a ppc netinst CD on Linux/ppc64 and spotted different but similar deviations:

ppc64 qemu-system-ppc segfaults after "returning from prom_init". ppc64 qemu-system-ppc64 boots the default "install" option fine.

amd64 qemu-system-ppc does not exhibit this crash. amd64 qemu-system-ppc64 boots okay, too.

Andreas

#23 lore raw
Quoted 9 lines · Andreas F?rber

Am 06.12.2009 um 07:37 schrieb malc:

Quoted 1 line

will try system-ppc later..

I've tried Debian 4.0r4a ppc netinst CD on Linux/ppc64 and spotted different but similar deviations:

ppc64 qemu-system-ppc segfaults after "returning from prom_init".

Weird things going on there, it fails (but only semi-reliably!) inside helper_lsw it appears that while argument passed to it is correct the memory reference (inside ldl) uses sign extended version of the address.

I'm a bit stumped...

Quoted 6 lines

ppc64 qemu-system-ppc64 boots the default "install" option fine.

amd64 qemu-system-ppc does not exhibit this crash. amd64 qemu-system-ppc64 boots okay, too.

Andreas

Signature · 1 line
mailto:[email protected]
#24 lore raw
In reply to Andreas Färber
Quoted 9 lines · Andreas F?rber

Am 06.12.2009 um 07:37 schrieb malc:

Quoted 1 line

will try system-ppc later..

I've tried Debian 4.0r4a ppc netinst CD on Linux/ppc64 and spotted different but similar deviations:

ppc64 qemu-system-ppc segfaults after "returning from prom_init".

Should be fixed by 591d6f1dfdb60ab0a4cc487cd5781fa799dcac4b, can you verify?

Quoted 6 lines

ppc64 qemu-system-ppc64 boots the default "install" option fine.

amd64 qemu-system-ppc does not exhibit this crash. amd64 qemu-system-ppc64 boots okay, too.

Andreas

Signature · 1 line
mailto:[email protected]
#25 lore raw

Am 15.12.2009 um 18:00 schrieb malc:

Quoted 9 lines · Andreas F?rber
Quoted 5 lines

I've tried Debian 4.0r4a ppc netinst CD on Linux/ppc64 and spotted [...] deviations:

ppc64 qemu-system-ppc segfaults after "returning from prom_init".

Should be fixed by 591d6f1dfdb60ab0a4cc487cd5781fa799dcac4b, can you verify?

ppc-softmmu no longer crashes on Linux/ppc64. Didn't notice any regression or improvement on OSX/ppc64 - no influence on x86/x64 Haiku or sparc64 Debian on Linux/ppc64.

Good catch, thanks!

Andreas

#26 lore raw
In reply to malc

Am 06.12.2009 um 07:37 schrieb malc:

Quoted 39 lines · Andreas F?rber
Quoted 20 lines

Am 06.12.2009 um 06:14 schrieb malc:

Quoted 5 lines · Andreas Faerber
Quoted 2 lines

qemu-system-sparc64 works on ppc64 while it didn't on ppc!

Does it work on linux ppc64? If so

Haven't had a chance to test on other ppc[64] platforms yet.

Quoted 2 lines

how exactly did you test that
(so that i can try to debug it here)

$ /Users/andreas/QEMU/latest64/bin/qemu-system-sparc64 -boot d -cdrom
/Users/andreas/QEMU/sol-10-u3-ga-sparc-dvd.iso
$ /Users/andreas/QEMU/latest64/bin/qemu-system-sparc64 -boot d -cdrom
/Users/andreas/QEMU/debian-40r3-sparc-CD-1.iso
Quoted 5 lines

All these (also MilaX, in case you don't have Solaris 10 around) are expected to enter OpenBIOS and result in OpenBIOS errors but not in QEMU crashes or hangs.
On Linux add -nographic.

I was only able to find debian-40r3-sparc-netinst.iso here on ppc/linux it boots (i think):

<snip snip>
boot: expert
Allocated 8 Megs of memory at 0x40000000 for kernel
Loaded kernel version 2.6.18
Loading initial ramdisk (3882238 bytes at 0xC00000 phys, 0x40C00000 virt)... -
Remapping the kernel... done.
Booting Linux...

Quoted 5 lines

And it sits there while i'm losing patience..

Can you retry with netinst, if it behaves like CD-1 in your case the problem is most likely confined to OSX, otherwise i would have to search for CD-1 better.

I tried with 4.0r8 businesscard: Such a hang I could reproduce on Linux/ppc and Linux/ppc64 and OSX/ppc64 and Linux/amd64 only when running with qemu-system-sparc64, but not with qemu-system-sparc.

Also, on Linux/ppc64, qemu and qemu-system-x86_64 render Haiku nightly image r34558 x86gcc2 unusable (desktop garbled, no cursor), while on Linux/ppc and OSX/ppc64 (r34514) and Linux/amd64 it works okay.

Andreas

#27 lore raw
Quoted 45 lines · Andreas F?rber

Am 06.12.2009 um 07:37 schrieb malc:

Quoted 42 lines · Andreas F?rber
Quoted 20 lines

Am 06.12.2009 um 06:14 schrieb malc:

Quoted 5 lines · Andreas Faerber
Quoted 2 lines

qemu-system-sparc64 works on ppc64 while it didn't on ppc!

Does it work on linux ppc64? If so

Haven't had a chance to test on other ppc[64] platforms yet.

Quoted 2 lines

how exactly did you test that
(so that i can try to debug it here)

$ /Users/andreas/QEMU/latest64/bin/qemu-system-sparc64 -boot d -cdrom
/Users/andreas/QEMU/sol-10-u3-ga-sparc-dvd.iso
$ /Users/andreas/QEMU/latest64/bin/qemu-system-sparc64 -boot d -cdrom
/Users/andreas/QEMU/debian-40r3-sparc-CD-1.iso
Quoted 6 lines

All these (also MilaX, in case you don't have Solaris 10 around) are expected
to enter OpenBIOS and result in OpenBIOS errors but not in QEMU crashes or hangs.
On Linux add -nographic.

I was only able to find debian-40r3-sparc-netinst.iso here on ppc/linux it boots (i think):

<snip snip>
boot: expert
Allocated 8 Megs of memory at 0x40000000 for kernel
Loaded kernel version 2.6.18
Loading initial ramdisk (3882238 bytes at 0xC00000 phys, 0x40C00000 virt)... -
Remapping the kernel... done.
Booting Linux...

And it sits there while i'm losing patience..

Quoted 7 lines
Quoted 3 lines

Can you retry with netinst, if it behaves like CD-1 in your case the problem is most likely confined to OSX, otherwise i would have to search for CD-1 better.

I tried with 4.0r8 businesscard: Such a hang I could reproduce on Linux/ppc and Linux/ppc64 and OSX/ppc64 and Linux/amd64 only when running with qemu-system-sparc64, but not with qemu-system-sparc.

So the problem is in no way limited to ppc, good to know.

Quoted 3 lines

Also, on Linux/ppc64, qemu and qemu-system-x86_64 render Haiku nightly image r34558 x86gcc2 unusable (desktop garbled, no cursor), while on Linux/ppc and OSX/ppc64 (r34514) and Linux/amd64 it works okay.

That's vga/display issue (have you tried -vga std ?, FranГois REVOL mentioned that it works with one of those and doesn't work with others)

Signature · 1 line
mailto:[email protected]