Index: kernel/arch/mips32/Makefile.inc
===================================================================
--- kernel/arch/mips32/Makefile.inc	(revision 3c50cddc467c69a1aca1a0b8962eadf05330cf15)
+++ kernel/arch/mips32/Makefile.inc	(revision a522999aad61600265fe2b376c2199fe82b465f9)
@@ -69,5 +69,6 @@
 	arch/$(KARCH)/src/fpu_context.c \
 	arch/$(KARCH)/src/ddi/ddi.c \
-	arch/$(KARCH)/src/smp/smp.c
+	arch/$(KARCH)/src/smp/smp.c \
+	arch/$(KARCH)/src/machine_func.c
 
 ifeq ($(MACHINE),msim)
@@ -76,2 +77,12 @@
 endif
 
+ifeq ($(MACHINE),lmalta)
+        ARCH_SOURCES += arch/$(KARCH)/src/mach/malta/malta.c
+endif
+ifeq ($(MACHINE),bmalta)
+        ARCH_SOURCES += arch/$(KARCH)/src/mach/malta/malta.c
+endif
+ifeq ($(MACHINE),msim)
+        ARCH_SOURCES += arch/$(KARCH)/src/mach/msim/msim.c
+endif
+
Index: kernel/arch/mips32/include/mach/malta/malta.h
===================================================================
--- kernel/arch/mips32/include/mach/malta/malta.h	(revision a522999aad61600265fe2b376c2199fe82b465f9)
+++ kernel/arch/mips32/include/mach/malta/malta.h	(revision a522999aad61600265fe2b376c2199fe82b465f9)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2013 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 mips32 
+ * @{
+ */
+/** @file
+ *  @brief MIPS Malta platform driver.
+ */
+
+#ifndef KERN_mips32_malta_H_
+#define KERN_mips32_malta_H_
+
+#include <arch/machine_func.h>
+
+extern struct mips32_machine_ops malta_machine_ops;
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/mips32/include/mach/msim/msim.h
===================================================================
--- kernel/arch/mips32/include/mach/msim/msim.h	(revision a522999aad61600265fe2b376c2199fe82b465f9)
+++ kernel/arch/mips32/include/mach/msim/msim.h	(revision a522999aad61600265fe2b376c2199fe82b465f9)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2013 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 mips32 
+ * @{
+ */
+/** @file
+ *  @brief msim platform driver.
+ */
+
+#ifndef KERN_mips32_msim_H_
+#define KERN_mips32_msim_H_
+
+#include <arch/machine_func.h>
+
+extern struct mips32_machine_ops msim_machine_ops;
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/mips32/include/machine_func.h
===================================================================
--- kernel/arch/mips32/include/machine_func.h	(revision a522999aad61600265fe2b376c2199fe82b465f9)
+++ kernel/arch/mips32/include/machine_func.h	(revision a522999aad61600265fe2b376c2199fe82b465f9)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2007 Michal Kebrt
+ * Copyright (c) 2009 Vineeth Pillai
+ * Copyrithg (c) 2012 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 mips32
+ * @{
+ */
+/** @file
+ *  @brief Declarations of machine specific functions.
+ *
+ *  These functions allow us to support various kinds of mips32 machines
+ *  in a unified way.
+ */
+
+#ifndef KERN_mips32_MACHINE_FUNC_H_
+#define KERN_mips32_MACHINE_FUNC_H_
+
+#include <typedefs.h>
+
+struct mips32_machine_ops {
+	void (*machine_init)(void);
+	void (*machine_cpu_halt)(void);
+	void (*machine_get_memory_extents)(uintptr_t *, size_t *);
+	void (*machine_frame_init)(void);
+	void (*machine_output_init)(void);
+	void (*machine_input_init)(void);
+	const char *(*machine_get_platform_name)(void);
+};
+
+/** Pointer to mips32_machine_ops structure being used. */
+extern struct mips32_machine_ops *machine_ops;
+
+extern void machine_ops_init(void);
+
+extern void machine_init(void);
+extern void machine_cpu_halt(void);
+extern void machine_get_memory_extents(uintptr_t *, size_t *);
+extern void machine_frame_init(void);
+extern void machine_output_init(void);
+extern void machine_input_init(void);
+extern const char *machine_get_platform_name(void);
+
+#endif
+
+/** @}
+ */
Index: kernel/arch/mips32/src/mach/malta/malta.c
===================================================================
--- kernel/arch/mips32/src/mach/malta/malta.c	(revision a522999aad61600265fe2b376c2199fe82b465f9)
+++ kernel/arch/mips32/src/mach/malta/malta.c	(revision a522999aad61600265fe2b376c2199fe82b465f9)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2013 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 mips32 
+ * @{
+ */
+/** @file
+ *  @brief MIPS Malta platform driver.
+ */
+
+#include <arch/mach/malta/malta.h>
+
+static void malta_init(void);
+static void malta_cpu_halt(void);
+static void malta_get_memory_extents(uintptr_t *, size_t *);
+static void malta_frame_init(void);
+static void malta_output_init(void);
+static void malta_input_init(void);
+static const char *malta_get_platform_name(void);
+
+struct mips32_machine_ops malta_machine_ops = {
+	.machine_init = malta_init,
+	.machine_cpu_halt = malta_cpu_halt,
+	.machine_get_memory_extents = malta_get_memory_extents,
+	.machine_frame_init = malta_frame_init,
+	.machine_output_init = malta_output_init,
+	.machine_input_init = malta_input_init,
+	.machine_get_platform_name = malta_get_platform_name	
+};
+
+void malta_init(void)
+{
+}
+
+void malta_cpu_halt(void)
+{
+}
+
+void malta_get_memory_extents(uintptr_t *start, size_t *size)
+{
+}
+
+void malta_frame_init(void)
+{
+}
+
+void malta_output_init(void)
+{
+}
+
+void malta_input_init(void)
+{
+}
+
+const char *malta_get_platform_name(void)
+{
+	return "malta";
+}
+
+/** @}
+ */
Index: kernel/arch/mips32/src/mach/msim/msim.c
===================================================================
--- kernel/arch/mips32/src/mach/msim/msim.c	(revision a522999aad61600265fe2b376c2199fe82b465f9)
+++ kernel/arch/mips32/src/mach/msim/msim.c	(revision a522999aad61600265fe2b376c2199fe82b465f9)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2013 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 mips32 
+ * @{
+ */
+/** @file
+ *  @brief msim platform driver.
+ */
+
+#include <arch/mach/msim/msim.h>
+
+static void msim_init(void);
+static void msim_cpu_halt(void);
+static void msim_get_memory_extents(uintptr_t *, size_t *);
+static void msim_frame_init(void);
+static void msim_output_init(void);
+static void msim_input_init(void);
+static const char *msim_get_platform_name(void);
+
+struct mips32_machine_ops msim_machine_ops = {
+	.machine_init = msim_init,
+	.machine_cpu_halt = msim_cpu_halt,
+	.machine_get_memory_extents = msim_get_memory_extents,
+	.machine_frame_init = msim_frame_init,
+	.machine_output_init = msim_output_init,
+	.machine_input_init = msim_input_init,
+	.machine_get_platform_name = msim_get_platform_name	
+};
+
+void msim_init(void)
+{
+}
+
+void msim_cpu_halt(void)
+{
+}
+
+void msim_get_memory_extents(uintptr_t *start, size_t *size)
+{
+}
+
+void msim_frame_init(void)
+{
+}
+
+void msim_output_init(void)
+{
+}
+
+void msim_input_init(void)
+{
+}
+
+const char *msim_get_platform_name(void)
+{
+	return "msim";
+}
+
+/** @}
+ */
Index: kernel/arch/mips32/src/machine_func.c
===================================================================
--- kernel/arch/mips32/src/machine_func.c	(revision a522999aad61600265fe2b376c2199fe82b465f9)
+++ kernel/arch/mips32/src/machine_func.c	(revision a522999aad61600265fe2b376c2199fe82b465f9)
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2009 Vineeth Pillai
+ * Copyright (c) 2012 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 mips32
+ * @{
+ */
+/** @file
+ *  @brief Definitions of machine specific functions.
+ *
+ *  These functions allow us to support various kinds of mips32 machines
+ *  in a unified way.
+ */
+
+#include <arch/machine_func.h>
+#if defined(MACHINE_msim)
+#include <arch/mach/msim/msim.h>
+#elif defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
+#include <arch/mach/malta/malta.h>
+#endif
+
+/** Pointer to machine_ops structure being used. */
+struct mips32_machine_ops *machine_ops;
+
+/** Initialize machine_ops pointer. */
+void machine_ops_init(void)
+{
+#if defined(MACHINE_msim)
+	machine_ops = &msim_machine_ops;
+#elif defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
+	machine_ops = &malta_machine_ops;
+#else
+#error Machine type not defined.
+#endif
+}
+
+void machine_init(void)
+{
+	(machine_ops->machine_init)();
+}
+
+
+/** Halts CPU. */
+void machine_cpu_halt(void)
+{
+	(machine_ops->machine_cpu_halt)();
+}
+
+/** Get extents of available memory.
+ *
+ * @param start		Place to store memory start address.
+ * @param size		Place to store memory size.
+ */
+void machine_get_memory_extents(uintptr_t *start, size_t *size)
+{
+	(machine_ops->machine_get_memory_extents)(start, size);
+}
+
+/*
+ * Machine specific frame initialization
+ */
+void machine_frame_init(void)
+{
+	(machine_ops->machine_frame_init)();
+}
+
+/*
+ * configure the output device.
+ */
+void machine_output_init(void)
+{
+	(machine_ops->machine_output_init)();
+}
+
+/*
+ * configure the input device.
+ */
+void machine_input_init(void)
+{
+	(machine_ops->machine_input_init)();
+}
+
+const char *machine_get_platform_name(void)
+{
+	if (machine_ops->machine_get_platform_name)
+		return machine_ops->machine_get_platform_name();
+	return NULL;
+}
+
+/** @}
+ */
