Author: nwhitehorn
Date: Sat Oct 31 20:59:13 2009
New Revision: 198731
URL: http://svn.freebsd.org/changeset/base/198731

Log:
  Unbreak cpu_switch(). The register allocator in my brain is clearly
  broken. Also, Altivec context switching worked before only by accident,
  but should work now by design.

Modified:
  head/sys/powerpc/aim/swtch.S

Modified: head/sys/powerpc/aim/swtch.S
==============================================================================
--- head/sys/powerpc/aim/swtch.S        Sat Oct 31 19:22:12 2009        
(r198730)
+++ head/sys/powerpc/aim/swtch.S        Sat Oct 31 20:59:13 2009        
(r198731)
@@ -99,17 +99,19 @@ ENTRY(cpu_switch)
        mr      %r14,%r3                /* Copy the old thread ptr... */
        mr      %r15,%r4                /* and the new thread ptr in scratch */
        mr      %r16,%r5                /* and the new lock */
+       mr      %r17,%r6                /* and the PCB */
        
-       lwz     %r6,PCB_FLAGS(%r5)
+       lwz     %r7,PCB_FLAGS(%r17)
        /* Save FPU context if needed */
-       andi.   %r6, %r6, PCB_FPU
+       andi.   %r7, %r7, PCB_FPU
        beq     .L1
        bl      save_fpu
 
 .L1:
-       lwz     %r6,PCB_FLAGS(%r5)
+       mr      %r3,%r14                /* restore old thread ptr */
+       lwz     %r7,PCB_FLAGS(%r17)
        /* Save Altivec context if needed */
-       andi.   %r6, %r6, PCB_VEC
+       andi.   %r7, %r7, PCB_VEC
        beq     .L2
        bl      save_vec
        
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to