Index: HelenOS.config
===================================================================
--- HelenOS.config	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ HelenOS.config	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -406,4 +406,7 @@
 ! [PLATFORM=ia64&MACHINE!=ski] CONFIG_IOSAPIC (y/n)
 
+% Support for Intel i8259 PIC
+! [PLATFORM=ia32|PLATFORM=amd64] CONFIG_I8259 (y)
+
 % Virtually indexed D-cache support
 ! [PLATFORM=sparc64] CONFIG_VIRT_IDX_DCACHE (y/n)
Index: kernel/arch/amd64/Makefile.inc
===================================================================
--- kernel/arch/amd64/Makefile.inc	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ kernel/arch/amd64/Makefile.inc	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -60,5 +60,4 @@
 	arch/$(KARCH)/src/ddi/ddi.c \
 	arch/$(KARCH)/src/drivers/i8254.c \
-	arch/$(KARCH)/src/drivers/i8259.c \
 	arch/$(KARCH)/src/delay.S \
 	arch/$(KARCH)/src/amd64.c \
Index: kernel/arch/amd64/src/amd64.c
===================================================================
--- kernel/arch/amd64/src/amd64.c	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ kernel/arch/amd64/src/amd64.c	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -45,9 +45,9 @@
 #include <arch/boot/boot.h>
 #include <arch/drivers/i8254.h>
-#include <arch/drivers/i8259.h>
 #include <arch/syscall.h>
 #include <genarch/acpi/acpi.h>
 #include <genarch/drivers/ega/ega.h>
 #include <genarch/drivers/i8042/i8042.h>
+#include <genarch/drivers/i8259/i8259.h>
 #include <genarch/drivers/ns16550/ns16550.h>
 #include <genarch/drivers/legacy/ia32/io.h>
Index: kernel/arch/amd64/src/interrupt.c
===================================================================
--- kernel/arch/amd64/src/interrupt.c	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ kernel/arch/amd64/src/interrupt.c	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -37,5 +37,5 @@
 #include <log.h>
 #include <panic.h>
-#include <arch/drivers/i8259.h>
+#include <genarch/drivers/i8259/i8259.h>
 #include <halt.h>
 #include <cpu.h>
Index: kernel/arch/ia32/Makefile.inc
===================================================================
--- kernel/arch/ia32/Makefile.inc	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ kernel/arch/ia32/Makefile.inc	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -92,5 +92,4 @@
 	arch/$(KARCH)/src/ddi/ddi.c \
 	arch/$(KARCH)/src/drivers/i8254.c \
-	arch/$(KARCH)/src/drivers/i8259.c \
 	arch/$(KARCH)/src/boot/multiboot.S \
 	arch/$(KARCH)/src/boot/multiboot2.S \
Index: rnel/arch/ia32/include/arch/drivers/i8259.h
===================================================================
--- kernel/arch/ia32/include/arch/drivers/i8259.h	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ 	(revision )
@@ -1,62 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * 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.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/** @file
- */
-
-#ifndef KERN_ia32_I8259_H_
-#define KERN_ia32_I8259_H_
-
-#include <typedefs.h>
-#include <arch/interrupt.h>
-
-#define PIC_PIC0PORT1  ((ioport8_t *) 0x20U)
-#define PIC_PIC0PORT2  ((ioport8_t *) 0x21U)
-#define PIC_PIC1PORT1  ((ioport8_t *) 0xa0U)
-#define PIC_PIC1PORT2  ((ioport8_t *) 0xa1U)
-
-/* ICW1 bits */
-#define PIC_ICW1           (1 << 4)
-#define PIC_ICW1_NEEDICW4  (1 << 0)
-
-/* OCW4 bits */
-#define PIC_OCW4           (0 << 3)
-#define PIC_OCW4_NSEOI     (1 << 5)
-
-extern void i8259_init(void);
-extern void pic_enable_irqs(uint16_t);
-extern void pic_disable_irqs(uint16_t);
-extern void pic_eoi(void);
-
-#endif
-
-/** @}
- */
Index: kernel/arch/ia32/src/drivers/i8254.c
===================================================================
--- kernel/arch/ia32/src/drivers/i8254.c	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ kernel/arch/ia32/src/drivers/i8254.c	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -42,5 +42,5 @@
 #include <arch/cycle.h>
 #include <arch/interrupt.h>
-#include <arch/drivers/i8259.h>
+#include <genarch/drivers/i8259/i8259.h>
 #include <arch/drivers/i8254.h>
 #include <cpu.h>
Index: rnel/arch/ia32/src/drivers/i8259.c
===================================================================
--- kernel/arch/ia32/src/drivers/i8259.c	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ 	(revision )
@@ -1,136 +1,0 @@
-/*
- * Copyright (c) 2001-2004 Jakub Jermar
- * 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.
- */
-
-/** @addtogroup kernel_ia32
- * @{
- */
-/**
- * @file
- * @brief PIC driver.
- *
- * Programmable Interrupt Controller for UP systems based on i8259 chip.
- */
-
-#include <arch/drivers/i8259.h>
-#include <cpu.h>
-#include <stdint.h>
-#include <arch/asm.h>
-#include <arch.h>
-#include <log.h>
-#include <interrupt.h>
-
-static void pic_spurious(unsigned int n, istate_t *istate);
-
-void i8259_init(void)
-{
-	/* ICW1: this is ICW1, ICW4 to follow */
-	pio_write_8(PIC_PIC0PORT1, PIC_ICW1 | PIC_ICW1_NEEDICW4);
-
-	/* ICW2: IRQ 0 maps to INT IRQBASE */
-	pio_write_8(PIC_PIC0PORT2, IVT_IRQBASE);
-
-	/* ICW3: pic1 using IRQ IRQ_PIC1 */
-	pio_write_8(PIC_PIC0PORT2, 1 << IRQ_PIC1);
-
-	/* ICW4: i8086 mode */
-	pio_write_8(PIC_PIC0PORT2, 1);
-
-	/* ICW1: ICW1, ICW4 to follow */
-	pio_write_8(PIC_PIC1PORT1, PIC_ICW1 | PIC_ICW1_NEEDICW4);
-
-	/* ICW2: IRQ 8 maps to INT (IVT_IRQBASE + 8) */
-	pio_write_8(PIC_PIC1PORT2, IVT_IRQBASE + 8);
-
-	/* ICW3: pic1 is known as IRQ_PIC1 */
-	pio_write_8(PIC_PIC1PORT2, IRQ_PIC1);
-
-	/* ICW4: i8086 mode */
-	pio_write_8(PIC_PIC1PORT2, 1);
-
-	/*
-	 * Register interrupt handler for the PIC spurious interrupt.
-	 */
-	exc_register(VECTOR_PIC_SPUR, "pic_spurious", false,
-	    (iroutine_t) pic_spurious);
-
-	/*
-	 * Set the enable/disable IRQs handlers.
-	 * Set the End-of-Interrupt handler.
-	 */
-	enable_irqs_function = pic_enable_irqs;
-	disable_irqs_function = pic_disable_irqs;
-	eoi_function = pic_eoi;
-	irqs_info = "i8259";
-
-	pic_disable_irqs(0xffff);		/* disable all irq's */
-	pic_enable_irqs(1 << IRQ_PIC1);		/* but enable pic1 */
-}
-
-void pic_enable_irqs(uint16_t irqmask)
-{
-	uint8_t x;
-
-	if (irqmask & 0xff) {
-		x = pio_read_8(PIC_PIC0PORT2);
-		pio_write_8(PIC_PIC0PORT2, (uint8_t) (x & (~(irqmask & 0xff))));
-	}
-	if (irqmask >> 8) {
-		x = pio_read_8(PIC_PIC1PORT2);
-		pio_write_8(PIC_PIC1PORT2, (uint8_t) (x & (~(irqmask >> 8))));
-	}
-}
-
-void pic_disable_irqs(uint16_t irqmask)
-{
-	uint8_t x;
-
-	if (irqmask & 0xff) {
-		x = pio_read_8(PIC_PIC0PORT2);
-		pio_write_8(PIC_PIC0PORT2, (uint8_t) (x | (irqmask & 0xff)));
-	}
-	if (irqmask >> 8) {
-		x = pio_read_8(PIC_PIC1PORT2);
-		pio_write_8(PIC_PIC1PORT2, (uint8_t) (x | (irqmask >> 8)));
-	}
-}
-
-void pic_eoi(void)
-{
-	pio_write_8(PIC_PIC0PORT1, PIC_OCW4 | PIC_OCW4_NSEOI);
-	pio_write_8(PIC_PIC1PORT1, PIC_OCW4 | PIC_OCW4_NSEOI);
-}
-
-void pic_spurious(unsigned int n __attribute__((unused)), istate_t *istate __attribute__((unused)))
-{
-#ifdef CONFIG_DEBUG
-	log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt", CPU->id);
-#endif
-}
-
-/** @}
- */
Index: kernel/arch/ia32/src/ia32.c
===================================================================
--- kernel/arch/ia32/src/ia32.c	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ kernel/arch/ia32/src/ia32.c	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -47,8 +47,8 @@
 #include <arch/boot/boot.h>
 #include <arch/drivers/i8254.h>
-#include <arch/drivers/i8259.h>
 #include <genarch/acpi/acpi.h>
 #include <genarch/drivers/ega/ega.h>
 #include <genarch/drivers/i8042/i8042.h>
+#include <genarch/drivers/i8259/i8259.h>
 #include <genarch/drivers/ns16550/ns16550.h>
 #include <genarch/drivers/legacy/ia32/io.h>
Index: kernel/arch/ia32/src/interrupt.c
===================================================================
--- kernel/arch/ia32/src/interrupt.c	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ kernel/arch/ia32/src/interrupt.c	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -39,5 +39,5 @@
 #include <debug.h>
 #include <panic.h>
-#include <arch/drivers/i8259.h>
+#include <genarch/drivers/i8259/i8259.h>
 #include <halt.h>
 #include <cpu.h>
Index: kernel/arch/ia32/src/smp/smp.c
===================================================================
--- kernel/arch/ia32/src/smp/smp.c	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ kernel/arch/ia32/src/smp/smp.c	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -55,5 +55,5 @@
 #include <log.h>
 #include <mem.h>
-#include <arch/drivers/i8259.h>
+#include <genarch/drivers/i8259/i8259.h>
 #include <cpu.h>
 
Index: kernel/genarch/Makefile.inc
===================================================================
--- kernel/genarch/Makefile.inc	(revision 8f059b51c69ff84a0399aecd508111d3f470c821)
+++ kernel/genarch/Makefile.inc	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -85,4 +85,9 @@
 endif
 
+ifeq ($(CONFIG_I8259),y)
+GENARCH_SOURCES += \
+	genarch/src/drivers/i8259/i8259.c
+endif
+
 ifeq ($(CONFIG_NS16550),y)
 GENARCH_SOURCES += \
Index: kernel/genarch/include/genarch/drivers/i8259/i8259.h
===================================================================
--- kernel/genarch/include/genarch/drivers/i8259/i8259.h	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
+++ kernel/genarch/include/genarch/drivers/i8259/i8259.h	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2001-2004 Jakub Jermar
+ * 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.
+ */
+
+/** @addtogroup kernel_genarch
+ * @{
+ */
+/** @file
+ */
+
+#ifndef KERN_I8259_H_
+#define KERN_I8259_H_
+
+#include <typedefs.h>
+#include <arch/interrupt.h>
+
+#define PIC_PIC0PORT1  ((ioport8_t *) 0x20U)
+#define PIC_PIC0PORT2  ((ioport8_t *) 0x21U)
+#define PIC_PIC1PORT1  ((ioport8_t *) 0xa0U)
+#define PIC_PIC1PORT2  ((ioport8_t *) 0xa1U)
+
+/* ICW1 bits */
+#define PIC_ICW1           (1 << 4)
+#define PIC_ICW1_NEEDICW4  (1 << 0)
+
+/* OCW4 bits */
+#define PIC_OCW4           (0 << 3)
+#define PIC_OCW4_NSEOI     (1 << 5)
+
+extern void i8259_init(void);
+extern void pic_enable_irqs(uint16_t);
+extern void pic_disable_irqs(uint16_t);
+extern void pic_eoi(void);
+
+#endif
+
+/** @}
+ */
Index: kernel/genarch/src/drivers/i8259/i8259.c
===================================================================
--- kernel/genarch/src/drivers/i8259/i8259.c	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
+++ kernel/genarch/src/drivers/i8259/i8259.c	(revision 87a57963770ed25144cc5465eac8c036c70d4201)
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2001-2004 Jakub Jermar
+ * 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.
+ */
+
+/** @addtogroup kernel_genarch
+ * @{
+ */
+/**
+ * @file
+ * @brief PIC driver.
+ *
+ * Programmable Interrupt Controller for UP systems based on i8259 chip.
+ */
+
+#include <genarch/drivers/i8259/i8259.h>
+#include <cpu.h>
+#include <stdint.h>
+#include <arch/asm.h>
+#include <arch.h>
+#include <log.h>
+#include <interrupt.h>
+
+static void pic_spurious(unsigned int n, istate_t *istate);
+
+void i8259_init(void)
+{
+	/* ICW1: this is ICW1, ICW4 to follow */
+	pio_write_8(PIC_PIC0PORT1, PIC_ICW1 | PIC_ICW1_NEEDICW4);
+
+	/* ICW2: IRQ 0 maps to INT IRQBASE */
+	pio_write_8(PIC_PIC0PORT2, IVT_IRQBASE);
+
+	/* ICW3: pic1 using IRQ IRQ_PIC1 */
+	pio_write_8(PIC_PIC0PORT2, 1 << IRQ_PIC1);
+
+	/* ICW4: i8086 mode */
+	pio_write_8(PIC_PIC0PORT2, 1);
+
+	/* ICW1: ICW1, ICW4 to follow */
+	pio_write_8(PIC_PIC1PORT1, PIC_ICW1 | PIC_ICW1_NEEDICW4);
+
+	/* ICW2: IRQ 8 maps to INT (IVT_IRQBASE + 8) */
+	pio_write_8(PIC_PIC1PORT2, IVT_IRQBASE + 8);
+
+	/* ICW3: pic1 is known as IRQ_PIC1 */
+	pio_write_8(PIC_PIC1PORT2, IRQ_PIC1);
+
+	/* ICW4: i8086 mode */
+	pio_write_8(PIC_PIC1PORT2, 1);
+
+	/*
+	 * Register interrupt handler for the PIC spurious interrupt.
+	 */
+	exc_register(VECTOR_PIC_SPUR, "pic_spurious", false,
+	    (iroutine_t) pic_spurious);
+
+	/*
+	 * Set the enable/disable IRQs handlers.
+	 * Set the End-of-Interrupt handler.
+	 */
+	enable_irqs_function = pic_enable_irqs;
+	disable_irqs_function = pic_disable_irqs;
+	eoi_function = pic_eoi;
+	irqs_info = "i8259";
+
+	pic_disable_irqs(0xffff);		/* disable all irq's */
+	pic_enable_irqs(1 << IRQ_PIC1);		/* but enable pic1 */
+}
+
+void pic_enable_irqs(uint16_t irqmask)
+{
+	uint8_t x;
+
+	if (irqmask & 0xff) {
+		x = pio_read_8(PIC_PIC0PORT2);
+		pio_write_8(PIC_PIC0PORT2, (uint8_t) (x & (~(irqmask & 0xff))));
+	}
+	if (irqmask >> 8) {
+		x = pio_read_8(PIC_PIC1PORT2);
+		pio_write_8(PIC_PIC1PORT2, (uint8_t) (x & (~(irqmask >> 8))));
+	}
+}
+
+void pic_disable_irqs(uint16_t irqmask)
+{
+	uint8_t x;
+
+	if (irqmask & 0xff) {
+		x = pio_read_8(PIC_PIC0PORT2);
+		pio_write_8(PIC_PIC0PORT2, (uint8_t) (x | (irqmask & 0xff)));
+	}
+	if (irqmask >> 8) {
+		x = pio_read_8(PIC_PIC1PORT2);
+		pio_write_8(PIC_PIC1PORT2, (uint8_t) (x | (irqmask >> 8)));
+	}
+}
+
+void pic_eoi(void)
+{
+	pio_write_8(PIC_PIC0PORT1, PIC_OCW4 | PIC_OCW4_NSEOI);
+	pio_write_8(PIC_PIC1PORT1, PIC_OCW4 | PIC_OCW4_NSEOI);
+}
+
+void pic_spurious(unsigned int n __attribute__((unused)), istate_t *istate __attribute__((unused)))
+{
+#ifdef CONFIG_DEBUG
+	log(LF_ARCH, LVL_DEBUG, "cpu%u: PIC spurious interrupt", CPU->id);
+#endif
+}
+
+/** @}
+ */
