Skip to contentSkip to conversation

4xx wrtee instructions

Qemu-devel Applied Andrew May 3 participants 3 messages Jan 14, 2009 – Jan 16, 2009

lore
Share & tools
lore

Andrew May

author
#0 lore raw

When I try to boot a PPC 4xx linux kernel it fails somewhere after expanding the ramdisk with:
"qemu: fatal: Trying to execute code outside RAM or ROM at 0xc007c70c"

It seems that the "wrteei" instruction is unsetting the address translate bits in the MSR. This patch seems to fix it, and I think it is correct, to and with the "not" of the bit instead of the bit itself to disable interrupts.

The qemu log file doesn't display the correct instructions, but that doesn't seem to be a problem.
====================
IN:

0xc000d0cc:  mfmsr      r5
0xc000d0d0:  mfspr      r6,945
0xc000d0d4:  .long 0x7c000146
0xc000d0d8:  mtspr      945,r4
0xc000d0dc:  .long 0x7c601f25
0xc000d0e0:  mtspr      945,r6
0xc000d0e4:  .long 0x7ca00106

=======================

Please CC me since I am not on the list.

Here is the patch.
==========

trunk/target-ppc/translate.c +1 -1
@@ -6050,7 +6050,7 @@ GEN_HANDLER(wrteei, 0x1F, 0x03, 0x05, 0x000EFC01, PPC_WRTEE)
         /* Stop translation to have a chance to raise an exception */
         gen_stop_exception(ctx);
     } else {
-        tcg_gen_andi_tl(cpu_msr, cpu_msr, (1 << MSR_EE));
+        tcg_gen_andi_tl(cpu_msr, cpu_msr, ~(1 << MSR_EE));
     }
 #endif
 }
#1 lore raw
Quoted 31 lines · Andrew May

When I try to boot a PPC 4xx linux kernel it fails somewhere after expanding the ramdisk with:
"qemu: fatal: Trying to execute code outside RAM or ROM at 0xc007c70c"

It seems that the "wrteei" instruction is unsetting the address translate bits in the MSR. This patch seems to fix it, and I think it is correct, to and with the "not" of the bit instead of the bit itself to disable interrupts.

The qemu log file doesn't display the correct instructions, but that doesn't seem to be a problem.
====================
IN:

0xc000d0cc:  mfmsr      r5
0xc000d0d0:  mfspr      r6,945
0xc000d0d4:  .long 0x7c000146
0xc000d0d8:  mtspr      945,r4
0xc000d0dc:  .long 0x7c601f25
0xc000d0e0:  mtspr      945,r6
0xc000d0e4:  .long 0x7ca00106

=======================

Please CC me since I am not on the list.

Here is the patch.
==========

trunk/target-ppc/translate.c GEN_HANDLER(wrteei, 0x1F, 0x03, 0x05, 0x000EFC01, PPC_WRTEE) · line 6056

Quoted 8 lines
trunk/target-ppc/translate.c +1 -1
@@ -6050,7 +6050,7 @@ GEN_HANDLER(wrteei, 0x1F, 0x03, 0x05, 0x000EFC01, PPC_WRTEE)
         /* Stop translation to have a chance to raise an exception */
         gen_stop_exception(ctx);
     } else {
-        tcg_gen_andi_tl(cpu_msr, cpu_msr, (1 << MSR_EE));
+        tcg_gen_andi_tl(cpu_msr, cpu_msr, ~(1 << MSR_EE));
     }
 #endif
 }

Thanks, applied.

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#2 lore raw
In reply to Andrew May
Quoted 3 lines · Andrew May

When I try to boot a PPC 4xx linux kernel it fails somewhere after expanding the ramdisk with:
"qemu: fatal: Trying to execute code outside RAM or ROM at 0xc007c70c"

By the way, how did you load the kernel? The last time I tried to use the 405 emulation, I was told I needed a u-boot binary as the ROM, but couldn't find any that worked.

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center