Index: arch/amd64/Makefile.inc
===================================================================
--- arch/amd64/Makefile.inc	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/amd64/Makefile.inc	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -32,4 +32,5 @@
 BFD_NAME = elf64-x86-64
 BFD_ARCH = i386:x86-64
+BFD = binary
 TARGET = amd64-linux-gnu
 TOOLCHAIN_DIR = /usr/local/amd64/bin
Index: arch/amd64/_link.ld.in
===================================================================
--- arch/amd64/_link.ld.in	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/amd64/_link.ld.in	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -13,5 +13,5 @@
 #include <arch/mm/page.h>
 
-OUTPUT_FORMAT(binary)
+OUTPUT_FORMAT(BFD)
 ENTRY(kernel_image_start)
 
Index: arch/amd64/boot/Makefile
===================================================================
--- arch/amd64/boot/Makefile	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/amd64/boot/Makefile	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -1,19 +1,17 @@
-.PHONY: nothing build clean
-
-nothing:
+.PHONY: build clean
 
 build: boot.bin
 	dd if=boot.bin of=../../../image.bin bs=512 conv=sync
-	-cat ../../../kernel.bin >>../../../image.bin
+	-cat ../../../kernel.bin >> ../../../image.bin
 	dd if=/dev/zero of=../../../image.bin bs=1 seek=1474559 count=1
 
 boot.bin: boot.o
-	ld -T boot.ld -entry _start_0x7c00 --oformat binary boot.o -o $@
+	$(LD) -T boot.ld -entry _start_0x7c00 --oformat binary boot.o -o $@
 
 boot.o: boot.S
-	gcc -E -DKERNEL_SIZE=$(KERNEL_SIZE) boot.S >boot.s
-	as boot.s -o $@
+	$(CC) -E -DKERNEL_SIZE=$(KERNEL_SIZE) boot.S > boot.s
+	$(AS) boot.s -o $@
 	rm boot.s
 
 clean:
-	-rm *.o *.bin
+	-rm -f boot.o boot.bin ../../../image.bin
Index: arch/amd64/include/atomic.h
===================================================================
--- arch/amd64/include/atomic.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/atomic.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/atomic.h
Index: arch/amd64/include/barrier.h
===================================================================
--- arch/amd64/include/barrier.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/barrier.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/barrier.h
Index: arch/amd64/include/bios
===================================================================
--- arch/amd64/include/bios	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/bios	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/bios
Index: arch/amd64/include/boot/memmap.h
===================================================================
--- arch/amd64/include/boot/memmap.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/boot/memmap.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/boot/memmap.h
Index: arch/amd64/include/boot/memmapasm.h
===================================================================
--- arch/amd64/include/boot/memmapasm.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/boot/memmapasm.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/boot/memmapasm.h
Index: arch/amd64/include/context_offset.h
===================================================================
--- arch/amd64/include/context_offset.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/context_offset.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,10 @@
+/* This file is automatically generated by gencontext.c. */
+#define OFFSET_SP  0x0
+#define OFFSET_PC  0x8
+#define OFFSET_RBX 0x10
+#define OFFSET_RBP 0x18
+#define OFFSET_R12 0x20
+#define OFFSET_R13 0x28
+#define OFFSET_R14 0x30
+#define OFFSET_R15 0x38
+#define OFFSET_IPL 0x40
Index: arch/amd64/include/ega.h
===================================================================
--- arch/amd64/include/ega.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/ega.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/ega.h
Index: arch/amd64/include/fpu_context.h
===================================================================
--- arch/amd64/include/fpu_context.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/fpu_context.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/fpu_context.h
Index: arch/amd64/include/i8042.h
===================================================================
--- arch/amd64/include/i8042.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/i8042.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/i8042.h
Index: arch/amd64/include/i8254.h
===================================================================
--- arch/amd64/include/i8254.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/i8254.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/i8254.h
Index: arch/amd64/include/i8259.h
===================================================================
--- arch/amd64/include/i8259.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/i8259.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/i8259.h
Index: arch/amd64/include/interrupt.h
===================================================================
--- arch/amd64/include/interrupt.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/interrupt.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/interrupt.h
Index: arch/amd64/include/mm/memory_init.h
===================================================================
--- arch/amd64/include/mm/memory_init.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/mm/memory_init.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/mm/memory_init.h
Index: arch/amd64/include/smp
===================================================================
--- arch/amd64/include/smp	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/include/smp	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/include/smp
Index: arch/amd64/src/bios
===================================================================
--- arch/amd64/src/bios	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/src/bios	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/src/bios
Index: arch/amd64/src/boot/memmap.S
===================================================================
--- arch/amd64/src/boot/memmap.S	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/src/boot/memmap.S	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/src/boot/memmap.S
Index: arch/amd64/src/drivers
===================================================================
--- arch/amd64/src/drivers	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/src/drivers	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/src/drivers
Index: arch/amd64/src/fmath.c
===================================================================
--- arch/amd64/src/fmath.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/src/fmath.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/src/fmath.c
Index: arch/amd64/src/mm/frame.c
===================================================================
--- arch/amd64/src/mm/frame.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/src/mm/frame.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/src/mm/frame.c
Index: arch/amd64/src/mm/memory_init.c
===================================================================
--- arch/amd64/src/mm/memory_init.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/src/mm/memory_init.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/src/mm/memory_init.c
Index: arch/amd64/src/mm/tlb.c
===================================================================
--- arch/amd64/src/mm/tlb.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/src/mm/tlb.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/src/mm/tlb.c
Index: arch/amd64/src/smp/apic.c
===================================================================
--- arch/amd64/src/smp/apic.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/src/smp/apic.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/src/smp/apic.c
Index: arch/amd64/src/smp/ipi.c
===================================================================
--- arch/amd64/src/smp/ipi.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/src/smp/ipi.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/src/smp/ipi.c
Index: arch/amd64/src/smp/mps.c
===================================================================
--- arch/amd64/src/smp/mps.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/src/smp/mps.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/src/smp/mps.c
Index: arch/amd64/src/smp/smp.c
===================================================================
--- arch/amd64/src/smp/smp.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/amd64/src/smp/smp.c	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,1 @@
+/home/martin/HelenOS/SPARTAN/arch/ia32/src/smp/smp.c
Index: arch/ia32/Makefile.inc
===================================================================
--- arch/ia32/Makefile.inc	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/ia32/Makefile.inc	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -32,4 +32,5 @@
 BFD_NAME = elf32-i386
 BFD_ARCH = i386
+BFD = binary
 TARGET = i686-pc-linux-gnu
 TOOLCHAIN_DIR = /usr/local/i686/bin
@@ -47,5 +48,5 @@
 ifeq ($(CPU),athlon-xp)
 	CFLAGS += -march=athlon-xp -mmmx -msse -m3dnow
-	DEFS += -DFENCES=486
+	DEFS += -DFENCES=p3
 	CONFIG_SMP = n
 	CONFIG_HT = n
@@ -53,12 +54,18 @@
 ifeq ($(CPU),athlon-mp)
 	CFLAGS += -march=athlon-mp -mmmx -msse -m3dnow
-	DEFS += -DFENCES=486
+	DEFS += -DFENCES=p3
+	CONFIG_HT = n
 endif
 ifeq ($(CPU),pentium3)
-	CFLAGS += -march=pentium3 -mmmx -msse -msse2
-	DEFS += -DFENCES=486
+	CFLAGS += -march=pentium3 -mmmx -msse
+	DEFS += -DFENCES=p3
+	CONFIG_HT = n
+endif
+ifeq ($(CPU),prescott)
+	CFLAGS += -march=pentium4 -mfpmath=sse -mmmx -msse -msse2 -msse3
+	DEFS += -DFENCES=p4
 endif
 ifeq ($(CPU),pentium4)
-	CFLAGS += -march=pentium4 -mfpmath=sse -mmmx -msse -msse2 -msse3
+	CFLAGS += -march=pentium4 -mfpmath=sse -mmmx -msse -msse2
 	DEFS += -DFENCES=p4
 endif
Index: arch/ia32/_link.ld.in
===================================================================
--- arch/ia32/_link.ld.in	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/ia32/_link.ld.in	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -13,5 +13,5 @@
 #include <arch/mm/page.h>
 
-OUTPUT_FORMAT(binary)
+OUTPUT_FORMAT(BFD)
 ENTRY(kernel_image_start)
 
Index: arch/ia32/include/barrier.h
===================================================================
--- arch/ia32/include/barrier.h	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/ia32/include/barrier.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -44,16 +44,14 @@
 #define CS_LEAVE_BARRIER()	__asm__ volatile ("" ::: "memory")
 
-#ifdef __STRONG_ORDERING__
-
-#define memory_barrier()
-#define read_barrier()
-#define write_barrier()
-
+#if (FENCES == p4)
+#	define memory_barrier()	__asm__ volatile ("mfence\n" ::: "memory")
+#	define read_barrier()		__asm__ volatile ("sfence\n" ::: "memory")
+#	define write_barrier()		__asm__ volatile ("lfence\n" ::: "memory")
+#elif (FENCES == p3)
+#	define memory_barrier()	__asm__ volatile ("xchgl %%eax,%%eax\n" ::: "memory")
+#	define read_barrier()		__asm__ volatile ("sfence\n" ::: "memory")
+#	define write_barrier()		__asm__ volatile ("xchgl %%eax,%%eax\n" ::: "memory")
 #else
-
-#define memory_barrier()	__asm__ volatile ("mfence\n" ::: "memory")
-#define read_barrier()		__asm__ volatile ("sfence\n" ::: "memory")
-#define write_barrier()		__asm__ volatile ("lfence\n" ::: "memory")
-
+#	error Unsupported FENCES value
 #endif
 
Index: arch/ia64/Makefile.inc
===================================================================
--- arch/ia64/Makefile.inc	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/ia64/Makefile.inc	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -32,4 +32,5 @@
 BFD_NAME = elf64-little
 BFD_ARCH = ia64-elf64
+BFD = elf64-ia64-little
 TARGET = ia64-pc-linux-gnu
 TOOLCHAIN_DIR = /usr/local/ia64/bin
Index: arch/ia64/_link.ld.in
===================================================================
--- arch/ia64/_link.ld.in	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/ia64/_link.ld.in	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -9,5 +9,5 @@
 #define __ASM__
 
-OUTPUT_FORMAT(elf64-ia64-little)
+OUTPUT_FORMAT(BFD)
 ENTRY(kernel_image_start)
 
Index: arch/mips32/Makefile.inc
===================================================================
--- arch/mips32/Makefile.inc	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/mips32/Makefile.inc	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -30,5 +30,4 @@
 #
 
-BFD_NAME = elf32-i386
 BFD_ARCH = mips
 TARGET = mipsel-linux-gnu
@@ -38,28 +37,59 @@
 #
 
-ifndef CPU
-	CPU = pentium4
+ifndef MACHINE
+	MACHINE = msim
 endif
 
-## Accepted CPUs
+KERNEL_LOAD_ADDRESS = 0x80100000
+CFLAGS += -mno-abicalls -G 0 -fno-zero-initialized-in-bss
+DEFS += -DMACHINE=${MACHINE} -DKERNEL_LOAD_ADDRESS=${KERNEL_LOAD_ADDRESS}
+
+## Accepted MACHINEs
 #
 
-ifeq ($(CPU),athlon-xp)
-	CFLAGS += -march=athlon-xp -mmmx -msse -m3dnow
-	DEFS += -DFENCES=486
-	CONFIG_SMP = n
-	CONFIG_HT = n
+ifeq ($(MACHINE),indy)
+	# GCC 4.0.1 compiled for mipsEL has problems compiling in 
+	# BigEndian mode with the swl/swr/lwl/lwr instructions.
+	# We have to compile it with mips-sgi-irix5 to get it right.
+	
+	BFD_NAME = elf32-bigmips
+	BFD = ecoff-bigmips
+	TARGET = mips-sgi-irix5
+	TOOLCHAIN_DIR = /usr/local/mips/bin
+	KERNEL_LOAD_ADDRESS = 0x88002000
+	CFLAGS += -EB -DBIG_ENDIAN -DHAVE_FPU -march=r4600
 endif
-ifeq ($(CPU),athlon-mp)
-	CFLAGS += -march=athlon-mp -mmmx -msse -m3dnow
-	DEFS += -DFENCES=486
+ifeq ($(MACHINE}),lgxemul)
+	BFD_NAME=elf32-tradlittlemips
+	BFD = ecoff-littlemips
+	CFLAGS += -DHAVE_FPU -mips3
 endif
-ifeq ($(CPU),pentium3)
-	CFLAGS += -march=pentium3 -mmmx -msse -msse2
-	DEFS += -DFENCES=486
+ifeq ($(MACHINE),bgxemul)
+	BFD_NAME=elf32-bigmips
+	BFD = ecoff-bigmips
+	TARGET = mips-sgi-irix5
+	TOOLCHAIN_DIR = /usr/local/mips/bin
+	CFLAGS += -EB -DBIG_ENDIAN -DHAVE_FPU -mips3
 endif
-ifeq ($(CPU),pentium4)
-	CFLAGS += -march=pentium4 -mfpmath=sse -mmmx -msse -msse2 -msse3
-	DEFS += -DFENCES=p4
+ifeq ($(MACHINE),msim4kc)
+	# MSIM needs lwl/swl patch & 4kc instruction patch to work
+	# otherwise add -mmemcpy -mips3
+	
+	BFD_NAME = elf32-tradlittlemips
+	BFD = binary
+	CFLAGS += -mhard-float -march=4kc 
+endif
+ifeq ($(MACHINE),simics)
+	# SIMICS 4kc emulation is broken, although for instructions
+	# that do not bother us
+	
+	BFD_NAME = elf32-tradlittlemips
+	BFD = elf32-tradlittlemips
+	CFLAGS += -mhard-float -mips3
+endif
+ifeq ($(MACHINE),msim)
+	BFD_NAME = elf32-tradlittlemips
+	BFD = binary
+	CFLAGS += -mhard-float -mips3
 endif
 
@@ -67,15 +97,9 @@
 #
 
-CONFIG_ACPI = y
+CONFIG_OFW = y
 
 ## Accepted configuration directives
 #
 
-ifeq ($(CONFIG_SMP),y)
-	DEFS += -DSMP
-endif
-ifeq ($(CONFIG_HT),y)
-	DEFS += -DHT
-endif
 ifeq ($(CONFIG_FPU_LAZY),y)
 	DEFS += -DFPU_LAZY
@@ -83,131 +107,21 @@
 
 ARCH_SOURCES = \
-	arch/$(ARCH)/src/context.s \
-	arch/$(ARCH)/src/debug/panic.s \
-	arch/$(ARCH)/src/delay.s \
+	arch/$(ARCH)/src/start.S \
+	arch/$(ARCH)/src/context.S \
+	arch/$(ARCH)/src/panic.S \
+	arch/$(ARCH)/src/mips32.c \
+	arch/$(ARCH)/src/dummy.S \
+	arch/$(ARCH)/src/console.c \
 	arch/$(ARCH)/src/asm.S \
-	arch/$(ARCH)/src/proc/scheduler.c \
-	arch/$(ARCH)/src/bios/bios.c \
-	arch/$(ARCH)/src/smp/ap.S \
-	arch/$(ARCH)/src/smp/apic.c \
-	arch/$(ARCH)/src/smp/mps.c \
-	arch/$(ARCH)/src/smp/smp.c \
-	arch/$(ARCH)/src/atomic.S \
-	arch/$(ARCH)/src/smp/ipi.c \
-	arch/$(ARCH)/src/ia32.c \
+	arch/$(ARCH)/src/exception.c \
 	arch/$(ARCH)/src/interrupt.c \
-	arch/$(ARCH)/src/pm.c \
-	arch/$(ARCH)/src/userspace.c \
+	arch/$(ARCH)/src/cache.c \
 	arch/$(ARCH)/src/cpu/cpu.c \
+	arch/$(ARCH)/src/mm/asid.c \
 	arch/$(ARCH)/src/mm/frame.c \
-	arch/$(ARCH)/src/mm/memory_init.c \
 	arch/$(ARCH)/src/mm/page.c \
 	arch/$(ARCH)/src/mm/tlb.c \
-	arch/$(ARCH)/src/drivers/i8042.c \
-	arch/$(ARCH)/src/drivers/i8254.c \
-	arch/$(ARCH)/src/drivers/i8259.c \
-	arch/$(ARCH)/src/drivers/ega.c \
-	arch/$(ARCH)/src/boot/boot.S \
-	arch/$(ARCH)/src/boot/memmap.S \
-	arch/$(ARCH)/src/fpu_context.c\
-	arch/$(ARCH)/src/fmath.c
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-DEFS= -DMACHINE=${MACHINE} -DKERNEL_LOAD_ADDRESS=${KERNEL_LOAD_ADDRESS}
-CFLAGS=-mno-abicalls -G 0 -nostdlib -fno-builtin -O2  -fno-zero-initialized-in-bss
-LFLAGS=
-
-# GCC 4.0.1 compiled for mipsEL has problems compiling in 
-# BigEndian mode with the swl/swr/lwl/lwr instructions.
-# We have to compile it with mips-sgi-irix5 to get it right.
-ifeq (${MACHINE},indy)
- MIPS_TARGET=mips-sgi-irix5
- MIPS_CC_DIR=/usr/local/mips/bin
- MIPS_BINUTILS_DIR=/usr/local/mips/bin
-
- CFLAGS += -EB -DBIG_ENDIAN -DHAVE_FPU -DFPU_LAZY -march=r4600
- BFD = ecoff-bigmips
- KERNEL_LOAD_ADDRESS = 0x88002000
- BFD_NAME=elf32-bigmips
-endif
-
-ifeq (${MACHINE},lgxemul)
- CFLAGS += -DHAVE_FPU -DFPU_LAZY -mips3
- BFD = ecoff-littlemips
- KERNEL_LOAD_ADDRESS = 0x80100000
- BFD_NAME=elf32-tradlittlemips
-endif
-
-ifeq (${MACHINE},bgxemul)
- MIPS_TARGET=mips-sgi-irix5
- MIPS_CC_DIR=/usr/local/mips/bin
- MIPS_BINUTILS_DIR=/usr/local/mips/bin
-
- CFLAGS += -EB -DBIG_ENDIAN -DHAVE_FPU -DFPU_LAZY -mips3
- BFD = ecoff-bigmips
- KERNEL_LOAD_ADDRESS = 0x80100000
- BFD_NAME=elf32-bigmips
-endif
-
-# MSIM needs lwl/swl patch & 4kc instruction patch to work
-# otherwise add -mmemcpy -mips3
-ifeq (${MACHINE},msim4kc)
- BFD = binary
- CFLAGS += -mhard-float -march=4kc 
- KERNEL_LOAD_ADDRESS = 0x80100000
- BFD_NAME=elf32-tradlittlemips
-endif
-
-ifeq (${MACHINE},msim)
- BFD = binary
- CFLAGS += -mhard-float -mips3
- KERNEL_LOAD_ADDRESS = 0x80100000
- BFD_NAME=elf32-tradlittlemips
-endif
-
-# SIMICS 4kc emulation is broken, although for instructions
-# that do not bother us
-ifeq (${MACHINE},simics)
- BFD = elf32-tradlittlemips
- CFLAGS += -mhard-float -mips3
- KERNEL_LOAD_ADDRESS = 0x80100000
- BFD_NAME=elf32-tradlittlemips
-endif
-
-arch/$(ARCH)/_link.ld: arch/$(ARCH)/_link.ld.in
-	$(CC) $(CFLAGS) -C -DBFD=${BFD} -E -x c $< | grep -v "^\#" > $@
-
-arch_sources= \
-	generic/src/arch/start.S \
-	generic/src/arch/context.S \
-	generic/src/arch/panic.S \
-	generic/src/arch/mips32.c \
-	generic/src/arch/dummy.S \
-	generic/src/arch/console.c \
-	generic/src/arch/asm.S \
-	generic/src/arch/exception.c \
-	generic/src/arch/interrupt.c \
-	generic/src/arch/cache.c \
-	generic/src/arch/cpu/cpu.c \
-	generic/src/arch/mm/asid.c \
-	generic/src/arch/mm/frame.c \
-	generic/src/arch/mm/page.c \
-	generic/src/arch/mm/tlb.c \
-	generic/src/arch/mm/vm.c \
-	generic/src/arch/fpu_context.c \
-	generic/src/arch/fmath.c \
-	generic/src/arch/drivers/arc.c
+	arch/$(ARCH)/src/mm/vm.c \
+	arch/$(ARCH)/src/fpu_context.c \
+	arch/$(ARCH)/src/fmath.c \
+	arch/$(ARCH)/src/drivers/arc.c
Index: arch/mips32/_link.ld.in
===================================================================
--- arch/mips32/_link.ld.in	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/mips32/_link.ld.in	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -10,5 +10,4 @@
 
 OUTPUT_FORMAT(BFD)
-
 OUTPUT_ARCH(mips)
 
Index: arch/mips32/boot/Makefile
===================================================================
--- arch/mips32/boot/Makefile	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/mips32/boot/Makefile	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -1,26 +1,15 @@
-MIPS_BINUTILS_DIR=/usr/local/mipsel/bin
-MIPS_TARGET=mipsel-linux-gnu
+.PHONY: build clean
 
-.PHONY: nothing build
-
-nothing:
+CFLAGS = -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -mips3 -I../include
 
 build: boot.bin
 	cp boot.bin ../../../load.bin
 
-AS=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-as
-CC=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-gcc
-LD=$(MIPS_BINUTILS_DIR)/$(MIPS_TARGET)-ld
+boot.bin: boot.o
+	$(LD) -e start -T _link.ld boot.o -o $@
 
-AFLAGS=-mips2 -I../../../generic/include
-LFLAGS=--oformat=binary -e start -T _link.ld 
-
-.S.o:
-	$(CC) $(ASFLAGS) -c -o $@ $<
-
-boot.bin: boot.o
-	$(LD) $(LFLAGS) $< -o $@
-
+boot.o: boot.S
+	$(CC) $(CFLAGS) -c boot.S -o $@
 
 clean:
-	-rm *.o *.bin
+	-rm -f boot.o boot.bin ../../../load.bin
Index: arch/mips32/boot/boot.S
===================================================================
--- arch/mips32/boot/boot.S	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/mips32/boot/boot.S	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -33,9 +33,5 @@
 .set nomacro
 
-#include <arch/asm/boot.h>
-
-#ifndef KERNEL_LOAD_ADDRESS
-# define KERNEL_LOAD_ADDRESS 0x80100000
-#endif
+#define KERNEL_LOAD_ADDRESS 0x80100000
 	
 .global start
Index: arch/mips32/include/context_offset.h
===================================================================
--- arch/mips32/include/context_offset.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
+++ arch/mips32/include/context_offset.h	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -0,0 +1,51 @@
+/* This file is automatically generated by gencontext.c. */
+/* struct context */
+#define OFFSET_SP  0x0
+#define OFFSET_PC  0x4
+#define OFFSET_S0  0x8
+#define OFFSET_S1  0xc
+#define OFFSET_S2  0x10
+#define OFFSET_S3  0x14
+#define OFFSET_S4  0x18
+#define OFFSET_S5  0x1c
+#define OFFSET_S6  0x20
+#define OFFSET_S7  0x24
+#define OFFSET_S8  0x28
+#define OFFSET_GP  0x2c
+
+
+/* struct register_dump */
+#define EOFFSET_AT  0x0
+#define EOFFSET_V0  0x4
+#define EOFFSET_V1  0x8
+#define EOFFSET_A0  0xc
+#define EOFFSET_A1  0x10
+#define EOFFSET_A2  0x14
+#define EOFFSET_A3  0x18
+#define EOFFSET_T0  0x1c
+#define EOFFSET_T1  0x20
+#define EOFFSET_T2  0x24
+#define EOFFSET_T3  0x28
+#define EOFFSET_T4  0x2c
+#define EOFFSET_T5  0x30
+#define EOFFSET_T6  0x34
+#define EOFFSET_T7  0x38
+#define EOFFSET_S0  0x3c
+#define EOFFSET_S1  0x40
+#define EOFFSET_S2  0x44
+#define EOFFSET_S3  0x48
+#define EOFFSET_S4  0x4c
+#define EOFFSET_S5  0x50
+#define EOFFSET_S6  0x54
+#define EOFFSET_S7  0x58
+#define EOFFSET_T8  0x5c
+#define EOFFSET_T9  0x60
+#define EOFFSET_GP  0x64
+#define EOFFSET_SP  0x68
+#define EOFFSET_S8  0x6c
+#define EOFFSET_RA  0x70
+#define EOFFSET_LO  0x74
+#define EOFFSET_HI  0x78
+#define EOFFSET_STATUS  0x7c
+#define EOFFSET_EPC  0x80
+#define REGISTER_SPACE  132
Index: arch/ppc32/Makefile.inc
===================================================================
--- arch/ppc32/Makefile.inc	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/ppc32/Makefile.inc	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -32,4 +32,5 @@
 BFD_NAME = elf32-powerpc
 BFD_ARCH = powerpc
+BFD = elf32-powerpc
 TARGET = ppc-linux-gnu
 TOOLCHAIN_DIR = /usr/local/ppc/bin
Index: arch/ppc32/_link.ld.in
===================================================================
--- arch/ppc32/_link.ld.in	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/ppc32/_link.ld.in	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -9,5 +9,5 @@
 #define __ASM__
 
-OUTPUT_FORMAT("elf32-powerpc")
+OUTPUT_FORMAT(BFD)
 ENTRY(kernel_image_start)
 
Index: arch/sparc64/Makefile.inc
===================================================================
--- arch/sparc64/Makefile.inc	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/sparc64/Makefile.inc	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -32,4 +32,5 @@
 BFD_NAME = elf64-sparc
 BFD_ARCH = sparc
+BFD = elf64-sparc
 TARGET = sparc64-linux-gnu
 TOOLCHAIN_DIR = /usr/local/sparc64/bin
Index: arch/sparc64/_link.ld.in
===================================================================
--- arch/sparc64/_link.ld.in	(revision 5b65205897d69d823ac65ebf5d57fcb16bc00820)
+++ arch/sparc64/_link.ld.in	(revision 389f41e06a14f0aba9a75b27009ea4d49471a04d)
@@ -9,5 +9,5 @@
 #define __ASM__
 
-OUTPUT_FORMAT("elf64-sparc")
+OUTPUT_FORMAT(BFD)
 ENTRY(kernel_image_start)
 
