Index: kernel/arch/mips32/src/mips32.c
===================================================================
--- kernel/arch/mips32/src/mips32.c	(revision 2277e03b97a6950736870a381ad825874af27449)
+++ kernel/arch/mips32/src/mips32.c	(revision db71e2af5cdfe169de296e6f39b3e5eda7a966f6)
@@ -41,14 +41,9 @@
 #include <memstr.h>
 #include <userspace.h>
-#include <console/console.h>
 #include <syscall/syscall.h>
 #include <sysinfo/sysinfo.h>
 #include <arch/debug.h>
 #include <arch/debugger.h>
-#include <arch/drivers/msim.h>
-#include <genarch/fb/fb.h>
-#include <genarch/drivers/dsrln/dsrlnin.h>
-#include <genarch/drivers/dsrln/dsrlnout.h>
-#include <genarch/srln/srln.h>
+#include <arch/machine_func.h>
 
 /* Size of the code jumping to the exception handler code
@@ -70,4 +65,8 @@
 
 size_t cpu_count = 0;
+
+#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
+size_t sdram_size = 0;
+#endif
 
 /** Performs mips32-specific initialization before main_bsp() is called. */
@@ -88,4 +87,11 @@
 			cpu_count++;
 	}
+
+#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
+	sdram_size = bootinfo->sdram_size;
+#endif
+
+	/* Initialize machine_ops pointer. */
+	machine_ops_init();
 }
 
@@ -124,26 +130,7 @@
 {
 	interrupt_init();
-	
-#ifdef CONFIG_FB
-	/* GXemul framebuffer */
-	fb_properties_t gxemul_prop = {
-		.addr = 0x12000000,
-		.offset = 0,
-		.x = 640,
-		.y = 480,
-		.scan = 1920,
-		.visual = VISUAL_RGB_8_8_8,
-	};
-	
-	outdev_t *fbdev = fb_init(&gxemul_prop);
-	if (fbdev)
-		stdout_wire(fbdev);
-#endif
-
-#ifdef CONFIG_MIPS_PRN
-	outdev_t *dsrlndev = dsrlnout_init((ioport8_t *) MSIM_KBD_ADDRESS);
-	if (dsrlndev)
-		stdout_wire(dsrlndev);
-#endif
+
+	machine_init();
+	machine_output_init();
 }
 
@@ -158,45 +145,10 @@
 void arch_post_smp_init(void)
 {
-	static const char *platform;
-
 	/* Set platform name. */
-#ifdef MACHINE_msim
-	platform = "msim";
-#endif
-#ifdef MACHINE_bgxemul
-	platform = "gxemul";
-#endif
-#ifdef MACHINE_lgxemul
-	platform = "gxemul";
-#endif
-	sysinfo_set_item_data("platform", NULL, (void *) platform,
-	    str_size(platform));
-
-#ifdef CONFIG_MIPS_KBD
-	/*
-	 * Initialize the msim/GXemul keyboard port. Then initialize the serial line
-	 * module and connect it to the msim/GXemul keyboard. Enable keyboard interrupts.
-	 */
-	dsrlnin_instance_t *dsrlnin_instance
-	    = dsrlnin_init((dsrlnin_t *) MSIM_KBD_ADDRESS, MSIM_KBD_IRQ);
-	if (dsrlnin_instance) {
-		srln_instance_t *srln_instance = srln_init();
-		if (srln_instance) {
-			indev_t *sink = stdin_wire();
-			indev_t *srln = srln_wire(srln_instance, sink);
-			dsrlnin_wire(dsrlnin_instance, srln);
-			cp0_unmask_int(MSIM_KBD_IRQ);
-		}
-	}
-	
-	/*
-	 * This is the necessary evil until the userspace driver is entirely
-	 * self-sufficient.
-	 */
-	sysinfo_set_item_val("kbd", NULL, true);
-	sysinfo_set_item_val("kbd.inr", NULL, MSIM_KBD_IRQ);
-	sysinfo_set_item_val("kbd.address.physical", NULL,
-	    PA2KA(MSIM_KBD_ADDRESS));
-#endif
+	sysinfo_set_item_data("platform", NULL,
+	    (void *) machine_get_platform_name(),
+	    str_size(machine_get_platform_name()));
+
+	machine_input_init();
 }
 
