Index: arch/ia64/src/ivt.S
===================================================================
--- arch/ia64/src/ivt.S	(revision 41fa6f20b3bc3542799f3f0e2809c21e5dc4f7bc)
+++ arch/ia64/src/ivt.S	(revision 6a22fcb1d8d4c7fa9ad4454c62a6df536ba463f1)
@@ -63,6 +63,4 @@
  *
  * Some steps are skipped (enabling and disabling interrupts).
- * Some steps are not fully supported yet (e.g. dealing with floating-point
- * context).
  *
  * @param offs Offset from the beginning of IVT.
@@ -84,13 +82,13 @@
 	 */
 	
-			/*Set up FPU as in interrupred*/
-	mov r24=psr
-	mov r25=cr.ipsr 
-	mov r26=(PSR_DFH_MASK)
-	mov r27=(~(PSR_DFH_MASK));;
-	and r26=r25,r26
-	and r24=r24,r27;;
-	or r24=r24,r26;;
-	mov psr.l=r24;;
+	/* Set up FPU as in interrupted context. */
+	mov r24 = psr
+	mov r25 = cr.ipsr 
+	mov r26 = PSR_DFH_MASK
+	mov r27 = ~PSR_DFH_MASK ;;
+	and r26 = r25, r26
+	and r24 = r24, r27;;
+	or r24 = r24, r26;;
+	mov psr.l = r24;;
 	srlz.i
 	srlz.d;;
@@ -252,13 +250,13 @@
 	mov cr.isr = r27
 	mov cr.ifa = r28
-			/*Set up FPU as in exception*/
-	mov r24=psr
-	mov r26=(PSR_DFH_MASK)
-	mov r27=(~(PSR_DFH_MASK));;
-	and r25=r25,r27
-	and r24=r24,r26;;
-	or r25=r25,r24;;
+
+	/* Set up FPU as in exception. */
+	mov r24 = psr
+	mov r26 = PSR_DFH_MASK
+	mov r27 = ~PSR_DFH_MASK ;;
+	and r25 = r25, r27
+	and r24 = r24, r26 ;;
+	or r25 = r25, r24;;
 	mov cr.ipsr = r25
-	
 
     /* 18. restore predicate registers from memory stack */
@@ -308,5 +306,4 @@
 	
     /* 8. preserve general and floating-point registers */
-	/* TODO: save floating-point context */
 	mov loc17 = r1
 	mov loc18 = r2
@@ -341,57 +338,48 @@
 	mov loc46 = r31
 
-	mov r24=96 + STACK_SCRATCH_AREA_SIZE
-	mov r25=112 + STACK_SCRATCH_AREA_SIZE 
-	mov r26=0 + STACK_SCRATCH_AREA_SIZE
-	mov r27=16 + STACK_SCRATCH_AREA_SIZE
-	mov r28=32 + STACK_SCRATCH_AREA_SIZE
-	mov r29=48 + STACK_SCRATCH_AREA_SIZE
-	mov r30=64 + STACK_SCRATCH_AREA_SIZE
-	mov r31=80 + STACK_SCRATCH_AREA_SIZE;;
-	add r24=r12,r24
-	add r25=r12,r25
-	add r26=r12,r26
-	add r27=r12,r27
-	add r28=r12,r28
-	add r29=r12,r29
-	add r30=r12,r30
-	add r31=r12,r31;;
-	
-	stf.spill [r26]=f2,0x80
-	stf.spill [r27]=f3,0x80
-	stf.spill [r28]=f4,0x80
-	stf.spill [r29]=f5,0x80
-	stf.spill [r30]=f6,0x80
-	stf.spill [r31]=f7,0x80;;
-
-	stf.spill [r24]=f8,0x80
-	stf.spill [r25]=f9,0x80
-	stf.spill [r26]=f10,0x80
-	stf.spill [r27]=f11,0x80
-	stf.spill [r28]=f12,0x80
-	stf.spill [r29]=f13,0x80
-	stf.spill [r30]=f14,0x80
-	stf.spill [r31]=f15,0x80;;
-
-	stf.spill [r24]=f16,0x80
-	stf.spill [r25]=f17,0x80
-	stf.spill [r26]=f18,0x80
-	stf.spill [r27]=f19,0x80
-	stf.spill [r28]=f20,0x80
-	stf.spill [r29]=f21,0x80
-	stf.spill [r30]=f22,0x80
-	stf.spill [r31]=f23,0x80;;
-
-	stf.spill [r24]=f24,0x80
-	stf.spill [r25]=f25,0x80
-	stf.spill [r26]=f26,0x80
-	stf.spill [r27]=f27,0x80
-	stf.spill [r28]=f28,0x80
-	stf.spill [r29]=f29,0x80
-	stf.spill [r30]=f30,0x80
-	stf.spill [r31]=f31,0x80;;
-
-	/* preserve Floating point status register */
-	mov loc47 = ar.fpsr
+	add r24 = 96 + STACK_SCRATCH_AREA_SIZE, r12
+	add r25 = 112 + STACK_SCRATCH_AREA_SIZE, r12
+	add r26 = 0 + STACK_SCRATCH_AREA_SIZE, r12
+	add r27 = 16 + STACK_SCRATCH_AREA_SIZE, r12
+	add r28 = 32 + STACK_SCRATCH_AREA_SIZE, r12
+	add r29 = 48 + STACK_SCRATCH_AREA_SIZE, r12
+	add r30 = 64 + STACK_SCRATCH_AREA_SIZE, r12
+	add r31 = 80 + STACK_SCRATCH_AREA_SIZE, r12 ;;
+	
+	stf.spill [r26] = f2, 0x80
+	stf.spill [r27] = f3, 0x80
+	stf.spill [r28] = f4, 0x80
+	stf.spill [r29] = f5, 0x80
+	stf.spill [r30] = f6, 0x80
+	stf.spill [r31] = f7, 0x80 ;;
+
+	stf.spill [r24] = f8, 0x80
+	stf.spill [r25] = f9, 0x80
+	stf.spill [r26] = f10, 0x80
+	stf.spill [r27] = f11, 0x80
+	stf.spill [r28] = f12, 0x80
+	stf.spill [r29] = f13, 0x80
+	stf.spill [r30] = f14, 0x80
+	stf.spill [r31] = f15, 0x80 ;;
+
+	stf.spill [r24] = f16, 0x80
+	stf.spill [r25] = f17, 0x80
+	stf.spill [r26] = f18, 0x80
+	stf.spill [r27] = f19, 0x80
+	stf.spill [r28] = f20, 0x80
+	stf.spill [r29] = f21, 0x80
+	stf.spill [r30] = f22, 0x80
+	stf.spill [r31] = f23, 0x80 ;;
+
+	stf.spill [r24] = f24, 0x80
+	stf.spill [r25] = f25, 0x80
+	stf.spill [r26] = f26, 0x80
+	stf.spill [r27] = f27, 0x80
+	stf.spill [r28] = f28, 0x80
+	stf.spill [r29] = f29, 0x80
+	stf.spill [r30] = f30, 0x80
+	stf.spill [r31] = f31, 0x80 ;;
+
+	mov loc47 = ar.fpsr	/* preserve floating point status register */
     
     /* 9. skipped (will not enable interrupts) */
@@ -419,57 +407,46 @@
 
     /* 13. restore general and floating-point registers */
-	/* TODO: restore floating-point context */
-	mov r24=96 + STACK_SCRATCH_AREA_SIZE
-	mov r25=112 + STACK_SCRATCH_AREA_SIZE 
-	mov r26=0 + STACK_SCRATCH_AREA_SIZE
-	mov r27=16 + STACK_SCRATCH_AREA_SIZE
-	mov r28=32 + STACK_SCRATCH_AREA_SIZE
-	mov r29=48 + STACK_SCRATCH_AREA_SIZE
-	mov r30=64 + STACK_SCRATCH_AREA_SIZE
-	mov r31=80 + STACK_SCRATCH_AREA_SIZE;;
-	add r24=r12,r24
-	add r25=r12,r25
-	add r26=r12,r26
-	add r27=r12,r27
-	add r28=r12,r28
-	add r29=r12,r29
-	add r30=r12,r30
-	add r31=r12,r31;;
-
-	
-	ldf.fill f2=[r26],0x80
-	ldf.fill f3=[r27],0x80
-	ldf.fill f4=[r28],0x80
-	ldf.fill f5=[r29],0x80
-	ldf.fill f6=[r30],0x80
-	ldf.fill f7=[r31],0x80;;
-
-	ldf.fill f8=[r24],0x80
-	ldf.fill f9=[r25],0x80
-	ldf.fill f10=[r26],0x80
-	ldf.fill f11=[r27],0x80
-	ldf.fill f12=[r28],0x80
-	ldf.fill f13=[r29],0x80
-	ldf.fill f14=[r30],0x80
-	ldf.fill f15=[r31],0x80;;
-
-	ldf.fill f16=[r24],0x80
-	ldf.fill f17=[r25],0x80
-	ldf.fill f18=[r26],0x80
-	ldf.fill f19=[r27],0x80
-	ldf.fill f20=[r28],0x80
-	ldf.fill f21=[r29],0x80
-	ldf.fill f22=[r30],0x80
-	ldf.fill f23=[r31],0x80;;
-
-	ldf.fill f24=[r24],0x80
-	ldf.fill f25=[r25],0x80
-	ldf.fill f26=[r26],0x80
-	ldf.fill f27=[r27],0x80
-	ldf.fill f28=[r28],0x80
-	ldf.fill f29=[r29],0x80
-	ldf.fill f30=[r30],0x80
-	ldf.fill f31=[r31],0x80;;
-	
+	add r24 = 96 + STACK_SCRATCH_AREA_SIZE, r12
+	add r25 = 112 + STACK_SCRATCH_AREA_SIZE, r12
+	add r26 = 0 + STACK_SCRATCH_AREA_SIZE, r12
+	add r27 = 16 + STACK_SCRATCH_AREA_SIZE, r12
+	add r28 = 32 + STACK_SCRATCH_AREA_SIZE, r12
+	add r29 = 48 + STACK_SCRATCH_AREA_SIZE, r12
+	add r30 = 64 + STACK_SCRATCH_AREA_SIZE, r12
+	add r31 = 80 + STACK_SCRATCH_AREA_SIZE, r12 ;;
+
+	ldf.fill f2 = [r26], 0x80
+	ldf.fill f3 = [r27], 0x80
+	ldf.fill f4 = [r28], 0x80
+	ldf.fill f5 = [r29], 0x80
+	ldf.fill f6 = [r30], 0x80
+	ldf.fill f7 = [r31], 0x80 ;;
+
+	ldf.fill f8 = [r24], 0x80
+	ldf.fill f9 = [r25], 0x80
+	ldf.fill f10 = [r26], 0x80
+	ldf.fill f11 = [r27], 0x80
+	ldf.fill f12 = [r28], 0x80
+	ldf.fill f13 = [r29], 0x80
+	ldf.fill f14 = [r30], 0x80
+	ldf.fill f15 = [r31], 0x80 ;;
+
+	ldf.fill f16 = [r24], 0x80
+	ldf.fill f17 = [r25], 0x80
+	ldf.fill f18 = [r26], 0x80
+	ldf.fill f19 = [r27], 0x80
+	ldf.fill f20 = [r28], 0x80
+	ldf.fill f21 = [r29], 0x80
+	ldf.fill f22 = [r30], 0x80
+	ldf.fill f23 = [r31], 0x80 ;;
+
+	ldf.fill f24 = [r24], 0x80
+	ldf.fill f25 = [r25], 0x80
+	ldf.fill f26 = [r26], 0x80
+	ldf.fill f27 = [r27], 0x80
+	ldf.fill f28 = [r28], 0x80
+	ldf.fill f29 = [r29], 0x80
+	ldf.fill f30 = [r30], 0x80
+	ldf.fill f31 = [r31], 0x80 ;;
 	
 	mov r1 = loc17
@@ -504,7 +481,6 @@
 	mov r30 = loc45
 	mov r31 = loc46
-	
-	/* restore Floating point status register */
-	mov ar.fpsr = loc47
+
+	mov ar.fpsr = loc47	/* restore floating point status register */
 	
     /* 14. restore branch and application registers */
@@ -608,6 +584,2 @@
 	HEAVYWEIGHT_HANDLER 0x7e00
 	HEAVYWEIGHT_HANDLER 0x7f00
-
-
-
-
