Index: arch/ia32/include/interrupt.h
===================================================================
--- arch/ia32/include/interrupt.h	(revision f701b236f5ebbb10720568819a088c22b50a3475)
+++ arch/ia32/include/interrupt.h	(revision 914913505848dfc79d3580738e7a94b7f8ce9787)
@@ -35,11 +35,10 @@
 #define IVT_ITEMS		IDT_ITEMS
 
+#define EXC_COUNT	32
+#define IRQ_COUNT	16
+
 #define IVT_EXCBASE		0
-#define EXCLAST			31
-
-#define IVT_IRQBASE		(IVT_EXCBASE+EXCLAST+1)
-#define IRQLAST			15
-
-#define IVT_FREEBASE		(IVT_IRQBASE+IRQLAST+1)
+#define IVT_IRQBASE		(IVT_EXCBASE+EXC_COUNT)
+#define IVT_FREEBASE		(IVT_IRQBASE+IRQ_COUNT)
 
 #define IRQ_CLK		0
Index: arch/ia32/include/smp/apic.h
===================================================================
--- arch/ia32/include/smp/apic.h	(revision f701b236f5ebbb10720568819a088c22b50a3475)
+++ arch/ia32/include/smp/apic.h	(revision 914913505848dfc79d3580738e7a94b7f8ce9787)
@@ -36,4 +36,6 @@
 #define LOPRI		(1<<0)
 
+#define APIC_ID_COUNT	16
+
 /* local APIC macros */
 #define IPI_INIT 	0
@@ -86,5 +88,10 @@
 #define TIMER_PERIODIC	0x1
 
-#define SEND_PENDING	(1<<12)
+/** Delivery status. */
+#define DELIVS_IDLE	0x0
+#define DELIVS_PENDING	0x1
+
+/** Destination masks. */
+#define DEST_ALL	0xff
 
 /** Interrupt Command Register. */
@@ -225,5 +232,5 @@
 /** Local APIC ID Register. */
 #define L_APIC_ID	(0x020/sizeof(__u32))
-union lapic_id {
+union l_apic_id {
 	__u32 value;
 	struct {
@@ -232,5 +239,5 @@
 	} __attribute__ ((packed));
 };
-typedef union lapic_id lapic_id_t;
+typedef union l_apic_id l_apic_id_t;
 
 /* Local APIC Version Register */
@@ -285,6 +292,17 @@
 	
 } __attribute__ ((packed));
-
 typedef struct io_redirection_reg io_redirection_reg_t;
+
+
+/** IO APIC Identification Register. */
+union io_apic_id {
+	__u32 value;
+	struct {
+		unsigned : 24;		/**< Reserved. */
+		unsigned apic_id : 4;	/**< IO APIC ID. */
+		unsigned : 4;		/**< Reserved. */
+	} __attribute__ ((packed));
+};
+typedef union io_apic_id io_apic_id_t;
 
 extern volatile __u32 *l_apic;
Index: arch/ia32/src/smp/apic.c
===================================================================
--- arch/ia32/src/smp/apic.c	(revision f701b236f5ebbb10720568819a088c22b50a3475)
+++ arch/ia32/src/smp/apic.c	(revision 914913505848dfc79d3580738e7a94b7f8ce9787)
@@ -65,4 +65,5 @@
 static int apic_poll_errors(void);
 
+#ifdef LAPIC_VERBOSE
 static char *delmod_str[] = {
 	"Fixed",
@@ -105,9 +106,11 @@
 	"Polarity Low"
 };
+#endif /* LAPIC_VERBOSE */
 
 /** Initialize APIC on BSP. */
 void apic_init(void)
 {
-	__u32 tmp, id, i;
+	io_apic_id_t idreg;
+	int i;
 
 	trap_register(VECTOR_APIC_SPUR, apic_spurious);
@@ -124,24 +127,21 @@
 	io_apic_disable_irqs(0xffff);
 	trap_register(VECTOR_CLK, l_apic_timer_interrupt);
-	for (i=0; i<16; i++) {
+	for (i = 0; i < IRQ_COUNT; i++) {
 		int pin;
 	
 		if ((pin = smp_irq_to_pin(i)) != -1) {
-			io_apic_change_ioredtbl(pin, 0xff, IVT_IRQBASE+i, LOPRI);
+			io_apic_change_ioredtbl(pin, DEST_ALL, IVT_IRQBASE+i, LOPRI);
 		}
 	}
 	
-
 	/*
 	 * Ensure that io_apic has unique ID.
 	 */
-	tmp = io_apic_read(IOAPICID);
-	id = (tmp >> 24) & 0xf;
-	if ((1<<id) & apic_id_mask) {
-		int i;
-		
-		for (i=0; i<15; i++) {
+	idreg.value = io_apic_read(IOAPICID);
+	if ((1<<idreg.apic_id) & apic_id_mask) {	/* see if IO APIC ID is used already */
+		for (i = 0; i < APIC_ID_COUNT; i++) {
 			if (!((1<<i) & apic_id_mask)) {
-				io_apic_write(IOAPICID, (tmp & (~(0xf<<24))) | (i<<24));
+				idreg.apic_id = i;
+				io_apic_write(IOAPICID, idreg.value);
 				break;
 			}
@@ -153,4 +153,5 @@
 	 */
 	l_apic_init();
+
 	l_apic_debug();	
 }
@@ -179,7 +180,7 @@
 	
 	if (esr.send_checksum_error)
-		printf("Send CS Error\n");
+		printf("Send Checksum Error\n");
 	if (esr.receive_checksum_error)
-		printf("Receive CS Error\n");
+		printf("Receive Checksum Error\n");
 	if (esr.send_accept_error)
 		printf("Send Accept Error\n");
@@ -217,5 +218,5 @@
 
 	icr.lo = l_apic[ICRlo];
-	if (icr.lo & SEND_PENDING)
+	if (icr.delivs == DELIVS_PENDING)
 		printf("IPI is pending.\n");
 
@@ -260,5 +261,5 @@
 
 	icr.lo = l_apic[ICRlo];
-	if (icr.lo & SEND_PENDING)
+	if (icr.delivs == DELIVS_PENDING)
 		printf("IPI is pending.\n");
 
@@ -293,5 +294,4 @@
 	}
 	
-	
 	return apic_poll_errors();
 }
@@ -367,5 +367,4 @@
 	
 	l_apic[ICRT] = t1-t2;
-	
 }
 
@@ -414,8 +413,8 @@
 __u8 l_apic_id(void)
 {
-	lapic_id_t lapic_id;
-	
-	lapic_id.value = l_apic[L_APIC_ID];
-	return lapic_id.apic_id;
+	l_apic_id_t idreg;
+	
+	idreg.value = l_apic[L_APIC_ID];
+	return idreg.apic_id;
 }
 
@@ -491,5 +490,5 @@
 	
 	for (i=0;i<16;i++) {
-		if ((irqmask>>i) & 1) {
+		if (irqmask & (1<<i)) {
 			/*
 			 * Mask the signal input in IO APIC if there is a
@@ -517,5 +516,5 @@
 	
 	for (i=0;i<16;i++) {
-		if ((irqmask>>i) & 1) {
+		if (irqmask & (1<<i)) {
 			/*
 			 * Unmask the signal input in IO APIC if there is a
@@ -531,5 +530,4 @@
 		}
 	}
-
 }
 
Index: genarch/include/acpi/madt.h
===================================================================
--- genarch/include/acpi/madt.h	(revision f701b236f5ebbb10720568819a088c22b50a3475)
+++ genarch/include/acpi/madt.h	(revision 914913505848dfc79d3580738e7a94b7f8ce9787)
@@ -80,5 +80,5 @@
 	__u8 bus;
 	__u8 source;
-	__u32 global_intr;
+	__u32 global_int;
 	__u16 flags;
 } __attribute__ ((packed));
Index: genarch/src/acpi/matd.c
===================================================================
--- genarch/src/acpi/matd.c	(revision f701b236f5ebbb10720568819a088c22b50a3475)
+++ genarch/src/acpi/matd.c	(revision 914913505848dfc79d3580738e7a94b7f8ce9787)
@@ -227,7 +227,7 @@
 {
 	ASSERT(override->source < sizeof(isa_irq_map)/sizeof(int));
-	printf("Remapping irq%d to IO APIC pin%d\n",  override->source, override->global_intr);
-	isa_irq_map[override->source] = override->global_intr;
-	
+	printf("MADT: ignoring %s entry: bus=%d, source=%d, global_int=%d, flags=%W\n",
+		entry[override->header.type], override->bus, override->source,
+		override->global_int, override->flags);
 }
 
