Index: src/debug/print.c
===================================================================
--- src/debug/print.c	(revision f761f1eb635bfe9a5deaf70a0f0a51aa8d2f5f22)
+++ src/debug/print.c	(revision 0d2f8058babf45e17ed29e67097158b7d3387b3f)
@@ -30,4 +30,6 @@
 #include <print.h>
 #include <synch/spinlock.h>
+#include <arch/arg.h>
+
 
 static char digits[] = "0123456789abcdef";
@@ -80,9 +82,13 @@
 void printf(char *fmt, ...)
 {
-	int irqpri, i = 0, pos = 0;
-	char c;
+	int irqpri, i = 0;
+	va_list ap;
+	char c;	
+
+	va_start(ap, fmt);
 
 	irqpri = cpu_priority_high();
 	spinlock_lock(&printflock);
+
 	while (c = fmt[i++]) {
 		switch (c) {
@@ -100,9 +106,9 @@
 				 */
 				case 's':
-					print_str((char *) *(((__address *) &fmt + (++pos))));
+					print_str(va_arg(ap, char_ptr));
 					goto loop;
 
 				case 'c':
-					c = *((char *) ((__address *)(&fmt + (++pos))));
+					c = va_arg(ap, char);
 					break;
 
@@ -113,5 +119,5 @@
 					print_str("0x");
 				case 'l':
-		    			print_fixed_hex(*((__address *)(&fmt + (++pos))),INT32);
+		    			print_fixed_hex(va_arg(ap, __native), INT32);
 					goto loop;
 
@@ -119,5 +125,5 @@
 					print_str("0x");
 				case 'w':
-		    			print_fixed_hex(*((__address *)(&fmt + (++pos))),INT16);
+		    			print_fixed_hex(va_arg(ap, __native), INT16);
 					goto loop;
 
@@ -125,5 +131,5 @@
 					print_str("0x");
 				case 'b':
-		    			print_fixed_hex(*((__address *)(&fmt + (++pos))),INT8);
+		    			print_fixed_hex(va_arg(ap, __native), INT8);
 					goto loop;
 
@@ -132,5 +138,5 @@
 		                 */
 				case 'd':
-		    			print_number(*((__address *)(&fmt + (++pos))), 10);
+		    			print_number(va_arg(ap, __native), 10);
 					goto loop;
 
@@ -138,5 +144,5 @@
 			                print_str("0x");
 				case 'x':
-		    			print_number(*((__address *)(&fmt + (++pos))), 16);
+		    			print_number(va_arg(ap, __native), 16);
 					goto loop;
 	    
@@ -158,3 +164,5 @@
 	spinlock_unlock(&printflock);
 	cpu_priority_restore(irqpri);
+	
+	va_end(ap);
 }
