Index: arch/amd64/Makefile.inc
===================================================================
--- arch/amd64/Makefile.inc	(revision 55ab0f1b4eb5fe0181079aea11a8851e2a23d7e5)
+++ arch/amd64/Makefile.inc	(revision 04225a7c815b6fd94215a9eb21f0112760974230)
@@ -74,4 +74,8 @@
 endif
 
+ifeq ($(CONFIG_SIMICS_FIX),y)
+	DEFS += -DCONFIG_SIMICS_FIX
+endif
+
 ARCH_SOURCES = \
 	arch/$(ARCH)/src/dummy.s \
Index: arch/ia32/Makefile.inc
===================================================================
--- arch/ia32/Makefile.inc	(revision 55ab0f1b4eb5fe0181079aea11a8851e2a23d7e5)
+++ arch/ia32/Makefile.inc	(revision 04225a7c815b6fd94215a9eb21f0112760974230)
@@ -92,4 +92,7 @@
 	DEFS += -DCONFIG_HT
 endif
+ifeq ($(CONFIG_SIMICS_FIX),y)
+	DEFS += -DCONFIG_SIMICS_FIX
+endif
 
 ARCH_SOURCES = \
Index: arch/ia32/src/mm/frame.c
===================================================================
--- arch/ia32/src/mm/frame.c	(revision 55ab0f1b4eb5fe0181079aea11a8851e2a23d7e5)
+++ arch/ia32/src/mm/frame.c	(revision 04225a7c815b6fd94215a9eb21f0112760974230)
@@ -54,4 +54,11 @@
 		/* Reserve AP real mode bootstrap memory */
 		frame_region_not_free(AP_BOOT_OFFSET, hardcoded_unmapped_ktext_size + hardcoded_unmapped_kdata_size);
+		
+#ifdef CONFIG_SIMICS_FIX
+		/* Don't know why, but this addresses help */
+		frame_region_not_free(0xf000,FRAME_SIZE);
+		frame_region_not_free(0xe000,FRAME_SIZE);
+		frame_region_not_free(0xd000,FRAME_SIZE);
+#endif
 #endif
 		
Index: genarch/src/acpi/matd.c
===================================================================
--- genarch/src/acpi/matd.c	(revision 55ab0f1b4eb5fe0181079aea11a8851e2a23d7e5)
+++ genarch/src/acpi/matd.c	(revision 04225a7c815b6fd94215a9eb21f0112760974230)
@@ -145,5 +145,5 @@
 
 	/* create madt apic entries index array */
-	madt_entries_index = (struct madt_apic_header * *) malloc(madt_entries_index_cnt * sizeof(struct madt_apic_header * *));
+	madt_entries_index = (struct madt_apic_header * *) early_malloc(madt_entries_index_cnt * sizeof(struct madt_apic_header * *));
 
 	__u32 index = 0;
Index: generic/include/mm/as.h
===================================================================
--- generic/include/mm/as.h	(revision 55ab0f1b4eb5fe0181079aea11a8851e2a23d7e5)
+++ generic/include/mm/as.h	(revision 04225a7c815b6fd94215a9eb21f0112760974230)
@@ -49,5 +49,6 @@
 #define UDATA_ADDRESS	UDATA_ADDRESS_ARCH
 
-#define FLAG_AS_KERNEL	(1<<0)		/**< Kernel address space. */
+#define FLAG_AS_KERNEL	    (1 << 0)	/**< Kernel address space. */
+#define FLAG_AS_EARLYMALLOC (1 << 1)    /**< Use early malloc */
 
 enum as_area_type {
Index: generic/include/mm/frame.h
===================================================================
--- generic/include/mm/frame.h	(revision 55ab0f1b4eb5fe0181079aea11a8851e2a23d7e5)
+++ generic/include/mm/frame.h	(revision 04225a7c815b6fd94215a9eb21f0112760974230)
@@ -60,5 +60,5 @@
 #define IS_BUDDY_RIGHT_BLOCK_ABS(zone, frame)	(((FRAME_INDEX_ABS((zone), (frame)) >> (frame)->buddy_order) & 0x1) == 1)
 
-#define ZONE_BLACKLIST_SIZE	4
+#define ZONE_BLACKLIST_SIZE	8
 
 struct zone {
Index: generic/src/mm/as.c
===================================================================
--- generic/src/mm/as.c	(revision 55ab0f1b4eb5fe0181079aea11a8851e2a23d7e5)
+++ generic/src/mm/as.c	(revision 04225a7c815b6fd94215a9eb21f0112760974230)
@@ -66,5 +66,5 @@
 {
 	as_arch_init();
-	AS_KERNEL = as_create(FLAG_AS_KERNEL);
+	AS_KERNEL = as_create(FLAG_AS_KERNEL | FLAG_AS_EARLYMALLOC);
         if (!AS_KERNEL)
                 panic("can't create kernel address space\n");
@@ -79,5 +79,8 @@
 	as_t *as;
 
-	as = (as_t *) early_malloc(sizeof(as_t));
+	if (flags & FLAG_AS_EARLYMALLOC)
+		as = (as_t *) early_malloc(sizeof(as_t));
+	else
+		as = (as_t *) malloc(sizeof(as_t));
 	if (as) {
 		list_initialize(&as->as_with_asid_link);
Index: generic/src/mm/slab.c
===================================================================
--- generic/src/mm/slab.c	(revision 55ab0f1b4eb5fe0181079aea11a8851e2a23d7e5)
+++ generic/src/mm/slab.c	(revision 04225a7c815b6fd94215a9eb21f0112760974230)
@@ -756,4 +756,8 @@
 	spinlock_unlock(&slab_cache_lock);
 }
+
+#ifdef CONFIG_DEBUG
+static int _slab_initialized = 0;
+#endif
 
 void slab_cache_init(void)
@@ -789,4 +793,7 @@
 						     NULL,NULL,0);
 	}
+#ifdef CONFIG_DEBUG       
+	_slab_initialized = 1;
+#endif
 }
 
@@ -796,5 +803,6 @@
 {
 	int idx;
-	
+
+	ASSERT(_slab_initialized);
 	ASSERT( size && size <= (1 << SLAB_MAX_MALLOC_W));
 	
Index: kernel.config
===================================================================
--- kernel.config	(revision 55ab0f1b4eb5fe0181079aea11a8851e2a23d7e5)
+++ kernel.config	(revision 04225a7c815b6fd94215a9eb21f0112760974230)
@@ -51,4 +51,7 @@
 ! [(ARCH=ia32|ARCH=amd64)&CONFIG_SMP=y] CONFIG_HT (y/n)
 
+# Simics BIOS AP boot fix
+! [(ARCH=ia32|ARCH=amd64)&CONFIG_SMP=y] CONFIG_SIMICS_FIX (y/n)
+
 # Lazy FPU context switching
 ! [(ARCH=mips32&MIPS_MACHINE!=msim&MIPS_MACHINE!=simics)|ARCH=amd64|ARCH=ia32] CONFIG_FPU_LAZY (y/n)
