Skip to contentSkip to conversation

SPARC patch for OS X (big endian machines)

Qemu-devel Jose Renau 3 participants 4 messages Sep 28, 2005 – Nov 2, 2005

lore
Share & tools
lore

Jose Renau

author
#0 lore raw

Without the following patch, I was unable to "start" the Linux boot
process
on OS X (powerPC bigendian). I tried on ia64 (Linux) and works fine too.

op_helper.c 27 Sep 2005 23:54:52 -0000 renamed from op_helper.c 23 Jul 2005 14:27:54 -0000 1.15 +9 -4
@@ -225,4 +225,5 @@
 void helper_ld_asi(int asi, int size, int sign)
 {
+
     uint32_t ret = 0;
 
@@ -258,8 +259,12 @@
     case 0x20 ... 0x2f: /* MMU passthrough */
        cpu_physical_memory_read(T0, (void *) &ret, size);
-       if (size == 4)
-           tswap32s(&ret);
-        else if (size == 2)
-           tswap16s((uint16_t *)&ret);
+
+       tswap32s(&ret);
+       if (size == 2) {
+           ret = ret >> 16;
+       }else if (size == 1) {
+           ret = ret >> 24;
+       }
+
        break;
     default:
#1 lore raw
Quoted 3 lines · Jose Renau

Without the following patch, I was unable to "start" the Linux boot process on OS X (powerPC bigendian). I tried on ia64 (Linux) and works fine too.

Pretty cool.
I can confirm this for SPARC hosts , too (also MSB).

Hey, be aware that the SPARConSPARC case finally works with your patch :) Even in SDL/gui mode, not just with "-nographic".

Thank you!

Quoted 26 lines
op_helper.c 27 Sep 2005 23:54:52 -0000 renamed from op_helper.c 23 Jul 2005 14:27:54 -0000 1.15 +1 -0
@@ -225,4 +225,5 @@
 void helper_ld_asi(int asi, int size, int sign)
 {
+
 uint32_t ret = 0;
 
@@ -258,8 +259,12 @@

case 0x20 ... 0x2f: /* MMU passthrough */ cpu_physical_memory_read(T0, (void *) &ret, size);
- if (size == 4)
- tswap32s(&ret);
- else if (size == 2)
- tswap16s((uint16_t *)&ret);

op_helper.c 27 Sep 2005 23:54:52 -0000 renamed from op_helper.c 23 Jul 2005 14:27:54 -0000 1.15 +8 -0
+
+ tswap32s(&ret);
+ if (size == 2) {
+ ret = ret >> 16;
+ }else if (size == 1) {
+ ret = ret >> 24;
+ }
+

break;
default:

#2 lore raw
In reply to Jose Renau
Quoted 4 lines · Jose Renau

Without the following patch, I was unable to "start" the Linux boot
process
on OS X (powerPC bigendian). I tried on ia64 (Linux) and works fine too.

I made a more generic patch. Tell me if it still works...

Fabrice.

author
#3 lore raw

The new patch is clearly nicer (I did not know the interface), it
solved
the bug that I reported, but It still crashes booting Linux.

Hopefully one of my students will take a look.

Quoted 9 lines · Fabrice Bellard
Quoted 3 lines · Jose Renau

Without the following patch, I was unable to "start" the Linux boot
process
on OS X (powerPC bigendian). I tried on ia64 (Linux) and works fine too.

I made a more generic patch. Tell me if it still works...

Fabrice.

--
Excellence is not a skill. It is an attitude. - Ralph Marston