Index: boot/arch/ia64/src/pal_asm.S
===================================================================
--- boot/arch/ia64/src/pal_asm.S	(revision f57705802ca849fa2ba0506a49b1b8ba4e9a94ee)
+++ boot/arch/ia64/src/pal_asm.S	(revision ac92b85be3666b77397d11d64c2ca20106e93d98)
@@ -32,11 +32,16 @@
 
 pal_static_call:
-	alloc loc0 = ar.pfs, 7, 5, 0, 0
+	alloc loc0 = ar.pfs, 7, 6, 0, 0
+
+	mov loc1 = psr ;;
+	mov psr.l = r0 ;;
+	srlz.i
+	srlz.d
 	
-	mov loc1 = gp
-	mov loc2 = rp
+	mov loc2 = gp
+	mov loc3 = rp
 	
-	addl loc3 = @gprel(pal_proc), gp
-	
+	addl loc4 = @gprel(pal_proc), gp
+
 	mov r28 = in0
 	mov r29 = in1
@@ -44,12 +49,16 @@
 	mov r31 = in3 ;;
 	
-	ld8 loc3 = [loc3]
-	movl loc4 = 0f ;;
+	ld8 loc4 = [loc4]
+	movl loc5 = 0f ;;
 
-	mov b6 = loc3
-	mov rp = loc4 ;;
+	mov b6 = loc4
+	mov rp = loc5 ;;
 	br.cond.sptk.many b6
 
 0:
+	mov psr.l = loc1 ;;
+	srlz.i
+	srlz.d
+
 	cmp.ne p7,p0 = 0, in4
 	cmp.ne p8,p0 = 0, in5
@@ -60,6 +69,6 @@
 (p9)	st8 [in6] = r11
 	
-	mov gp = loc1
-	mov rp = loc2 ;;
+	mov gp = loc2
+	mov rp = loc3 ;;
 	
 	mov ar.pfs = loc0
Index: boot/arch/ia64/src/sal_asm.S
===================================================================
--- boot/arch/ia64/src/sal_asm.S	(revision f57705802ca849fa2ba0506a49b1b8ba4e9a94ee)
+++ boot/arch/ia64/src/sal_asm.S	(revision ac92b85be3666b77397d11d64c2ca20106e93d98)
@@ -29,4 +29,9 @@
 .explicit
 
+#define STACK_SCRATCH_AREA	16
+#define STACK_IN8		(0 + STACK_SCRATCH_AREA)
+#define STACK_IN9		(8 + STACK_SCRATCH_AREA)
+#define STACK_IN10		(16 + STACK_SCRATCH_AREA)
+
 .global sal_call
 
@@ -39,6 +44,8 @@
 #
 sal_call:
-	alloc loc0 = ar.pfs, 11, 5, 8, 0
+	alloc loc0 = ar.pfs, 8, 8, 8, 0
 	
+	adds sp = -STACK_SCRATCH_AREA, sp
+
 	mov loc1 = gp
 	mov loc2 = rp
@@ -57,20 +64,31 @@
 	
 	ld8 loc3 = [loc3]
-	ld8 gp = [loc4] ;;
+	ld8 gp = [loc4]
+
+	adds r14 = STACK_IN8 + STACK_SCRATCH_AREA, sp
+	adds r15 = STACK_IN9 + STACK_SCRATCH_AREA, sp
+	adds r16 = STACK_IN10 + STACK_SCRATCH_AREA, sp ;;
+
+	ld8 loc5 = [r14]
+	ld8 loc6 = [r15]
+	ld8 loc7 = [r16]
 	
 	mov b6 = loc3 ;;
 	br.call.sptk.many rp = b6
 	
-	cmp.ne p7,p0 = 0, in8
-	cmp.ne p8,p0 = 0, in9
-	cmp.ne p9,p0 = 0, in10 ;;
+	cmp.ne p7,p0 = 0, loc5 
+	cmp.ne p8,p0 = 0, loc6 
+	cmp.ne p9,p0 = 0, loc7 ;;
 	
-(p7)	st8 [in8] = r9
-(p8)	st8 [in9] = r10
-(p9)	st8 [in10] = r11
+(p7)	st8 [loc5] = r9
+(p8)	st8 [loc6] = r10
+(p9)	st8 [loc7] = r11
 	
 	mov gp = loc1
-	mov rp = loc2 ;;
+	mov rp = loc2
+
+	adds sp = STACK_SCRATCH_AREA, sp ;;
 	
 	mov ar.pfs = loc0
 	br.ret.sptk.many rp
+
Index: kernel/arch/ia64/include/asm.h
===================================================================
--- kernel/arch/ia64/include/asm.h	(revision f57705802ca849fa2ba0506a49b1b8ba4e9a94ee)
+++ kernel/arch/ia64/include/asm.h	(revision ac92b85be3666b77397d11d64c2ca20106e93d98)
@@ -61,4 +61,5 @@
 	asm volatile (
 		"mf\n"
+		"mf.a\n"
 		::: "memory"
 	);
@@ -74,4 +75,5 @@
 	asm volatile (
 		"mf\n"
+		"mf.a\n"
 		::: "memory"
 	);
@@ -87,4 +89,5 @@
 	asm volatile (
 		"mf\n"
+		"mf.a\n"
 		::: "memory"
 	);
@@ -104,4 +107,9 @@
 	else
 		v = *port;
+
+	asm volatile (
+		"mf.a\n"
+		::: "memory"
+	);
 	
 	return v;
@@ -121,4 +129,9 @@
 	else
 		v = *port;
+
+	asm volatile (
+		"mf.a\n"
+		::: "memory"
+	);
 	
 	return v;
@@ -138,4 +151,9 @@
 	else
 		v = *port;
+
+	asm volatile (
+		"mf.a\n"
+		::: "memory"
+	);
 
 	return v;
Index: uspace/lib/c/arch/ia64/include/ddi.h
===================================================================
--- uspace/lib/c/arch/ia64/include/ddi.h	(revision f57705802ca849fa2ba0506a49b1b8ba4e9a94ee)
+++ uspace/lib/c/arch/ia64/include/ddi.h	(revision ac92b85be3666b77397d11d64c2ca20106e93d98)
@@ -62,4 +62,5 @@
 
 	asm volatile ("mf\n" ::: "memory");
+	asm volatile ("mf.a\n" ::: "memory");
 }
 
@@ -76,4 +77,5 @@
 
 	asm volatile ("mf\n" ::: "memory");
+	asm volatile ("mf.a\n" ::: "memory");
 }
 
@@ -90,4 +92,5 @@
 
 	asm volatile ("mf\n" ::: "memory");
+	asm volatile ("mf.a\n" ::: "memory");
 }
 
@@ -106,4 +109,6 @@
 		v = *port;
 	}
+
+	asm volatile ("mf.a\n" ::: "memory");
 
 	return v;
@@ -125,4 +130,6 @@
 	}
 
+	asm volatile ("mf.a\n" ::: "memory");
+
 	return v;
 }
@@ -143,4 +150,6 @@
 	}
 
+	asm volatile ("mf.a\n" ::: "memory");
+
 	return v;
 }
