Index: arch/ppc32/src/drivers/cuda.c
===================================================================
--- arch/ppc32/src/drivers/cuda.c	(revision 41d33aca6323fda79c1a11fc827a1a73ba58c85f)
+++ arch/ppc32/src/drivers/cuda.c	(revision 116d1ef443ca3edd56636818c5c30d58ad5bf213)
@@ -31,4 +31,6 @@
 #include <console/chardev.h>
 #include <console/console.h>
+#include <arch/drivers/pic.h>
+#include <interrupt.h>
 
 #define CUDA_PACKET 0x01
@@ -48,7 +50,14 @@
 static volatile __u8 *cuda = (__u8 *) 0xf2000000;
 
+#include <print.h>
+static void cuda_irq(int n, istate_t *istate)
+{
+	printf("Got cuda msg\n");
+}
 
 void cuda_init(void)
 {
+	int_register(CUDA_IRQ, "cuda", cuda_irq);
+	pic_enable_interrupt(CUDA_IRQ);
 }
 
Index: arch/ppc32/src/drivers/pic.c
===================================================================
--- arch/ppc32/src/drivers/pic.c	(revision 116d1ef443ca3edd56636818c5c30d58ad5bf213)
+++ arch/ppc32/src/drivers/pic.c	(revision 116d1ef443ca3edd56636818c5c30d58ad5bf213)
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2006 Ondrej Palkovsky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include <arch/asm.h>
+#include <arch/drivers/pic.h>
+#include <byteorder.h>
+#include <bitops.h>
+
+static volatile __u32 *pic;
+
+void pic_init(void)
+{
+	pic = (__u32 *)hw_map(PIC_HW_ADDR, PAGE_SIZE);
+}
+
+
+
+void pic_enable_interrupt(int intnum)
+{
+	if (intnum < 32) {
+		pic[PIC_MASK_LOW] = pic[PIC_MASK_LOW] | (1 << intnum);
+	} else {
+		pic[PIC_MASK_HIGH] = pic[PIC_MASK_HIGH] | (1 << (intnum-32));
+	}
+	
+}
+
+void pic_disable_interrupt(int intnum)
+{
+	if (intnum < 32) {
+		pic[PIC_MASK_LOW] = pic[PIC_MASK_LOW] & (~(1 << intnum));
+	} else {
+		pic[PIC_MASK_HIGH] = pic[PIC_MASK_HIGH] & (~(1 << (intnum-32)));
+	}
+}
+
+void pic_ack_interrupt(int intnum)
+{
+	if (intnum < 32) 
+		pic[PIC_ACK_LOW] = 1 << intnum;
+	else 
+		pic[PIC_ACK_HIGH] = 1 << (intnum-32);
+}
+
+/** Return number of pending interrupt */
+int pic_get_pending(void)
+{
+	int pending;
+
+	pending = pic[PIC_PENDING_LOW];
+	if (pending) {
+		return fnzb32(pending);
+	}
+	pending = pic[PIC_PENDING_HIGH];
+	if (pending) {
+		return fnzb32(pending) + 32;
+	}
+	return -1;
+}
Index: arch/ppc32/src/exception.S
===================================================================
--- arch/ppc32/src/exception.S	(revision 41d33aca6323fda79c1a11fc827a1a73ba58c85f)
+++ arch/ppc32/src/exception.S	(revision 116d1ef443ca3edd56636818c5c30d58ad5bf213)
@@ -186,5 +186,12 @@
 .global exc_external
 exc_external:
-	b exc_external
+	CONTEXT_STORE
+
+	lis r12, extint_handler@ha
+	addi r12, r12, extint_handler@l
+	mtsrr0 r12
+
+	li r3, 0
+	b jump_to_kernel
 
 .org 0x600
Index: arch/ppc32/src/interrupt.c
===================================================================
--- arch/ppc32/src/interrupt.c	(revision 41d33aca6323fda79c1a11fc827a1a73ba58c85f)
+++ arch/ppc32/src/interrupt.c	(revision 116d1ef443ca3edd56636818c5c30d58ad5bf213)
@@ -33,4 +33,5 @@
 #include <time/clock.h>
 #include <ipc/sysipc.h>
+#include <arch/drivers/pic.h>
 
 
@@ -65,2 +66,14 @@
 	/* TODO */
 }
+
+#include <print.h>
+/** Handler of externul interrupts */
+void extint_handler(int n, istate_t *istate)
+{
+	int inum;
+
+	while ((inum = pic_get_pending()) != -1) {
+		exc_dispatch(inum+INT_OFFSET, istate);
+		pic_ack_interrupt(inum);
+	}
+}
Index: arch/ppc32/src/ppc32.c
===================================================================
--- arch/ppc32/src/ppc32.c	(revision 41d33aca6323fda79c1a11fc827a1a73ba58c85f)
+++ arch/ppc32/src/ppc32.c	(revision 116d1ef443ca3edd56636818c5c30d58ad5bf213)
@@ -36,4 +36,5 @@
 #include <proc/uarg.h>
 #include <console/console.h>
+#include <arch/drivers/pic.h>
 
 bootinfo_t bootinfo;
@@ -56,8 +57,7 @@
 	/* Initialize dispatch table */
 	interrupt_init();
-	
+
 	/* Start decrementer */
 	start_decrementer();
-	cuda_init();
 }
 
@@ -67,4 +67,8 @@
 		fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline);	
 	
+		/* Initialize PIC */
+		pic_init();
+	
+		cuda_init();
 		/* Merge all zones to 1 big zone */
 		zone_merge_all();
