<html>
  <head>

  </head>
  <body style="line-height: normal; margin-right: 4px; font-variant: normal; margin-left: 4px; margin-bottom: 1px; margin-top: 4px">
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">The gcc 4.5 compiler is optimizing out some code used to bring up auxillary processors. Adding volatile to the auxillary processor jump trampoline memory references gets the bios able to boot with -smp >1 again.</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">Signed-off-by: Bruce Rogers <brogers@novell.com></font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">smp.c |    6 +++---</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">1 file changed, 3 insertions(+), 3 deletions(-)</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">diff --git a/src/smp.c b/src/smp.c</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">index dac95bf..ce7c81c 100644</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">--- a/src/smp.c</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">+++ b/src/smp.c</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">@@ -84,11 +84,11 @@ smp_probe(void)</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">     writel(&CountCPUs, 1);</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">     // Setup jump trampoline to counter code.</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">-    u64 old = *(u64*)BUILD_AP_BOOT_ADDR;</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">+    u64 old = *(volatile u64*)BUILD_AP_BOOT_ADDR;</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">     // ljmpw $SEG_BIOS, $(smp_ap_boot_code - BUILD_BIOS_ADDR)</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">     u64 new = (0xea | ((u64)SEG_BIOS<<24)</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">                | (((u32)smp_ap_boot_code - BUILD_BIOS_ADDR) << 8));</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">-    *(u64*)BUILD_AP_BOOT_ADDR = new;</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">+    *(volatile u64*)BUILD_AP_BOOT_ADDR = new;</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">     // enable local APIC</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">     u32 val = readl(APIC_SVR);</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">@@ -117,7 +117,7 @@ smp_probe(void)</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">     }</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">     // Restore memory.</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">-    *(u64*)BUILD_AP_BOOT_ADDR = old;</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">+    *(volatile u64*)BUILD_AP_BOOT_ADDR = old;</font>    </p>
<br>      
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">     MaxCountCPUs = qemu_cfg_get_max_cpus();</font>    </p>
    <p style="margin-bottom: 0; margin-top: 0">
      <font face="Dialog" size="2">     if (!MaxCountCPUs || MaxCountCPUs < CountCPUs)</font>    </p>
  </body>
</html>