Index: kernel/genarch/src/acpi/madt.c
===================================================================
--- kernel/genarch/src/acpi/madt.c	(revision 4babe62eb29f1e035bd83e6062adb63603d1b9a8)
+++ kernel/genarch/src/acpi/madt.c	(revision 50f4b9515d8379359f3deeb824cd9361eefed873)
@@ -131,8 +131,8 @@
 };
 
-static int madt_cmp(void *a, void *b)
-{
-	uint8_t typea = ((struct madt_apic_header *) a)->type;
-	uint8_t typeb = ((struct madt_apic_header *) b)->type;
+static int madt_cmp(void *a, void *b, void *arg)
+{
+	uint8_t typea = (*((struct madt_apic_header **) a))->type;
+	uint8_t typeb = (*((struct madt_apic_header **) b))->type;
 	
 	if (typea > typeb)
@@ -208,6 +208,7 @@
 	
 	/* Sort MADT index structure */
-	qsort(madt_entries_index, madt_entries_index_cnt, sizeof(uintptr_t),
-	    &madt_cmp);
+	if (!gsort(madt_entries_index, madt_entries_index_cnt,
+	    sizeof(struct madt_apic_header *), madt_cmp, NULL))
+		panic("Sorting error.");
 	
 	/* Parse MADT entries */
