Index: Makefile
===================================================================
--- Makefile	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ Makefile	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -61,7 +61,7 @@
 CROSS_PATH = $(shell dirname "$(CC)")
 
-.PHONY: all precheck cscope cscope_parts autotool config_auto config_default config distclean clean check releasefile release common boot kernel uspace export-posix space
+.PHONY: all precheck cscope cscope_parts autotool config_default config distclean clean check releasefile release common export-posix space
 
-all: kernel uspace export-cross test-xcw
+all: common export-cross test-xcw
 	$(MAKE) -r -C boot PRECHECK=$(PRECHECK)
 
@@ -70,13 +70,8 @@
 
 common: $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(ERRNO_HEADER) build/build.ninja
-
-kernel: common
-	$(MAKE) -r -C kernel PRECHECK=$(PRECHECK)
-
-uspace: common
 	PATH="$(CROSS_PATH):$$PATH" ninja -C build
 	PATH="$(CROSS_PATH):$$PATH" DESTDIR="$$PWD/dist" meson install --no-rebuild --only-changed -C build > build/install.log
 
-test-xcw: uspace export-cross
+test-xcw: common export-cross
 ifeq ($(CONFIG_DEVEL_FILES),y)
 	export PATH=$$PATH:$(abspath tools/xcw/bin) && $(MAKE) -r -C tools/xcw/demo
Index: boot/Makefile.common
===================================================================
--- boot/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ boot/Makefile.common	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -43,5 +43,4 @@
 -include $(CONFIG_MAKEFILE)
 
-KERNEL_PATH = $(ROOT_PATH)/kernel
 USPACE_PATH = $(ROOT_PATH)/uspace
 DIST_PATH = $(ROOT_PATH)/dist
@@ -225,5 +224,5 @@
 
 COMPONENTS = \
-	$(KERNEL_PATH)/kernel.elf \
+	$(DIST_PATH)/boot/kernel.elf \
 	$(addprefix $(DIST_PATH)/,$(INIT_TASKS)) \
 	$(INITRD).img
Index: rnel/Makefile
===================================================================
--- kernel/Makefile	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,393 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-## Configuration
-#
-
-ROOT_PATH = ..
-
-VERSION_DEF = $(ROOT_PATH)/version
-
-COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
-COMMON_HEADER_ARCH = arch/$(KARCH)/include/arch/common.h
-
-CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
-CONFIG_HEADER = $(ROOT_PATH)/config.h
-
--include $(VERSION_DEF)
--include $(COMMON_MAKEFILE)
--include $(CONFIG_MAKEFILE)
-
-## Common names
-#
-
-AUTOCHECK = $(realpath $(ROOT_PATH)/tools/autocheck.awk)
-KERNEL = kernel.elf
-MAP = kernel.map
-JOB = kernel.job
-MAP_PREV = $(MAP).prev
-DISASM = kernel.disasm
-DUMP = kernel.dump
-REAL_MAP = generic/src/debug/real_map
-
-GENMAP = tools/genmap.py
-
-LINK = arch/$(KARCH)/_link.ld
-EMPTY_MAP = generic/src/debug/empty_map.o
-SIZEOK_MAP = generic/src/debug/sizeok_map.o
-
-ifeq ($(PRECHECK),y)
-	JOBFILE = $(ROOT_PATH)/tools/jobfile.py
-	# NOTE: You must not change the order of arguments.
-	CC_JOB = $(JOBFILE) $(JOB) $(CC) $< -o $@
-else
-	CC_JOB = $(CC) $< -o $@
-endif
-
-.PHONY: all clean autogen_clean depend
-.DELETE_ON_ERROR:
-
-all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(KERNEL) $(DISASM)
-
-clean: autogen_clean
-	rm -f $(KERNEL) $(MAP) $(JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* arch/*/_link.ld arch/*/include/arch/common.h
-	find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm '{}' \;
-	find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.d' -follow -exec rm '{}' \;
-
-## Common compiler flags
-#
-
-INCLUDES = generic/include genarch/include arch/$(KARCH)/include ../abi/arch/$(KARCH)/include ../abi/include
-INCLUDES_FLAGS = $(addprefix -I,$(INCLUDES))
-
-DEFS = -D_HELENOS_SOURCE -DKERNEL -DRELEASE=$(RELEASE) "-DCOPYRIGHT=$(COPYRIGHT)" "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
-
-COMMON_CFLAGS = $(INCLUDES_FLAGS) -O$(OPTIMIZATION) -imacros $(CONFIG_HEADER) \
-	-ffreestanding -nostdlib \
-	-fexec-charset=UTF-8 -finput-charset=UTF-8 -fno-common \
-	-fdebug-prefix-map=$(realpath $(ROOT_PATH))=. \
-	-Wa,--fatal-warnings
-
-GCC_CFLAGS = -std=gnu11 -Wall -Wextra -Wno-unused-parameter \
-	-Wmissing-prototypes -Werror-implicit-function-declaration \
-	-Wwrite-strings -pipe -Wno-cast-function-type
-
-CLANG_CFLAGS = -std=gnu11 -Wall -Wextra -Wno-unused-parameter \
-	-Wno-missing-field-initializers -Wno-unused-command-line-argument \
-	-Wmissing-prototypes -Werror-implicit-function-declaration \
-	-Wwrite-strings -pipe -fno-stack-protector -fno-PIC \
-	-mllvm -asm-macro-max-nesting-depth=1000
-
-ifeq ($(CONFIG_DEBUG),y)
-	COMMON_CFLAGS += -Werror
-endif
-
-ifeq ($(CONFIG_UBSAN_KERNEL),y)
-	COMMON_CFLAGS += -fsanitize=undefined
-endif
-
-ifeq ($(CONFIG_LTO),y)
-	COMMON_CFLAGS += -flto
-endif
-
-ifeq ($(CONFIG_LINE_DEBUG),y)
-	COMMON_CFLAGS += -g
-endif
-
-LDFLAGS += -Wl,-n -T $(LINK) -Wl,-M,--fatal-warnings,--warn-common
-
-ifeq ($(CONFIG_STRIP_BINARIES),y)
-	LDFLAGS += -s
-endif
-
--include arch/$(KARCH)/Makefile.inc
--include genarch/Makefile.inc
-
-## The at-sign
-#
-# The $(ATSIGN) variable holds the ASCII character representing the at-sign
-# ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that
-# don't use '@' for starting a comment, $(ATSIGN) is merely '@'. However, on
-# those that do use it for starting a comment (e.g. arm32), $(ATSIGN) must be
-# defined as the percentile-sign ('%') in the architecture-dependent
-# Makefile.inc.
-#
-
-ATSIGN ?= @
-
-## Cross-platform assembly to start a symtab.data section
-#
-
-SYMTAB_SECTION = .section symtab.data, \"a\", $(ATSIGN)progbits;
-
-## Compilation options
-#
-
-ifeq ($(COMPILER),clang)
-	CFLAGS = $(COMMON_CFLAGS) $(CLANG_CFLAGS)
-else
-	CFLAGS = $(COMMON_CFLAGS) $(GCC_CFLAGS)
-endif
-
-INSTRUMENTATION = -finstrument-functions
-
-## Generic kernel sources
-#
-
-GENERIC_SOURCES = \
-	generic/src/adt/bitmap.c \
-	generic/src/adt/hash_table.c \
-	generic/src/adt/list.c \
-	generic/src/adt/odict.c \
-	generic/src/console/chardev.c \
-	generic/src/console/console.c \
-	generic/src/console/prompt.c \
-	generic/src/cpu/cpu.c \
-	generic/src/cpu/cpu_mask.c \
-	generic/src/ddi/ddi.c \
-	generic/src/ddi/irq.c \
-	generic/src/debug/symtab.c \
-	generic/src/debug/stacktrace.c \
-	generic/src/debug/panic.c \
-	generic/src/debug/debug.c \
-	generic/src/interrupt/interrupt.c \
-	generic/src/log/log.c \
-	generic/src/main/main.c \
-	generic/src/main/kinit.c \
-	generic/src/main/uinit.c \
-	generic/src/main/version.c \
-	generic/src/main/shutdown.c \
-	generic/src/proc/current.c \
-	generic/src/proc/program.c \
-	generic/src/proc/scheduler.c \
-	generic/src/proc/thread.c \
-	generic/src/proc/task.c \
-	generic/src/syscall/syscall.c \
-	generic/src/syscall/copy.c \
-	generic/src/mm/km.c \
-	generic/src/mm/reserve.c \
-	generic/src/mm/frame.c \
-	generic/src/mm/page.c \
-	generic/src/mm/tlb.c \
-	generic/src/mm/as.c \
-	generic/src/mm/malloc.c \
-	generic/src/mm/backend_anon.c \
-	generic/src/mm/backend_elf.c \
-	generic/src/mm/backend_phys.c \
-	generic/src/mm/backend_user.c \
-	generic/src/mm/slab.c \
-	generic/src/lib/halt.c \
-	generic/src/lib/mem.c \
-	generic/src/lib/memfnc.c \
-	generic/src/lib/gsort.c \
-	generic/src/lib/str.c \
-	generic/src/lib/strtol.c \
-	generic/src/lib/str_error.c \
-	generic/src/lib/elf.c \
-	generic/src/lib/ra.c \
-	generic/src/lib/rd.c \
-	generic/src/lib/ubsan.c \
-	generic/src/printf/printf_core.c \
-	generic/src/printf/printf.c \
-	generic/src/printf/snprintf.c \
-	generic/src/printf/vprintf.c \
-	generic/src/printf/vsnprintf.c \
-	generic/src/time/clock.c \
-	generic/src/time/timeout.c \
-	generic/src/time/delay.c \
-	generic/src/preempt/preemption.c \
-	generic/src/synch/spinlock.c \
-	generic/src/synch/condvar.c \
-	generic/src/synch/mutex.c \
-	generic/src/synch/semaphore.c \
-	generic/src/synch/smc.c \
-	generic/src/synch/waitq.c \
-	generic/src/synch/syswaitq.c \
-	generic/src/smp/ipi.c \
-	generic/src/smp/smp.c \
-	generic/src/ipc/ipc.c \
-	generic/src/ipc/sysipc.c \
-	generic/src/ipc/sysipc_ops.c \
-	generic/src/ipc/ops/conctmeto.c \
-	generic/src/ipc/ops/concttome.c \
-	generic/src/ipc/ops/dataread.c \
-	generic/src/ipc/ops/datawrite.c \
-	generic/src/ipc/ops/debug.c \
-	generic/src/ipc/ops/pagein.c \
-	generic/src/ipc/ops/sharein.c \
-	generic/src/ipc/ops/shareout.c \
-	generic/src/ipc/ops/stchngath.c \
-	generic/src/ipc/ipcrsc.c \
-	generic/src/ipc/irq.c \
-	generic/src/ipc/event.c \
-	generic/src/cap/cap.c \
-	generic/src/security/perm.c \
-	generic/src/sysinfo/sysinfo.c \
-	generic/src/sysinfo/stats.c
-
-## Kernel console support
-#
-
-ifeq ($(CONFIG_KCONSOLE),y)
-GENERIC_SOURCES += \
-	generic/src/console/kconsole.c \
-	generic/src/console/cmd.c
-endif
-
-## Udebug interface sources
-#
-
-ifeq ($(CONFIG_UDEBUG),y)
-GENERIC_SOURCES += \
-	generic/src/ipc/kbox.c \
-	generic/src/udebug/udebug.c \
-	generic/src/udebug/udebug_ops.c \
-	generic/src/udebug/udebug_ipc.c
-endif
-
-## Test sources
-#
-
-ifeq ($(CONFIG_TEST),y)
-	CFLAGS += -Itest/
-	GENERIC_SOURCES += \
-		test/test.c \
-		test/atomic/atomic1.c \
-		test/fault/fault1.c \
-		test/mm/falloc1.c \
-		test/mm/falloc2.c \
-		test/mm/mapping1.c \
-		test/mm/slab1.c \
-		test/mm/slab2.c \
-		test/synch/semaphore1.c \
-		test/synch/semaphore2.c \
-		test/print/print1.c \
-		test/print/print2.c \
-		test/print/print3.c \
-		test/print/print4.c \
-		test/print/print5.c \
-		test/thread/thread1.c
-
-	ifeq ($(KARCH),mips32)
-		GENERIC_SOURCES += test/debug/mips1.c
-	else
-		GENERIC_SOURCES += test/debug/mips1_skip.c
-	endif
-
-	ifeq ($(KARCH),ia64)
-		GENERIC_SOURCES += test/mm/purge1.c
-	else
-		GENERIC_SOURCES += test/mm/purge1_skip.c
-	endif
-
-endif
-
-## Sources where instrumentation is enabled
-#
-
-ifeq ($(CONFIG_TRACE),y)
-	INSTRUMENTED_SOURCES = \
-		generic/src/cpu/cpu.c \
-		generic/src/ddi/ddi.c \
-		generic/src/interrupt/interrupt.c \
-		generic/src/main/main.c \
-		generic/src/main/kinit.c \
-		generic/src/proc/the.c \
-		generic/src/mm/frame.c \
-		generic/src/mm/page.c \
-		generic/src/mm/tlb.c \
-		generic/src/mm/as.c \
-		generic/src/mm/slab.c \
-		generic/src/sysinfo/sysinfo.c \
-		generic/src/console/kconsole.c
-else
-	INSTRUMENTED_SOURCES =
-endif
-
-ARCH_SOURCES += $(ARCH_AUTOCHECK_HEADERS:%.h=%.check.c)
-GENARCH_SOURCES += $(GENARCH_AUTOCHECK_HEADERS:%.h=%.check.c)
-
-GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
-ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
-GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
-
-GENERIC_DEPENDS := $(addsuffix .d,$(basename $(GENERIC_SOURCES)))
-ARCH_DEPENDS := $(addsuffix .d,$(basename $(ARCH_SOURCES)))
-GENARCH_DEPENDS := $(addsuffix .d,$(basename $(GENARCH_SOURCES)))
-
--include $(GENERIC_DEPENDS)
--include $(ARCH_DEPENDS)
--include $(GENARCH_DEPENDS)
-
-ifeq ($(CONFIG_SYMTAB),y)
-	SYMTAB_OBJECTS := generic/src/debug/real_map.o
-else
-	SYMTAB_OBJECTS :=
-endif
-
-$(DISASM): $(KERNEL)
-ifeq ($(CONFIG_LINE_DEBUG),y)
-	$(OBJDUMP) -d -S $< > $@
-else
-	$(OBJDUMP) -d $< > $@
-endif
-
-$(KERNEL): $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS)
-	$(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS)
-
-$(LINK): $(LINK).in
-	$(CC) $(DEFS) $(CFLAGS) -D__ASSEMBLER__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
-
-%.check.c: %.h $(AUTOCHECK)
-	cd $(<D) && $(AUTOCHECK) $(<F) > $(@F)
-
-%.o: %.S
-	$(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS)
-
-%.o: %.s
-	$(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS)
-
-%.o: %.c
-	$(CC_JOB) -c -MD -MP $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) $(if $(findstring $<,$(INSTRUMENTED_SOURCES)),$(INSTRUMENTATION))
-
-$(REAL_MAP).o: $(REAL_MAP).bin
-	echo "$(AS_PROLOG)""$(SYMTAB_SECTION)"" .incbin \"$<\"" | $(CC) $(CFLAGS) -x assembler -c -o $@ -
-
-$(REAL_MAP).bin: $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
-	echo "$(AS_PROLOG)""$(SYMTAB_SECTION)" | $(CC) $(CFLAGS) -x assembler -c -o $(EMPTY_MAP) -
-	$(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP)
-	$(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
-	$(GENMAP) $(MAP_PREV) $(DUMP) $@
-
-	# Do it once again, this time to get correct even the symbols
-	# on architectures that have bss after symtab
-
-	echo "$(AS_PROLOG)""$(SYMTAB_SECTION)"" .incbin \"$@\"" | $(CC) $(CFLAGS) -x assembler -c -o $(SIZEOK_MAP) -
-	$(CC) $(DEFS) $(CFLAGS) $(LDFLAGS) -Wl,-Map,$(MAP_PREV) -o $@ $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP)
-	$(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
-	$(GENMAP) $(MAP_PREV) $(DUMP) $@
Index: rnel/arch/amd64/Makefile.inc
===================================================================
--- kernel/arch/amd64/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,93 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-
-FPU_NO_CFLAGS = -mno-sse -mno-sse2
-
-# TODO: Red Zone is only a problem if we allow interrupts to land on an active
-#       stack. Using separate stack for interrupts and ensuring that we never
-#       enable interrupts on an interrupt stack would allow us to get rid of
-#       the argument.
-
-COMMON_CFLAGS += -mcmodel=$(MEMORY_MODEL) -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer
-
-BITS = 64
-ENDIANESS = LE
-
-## Accepted CPUs
-#
-
-ifeq ($(PROCESSOR),opteron)
-	COMMON_CFLAGS += -march=opteron
-endif
-
-ARCH_SOURCES = \
-	arch/$(KARCH)/src/fpu_context.c \
-	arch/$(KARCH)/src/boot/multiboot.S \
-	arch/$(KARCH)/src/boot/multiboot2.S \
-	arch/$(KARCH)/src/boot/memmap.c \
-	arch/$(KARCH)/src/debug/stacktrace.c \
-	arch/$(KARCH)/src/debug/stacktrace_asm.S \
-	arch/$(KARCH)/src/pm.c \
-	arch/$(KARCH)/src/vreg.c \
-	arch/$(KARCH)/src/kseg.c \
-	arch/$(KARCH)/src/context.S \
-	arch/$(KARCH)/src/ddi/ddi.c \
-	arch/$(KARCH)/src/drivers/i8254.c \
-	arch/$(KARCH)/src/delay.S \
-	arch/$(KARCH)/src/amd64.c \
-	arch/$(KARCH)/src/bios/bios.c \
-	arch/$(KARCH)/src/interrupt.c \
-	arch/$(KARCH)/src/mm/km.c \
-	arch/$(KARCH)/src/mm/as.c \
-	arch/$(KARCH)/src/mm/frame.c \
-	arch/$(KARCH)/src/mm/page.c \
-	arch/$(KARCH)/src/mm/tlb.c \
-	arch/$(KARCH)/src/asm.S \
-	arch/$(KARCH)/src/cpu/cpu.c \
-	arch/$(KARCH)/src/proc/scheduler.c \
-	arch/$(KARCH)/src/proc/task.c \
-	arch/$(KARCH)/src/proc/thread.c \
-	arch/$(KARCH)/src/userspace.c \
-	arch/$(KARCH)/src/smc.c \
-	arch/$(KARCH)/src/syscall.c
-
-ifeq ($(CONFIG_SMP),y)
-	ARCH_SOURCES += \
-		arch/$(KARCH)/src/smp/ap.S \
-		arch/$(KARCH)/src/smp/apic.c \
-		arch/$(KARCH)/src/smp/ipi.c \
-		arch/$(KARCH)/src/smp/mps.c \
-		arch/$(KARCH)/src/smp/smp.c
-endif
-
-ARCH_AUTOCHECK_HEADERS = \
-	arch/$(KARCH)/include/arch/istate_struct.h \
-	arch/$(KARCH)/include/arch/context_struct.h \
-	arch/$(KARCH)/include/arch/kseg_struct.h \
-	arch/$(KARCH)/include/arch/boot/memmap_struct.h
Index: kernel/arch/amd64/meson.build
===================================================================
--- kernel/arch/amd64/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
+++ kernel/arch/amd64/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -0,0 +1,95 @@
+#
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2019 Jiří Zárevúcky
+# 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.
+#
+
+# TODO: Red Zone is only a problem if we allow interrupts to land on an active
+#       stack. Using separate stack for interrupts and ensuring that we never
+#       enable interrupts on an interrupt stack would allow us to get rid of
+#       the argument.
+
+kernel_c_args += [ '-mno-sse', '-mno-sse2', '-mcmodel=' + MEMORY_MODEL, '-mno-red-zone', '-fno-unwind-tables', '-fno-omit-frame-pointer' ]
+
+# TODO: fix this
+kernel_link_args += [ '-Wl,--no-gc-sections' ]
+
+if PROCESSOR == 'opteron'
+	kernel_c_args += '-march=opteron'
+endif
+
+arch_src += files(
+	'src/amd64.c',
+	'src/asm.S',
+	'src/bios/bios.c',
+	'src/boot/memmap.c',
+	'src/boot/multiboot2.S',
+	'src/boot/multiboot.S',
+	'src/context.S',
+	'src/cpu/cpu.c',
+	'src/ddi/ddi.c',
+	'src/debug/stacktrace_asm.S',
+	'src/debug/stacktrace.c',
+	'src/delay.S',
+	'src/drivers/i8254.c',
+	'src/fpu_context.c',
+	'src/interrupt.c',
+	'src/kseg.c',
+	'src/mm/as.c',
+	'src/mm/frame.c',
+	'src/mm/km.c',
+	'src/mm/page.c',
+	'src/mm/tlb.c',
+	'src/pm.c',
+	'src/proc/scheduler.c',
+	'src/proc/task.c',
+	'src/proc/thread.c',
+	'src/smc.c',
+	'src/syscall.c',
+	'src/userspace.c',
+	'src/vreg.c',
+)
+
+if CONFIG_SMP
+	arch_src += files(
+		'src/smp/apic.c',
+		'src/smp/ap.S',
+		'src/smp/ipi.c',
+		'src/smp/mps.c',
+		'src/smp/smp.c',
+	)
+endif
+
+_check_headers = [
+	'include/arch/boot/memmap_struct.h',
+	'include/arch/context_struct.h',
+	'include/arch/istate_struct.h',
+	'include/arch/kseg_struct.h',
+]
+
+foreach h : _check_headers
+	arch_src += [ autocheck.process(h) ]
+endforeach
Index: rnel/arch/arm32/Makefile.inc
===================================================================
--- kernel/arch/arm32/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,95 +1,0 @@
-#
-# Copyright (c) 2007 Jakub Jermar, Michal Kebrt
-# 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.
-#
-
-
-ATSIGN = %
-
-COMMON_CFLAGS += -fno-omit-frame-pointer -mapcs-frame -mcpu=$(subst _,-,$(PROCESSOR)) -mno-unaligned-access -mfpu=vfpv3
-
-ifeq ($(CONFIG_FPU),y)
-	# This is necessary to allow vmsr insn and fpexc manipulation
-	# Use vfp32 to allow context save/restore of d16-d31 regs.
-	COMMON_CFLAGS += -mfloat-abi=hard
-endif
-
-BITS = 32
-ENDIANESS = LE
-
-ARCH_SOURCES = \
-	arch/$(KARCH)/src/start.S \
-	arch/$(KARCH)/src/asm.S \
-	arch/$(KARCH)/src/eabi.S \
-	arch/$(KARCH)/src/exc_handler.S \
-	arch/$(KARCH)/src/arm32.c \
-	arch/$(KARCH)/src/machine_func.c \
-	arch/$(KARCH)/src/context.S \
-	arch/$(KARCH)/src/dummy.S \
-	arch/$(KARCH)/src/cpu/cpu.c \
-	arch/$(KARCH)/src/interrupt.c \
-	arch/$(KARCH)/src/exception.c \
-	arch/$(KARCH)/src/userspace.c \
-	arch/$(KARCH)/src/smc.c \
-	arch/$(KARCH)/src/debug/stacktrace.c \
-	arch/$(KARCH)/src/debug/stacktrace_asm.S \
-	arch/$(KARCH)/src/mm/km.c \
-	arch/$(KARCH)/src/mm/as.c \
-	arch/$(KARCH)/src/mm/frame.c \
-	arch/$(KARCH)/src/mm/page.c \
-	arch/$(KARCH)/src/mm/tlb.c \
-	arch/$(KARCH)/src/mm/page_fault.c \
-	arch/$(KARCH)/src/atomic.c \
-	arch/$(KARCH)/src/ras.c
-
-ifeq ($(CONFIG_FPU),y)
-	ARCH_SOURCES +=	arch/$(KARCH)/src/fpu_context.c
-	ARCH_SOURCES +=	arch/$(KARCH)/src/fpu.S
-endif
-
-ifeq ($(MACHINE),gta02)
-	ARCH_SOURCES += arch/$(KARCH)/src/mach/gta02/gta02.c
-endif
-
-ifeq ($(MACHINE),integratorcp)
-	ARCH_SOURCES += arch/$(KARCH)/src/mach/integratorcp/integratorcp.c
-endif
-
-ifeq ($(MACHINE),beagleboardxm)
-	ARCH_SOURCES += arch/$(KARCH)/src/mach/beagleboardxm/beagleboardxm.c
-endif
-
-ifeq ($(MACHINE),beaglebone)
-	ARCH_SOURCES += arch/$(KARCH)/src/mach/beaglebone/beaglebone.c
-endif
-
-ifeq ($(MACHINE),raspberrypi)
-	ARCH_SOURCES += arch/$(KARCH)/src/mach/raspberrypi/raspberrypi.c
-endif
-
-ifeq ($(CONFIG_PL050),y)
-	ARCH_SOURCES += genarch/src/drivers/pl050/pl050.c
-endif
Index: kernel/arch/arm32/meson.build
===================================================================
--- kernel/arch/arm32/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
+++ kernel/arch/arm32/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -0,0 +1,85 @@
+#
+# Copyright (c) 2007 Jakub Jermar, Michal Kebrt
+# 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.
+#
+
+
+atsign = '%'
+
+kernel_c_args += [ '-fno-omit-frame-pointer', '-mapcs-frame', '-mno-unaligned-access', '-mfpu=vfpv3' ]
+
+if CONFIG_FPU
+	# This is necessary to allow vmsr insn and fpexc manipulation
+	# Use vfp32 to allow context save/restore of d16-d31 regs.
+	kernel_c_args += [ '-mfloat-abi=hard', '-mfpu=vfp3' ]
+endif
+
+arch_src += files(
+	'src/start.S',
+	'src/asm.S',
+	'src/eabi.S',
+	'src/exc_handler.S',
+	'src/arm32.c',
+	'src/machine_func.c',
+	'src/context.S',
+	'src/dummy.S',
+	'src/cpu/cpu.c',
+	'src/interrupt.c',
+	'src/exception.c',
+	'src/userspace.c',
+	'src/smc.c',
+	'src/debug/stacktrace.c',
+	'src/debug/stacktrace_asm.S',
+	'src/mm/km.c',
+	'src/mm/as.c',
+	'src/mm/frame.c',
+	'src/mm/page.c',
+	'src/mm/tlb.c',
+	'src/mm/page_fault.c',
+	'src/atomic.c',
+	'src/ras.c',
+)
+
+if CONFIG_FPU
+	arch_src += files('src/fpu_context.c', 'src/fpu.S')
+endif
+
+if MACHINE == 'gta02'
+	arch_src += files('src/mach/gta02/gta02.c')
+
+elif MACHINE == 'integratorcp'
+	arch_src += files('src/mach/integratorcp/integratorcp.c')
+
+elif MACHINE == 'beagleboardxm'
+	arch_src += files('src/mach/beagleboardxm/beagleboardxm.c')
+
+elif MACHINE == 'beaglebone'
+	arch_src += files('src/mach/beaglebone/beaglebone.c')
+
+elif MACHINE == 'raspberrypi'
+	arch_src += files('src/mach/raspberrypi/raspberrypi.c')
+
+endif
Index: rnel/arch/arm64/Makefile.inc
===================================================================
--- kernel/arch/arm64/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,65 +1,0 @@
-#
-# Copyright (c) 2015 Petr Pavlu
-# 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.
-#
-
-
-COMMON_CFLAGS += -fno-omit-frame-pointer -march=armv8-a+nofp+nosimd \
-	-mgeneral-regs-only
-
-BITS = 64
-ENDIANESS = LE
-
-ARCH_SOURCES = \
-	arch/$(KARCH)/src/arm64.c \
-	arch/$(KARCH)/src/asm.S \
-	arch/$(KARCH)/src/context.S \
-	arch/$(KARCH)/src/cpu/cpu.c \
-	arch/$(KARCH)/src/debug/stacktrace.c \
-	arch/$(KARCH)/src/debug/stacktrace_asm.S \
-	arch/$(KARCH)/src/exception.c \
-	arch/$(KARCH)/src/fpu.S \
-	arch/$(KARCH)/src/fpu_context.c \
-	arch/$(KARCH)/src/interrupt.c \
-	arch/$(KARCH)/src/machine_func.c \
-	arch/$(KARCH)/src/mm/as.c \
-	arch/$(KARCH)/src/mm/frame.c \
-	arch/$(KARCH)/src/mm/km.c \
-	arch/$(KARCH)/src/mm/page.c \
-	arch/$(KARCH)/src/mm/tlb.c \
-	arch/$(KARCH)/src/smc.c \
-	arch/$(KARCH)/src/smp/ipi.c \
-	arch/$(KARCH)/src/smp/smp.c \
-	arch/$(KARCH)/src/start.S
-
-ifeq ($(MACHINE),virt)
-	ARCH_SOURCES += arch/$(KARCH)/src/mach/virt/virt.c
-endif
-
-ARCH_AUTOCHECK_HEADERS = \
-	arch/$(KARCH)/include/arch/context_struct.h \
-	arch/$(KARCH)/include/arch/fpu_context_struct.h \
-	arch/$(KARCH)/include/arch/istate_struct.h
Index: kernel/arch/arm64/meson.build
===================================================================
--- kernel/arch/arm64/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
+++ kernel/arch/arm64/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2015 Petr Pavlu
+# 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.
+#
+
+kernel_c_args += [ '-fno-omit-frame-pointer', '-march=armv8-a+nofp+nosimd', '-mgeneral-regs-only' ]
+
+arch_src += files(
+	'src/arm64.c',
+	'src/asm.S',
+	'src/context.S',
+	'src/cpu/cpu.c',
+	'src/debug/stacktrace.c',
+	'src/debug/stacktrace_asm.S',
+	'src/exception.c',
+	'src/fpu.S',
+	'src/fpu_context.c',
+	'src/interrupt.c',
+	'src/machine_func.c',
+	'src/mm/as.c',
+	'src/mm/frame.c',
+	'src/mm/km.c',
+	'src/mm/page.c',
+	'src/mm/tlb.c',
+	'src/smc.c',
+	'src/smp/ipi.c',
+	'src/smp/smp.c',
+	'src/start.S',
+)
+
+if MACHINE == 'virt'
+	arch_src += files('src/mach/virt/virt.c')
+endif
+
+_check_headers = [
+	'include/arch/context_struct.h',
+	'include/arch/fpu_context_struct.h',
+	'include/arch/istate_struct.h',
+]
+
+foreach h : _check_headers
+	arch_src += [ autocheck.process(h) ]
+endforeach
Index: rnel/arch/ia32/Makefile.inc
===================================================================
--- kernel/arch/ia32/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,104 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-
-BITS = 32
-ENDIANESS = LE
-
-COMMON_CFLAGS += -fno-omit-frame-pointer
-
-## Accepted CPUs
-#
-
-ifeq ($(PROCESSOR),i486)
-	COMMON_CFLAGS += -march=i486
-endif
-
-ifeq ($(PROCESSOR),athlon_xp)
-	COMMON_CFLAGS += -march=athlon-xp
-endif
-
-ifeq ($(PROCESSOR),athlon_mp)
-	COMMON_CFLAGS += -march=athlon-mp
-endif
-
-ifeq ($(PROCESSOR),pentium3)
-	COMMON_CFLAGS += -march=pentium3
-endif
-
-ifeq ($(PROCESSOR),pentium4)
-	COMMON_CFLAGS += -march=pentium4
-endif
-
-ifeq ($(PROCESSOR),core)
-	COMMON_CFLAGS += -march=prescott
-endif
-
-FPU_NO_CFLAGS = -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow
-
-ARCH_SOURCES = \
-	arch/$(KARCH)/src/context.S \
-	arch/$(KARCH)/src/debug/stacktrace.c \
-	arch/$(KARCH)/src/debug/stacktrace_asm.S \
-	arch/$(KARCH)/src/delay.S \
-	arch/$(KARCH)/src/asm.S \
-	arch/$(KARCH)/src/proc/scheduler.c \
-	arch/$(KARCH)/src/proc/task.c \
-	arch/$(KARCH)/src/proc/thread.c \
-	arch/$(KARCH)/src/bios/bios.c \
-	arch/$(KARCH)/src/smp/ap.S \
-	arch/$(KARCH)/src/smp/apic.c \
-	arch/$(KARCH)/src/smp/mps.c \
-	arch/$(KARCH)/src/smp/smp.c \
-	arch/$(KARCH)/src/atomic.S \
-	arch/$(KARCH)/src/smp/ipi.c \
-	arch/$(KARCH)/src/ia32.c \
-	arch/$(KARCH)/src/vreg.c \
-	arch/$(KARCH)/src/interrupt.c \
-	arch/$(KARCH)/src/pm.c \
-	arch/$(KARCH)/src/userspace.c \
-	arch/$(KARCH)/src/smc.c \
-	arch/$(KARCH)/src/cpu/cpu.c \
-	arch/$(KARCH)/src/mm/km.c \
-	arch/$(KARCH)/src/mm/as.c \
-	arch/$(KARCH)/src/mm/frame.c \
-	arch/$(KARCH)/src/mm/page.c \
-	arch/$(KARCH)/src/mm/tlb.c \
-	arch/$(KARCH)/src/ddi/ddi.c \
-	arch/$(KARCH)/src/drivers/i8254.c \
-	arch/$(KARCH)/src/boot/multiboot.S \
-	arch/$(KARCH)/src/boot/multiboot2.S \
-	arch/$(KARCH)/src/boot/memmap.c \
-	arch/$(KARCH)/src/fpu_context.c \
-	arch/$(KARCH)/src/syscall.c
-
-ARCH_AUTOCHECK_HEADERS = \
-	arch/$(KARCH)/include/arch/istate_struct.h \
-	arch/$(KARCH)/include/arch/context_struct.h \
-	arch/$(KARCH)/include/arch/boot/memmap_struct.h
-
Index: kernel/arch/ia32/meson.build
===================================================================
--- kernel/arch/ia32/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
+++ kernel/arch/ia32/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -0,0 +1,79 @@
+#
+# Copyright (c) 2005 Martin Decky
+# 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.
+#
+
+kernel_c_args += [ '-mno-mmx', '-mno-sse', '-mno-sse2', '-mno-sse3', '-mno-3dnow' ]
+
+# TODO: fix this
+kernel_link_args += [ '-Wl,--no-gc-sections' ]
+
+arch_src += files(
+	'src/context.S',
+	'src/debug/stacktrace.c',
+	'src/debug/stacktrace_asm.S',
+	'src/delay.S',
+	'src/asm.S',
+	'src/proc/scheduler.c',
+	'src/proc/task.c',
+	'src/proc/thread.c',
+	'src/bios/bios.c',
+	'src/smp/ap.S',
+	'src/smp/apic.c',
+	'src/smp/mps.c',
+	'src/smp/smp.c',
+	'src/atomic.S',
+	'src/smp/ipi.c',
+	'src/ia32.c',
+	'src/vreg.c',
+	'src/interrupt.c',
+	'src/pm.c',
+	'src/userspace.c',
+	'src/smc.c',
+	'src/cpu/cpu.c',
+	'src/mm/km.c',
+	'src/mm/as.c',
+	'src/mm/frame.c',
+	'src/mm/page.c',
+	'src/mm/tlb.c',
+	'src/ddi/ddi.c',
+	'src/drivers/i8254.c',
+	'src/boot/multiboot.S',
+	'src/boot/multiboot2.S',
+	'src/boot/memmap.c',
+	'src/fpu_context.c',
+	'src/syscall.c',
+)
+
+_check_headers = [
+	'include/arch/istate_struct.h',
+	'include/arch/context_struct.h',
+	'include/arch/boot/memmap_struct.h',
+]
+
+foreach h : _check_headers
+	arch_src += [ autocheck.process(h) ]
+endforeach
Index: rnel/arch/ia64/Makefile.inc
===================================================================
--- kernel/arch/ia64/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,72 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-
-COMMON_CFLAGS += -mconstant-gp -fno-unwind-tables -mfixed-range=f32-f127
-
-LDFLAGS += -Wl,-EL
-
-BITS = 64
-ENDIANESS = LE
-
-ARCH_SOURCES = \
-	arch/$(KARCH)/src/start.S \
-	arch/$(KARCH)/src/asm.S \
-	arch/$(KARCH)/src/dummy.S \
-	arch/$(KARCH)/src/ia64.c \
-	arch/$(KARCH)/src/fpu_context.c \
-	arch/$(KARCH)/src/context.S \
-	arch/$(KARCH)/src/cpu/cpu.c \
-	arch/$(KARCH)/src/debug/stacktrace.c \
-	arch/$(KARCH)/src/debug/stacktrace_asm.S \
-	arch/$(KARCH)/src/ivt.S \
-	arch/$(KARCH)/src/interrupt.c \
-	arch/$(KARCH)/src/mm/km.c \
-	arch/$(KARCH)/src/mm/as.c \
-	arch/$(KARCH)/src/mm/frame.c \
-	arch/$(KARCH)/src/mm/page.c \
-	arch/$(KARCH)/src/mm/tlb.c \
-	arch/$(KARCH)/src/mm/vhpt.c \
-	arch/$(KARCH)/src/proc/scheduler.c \
-	arch/$(KARCH)/src/ddi/ddi.c \
-	arch/$(KARCH)/src/smc.c \
-	arch/$(KARCH)/src/smp/smp.c \
-	arch/$(KARCH)/src/drivers/it.c
-
-ifeq ($(MACHINE),ski)
-	ARCH_SOURCES += arch/$(KARCH)/src/drivers/ski.c
-endif
-
-ifeq ($(MACHINE),i460GX)
-	DEFS += -DI460GX
-endif
-
-ARCH_AUTOCHECK_HEADERS = \
-	arch/$(KARCH)/include/arch/istate_struct.h \
-	arch/$(KARCH)/include/arch/context_struct.h
-
Index: kernel/arch/ia64/meson.build
===================================================================
--- kernel/arch/ia64/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
+++ kernel/arch/ia64/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -0,0 +1,73 @@
+#
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2019 Jiří Zárevúcky
+# 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.
+#
+
+kernel_c_args += [ '-mconstant-gp', '-fno-unwind-tables', '-mfixed-range=f32-f127' ]
+kernel_link_args += [ '-Wl,-EL' ]
+
+arch_src += files(
+	'src/start.S',
+	'src/asm.S',
+	'src/dummy.S',
+	'src/ia64.c',
+	'src/fpu_context.c',
+	'src/context.S',
+	'src/cpu/cpu.c',
+	'src/debug/stacktrace.c',
+	'src/debug/stacktrace_asm.S',
+	'src/ivt.S',
+	'src/interrupt.c',
+	'src/mm/km.c',
+	'src/mm/as.c',
+	'src/mm/frame.c',
+	'src/mm/page.c',
+	'src/mm/tlb.c',
+	'src/mm/vhpt.c',
+	'src/proc/scheduler.c',
+	'src/ddi/ddi.c',
+	'src/smc.c',
+	'src/smp/smp.c',
+	'src/drivers/it.c',
+)
+
+if MACHINE == 'ski'
+	arch_src += files('src/drivers/ski.c')
+endif
+
+if MACHINE == 'i460GX'
+	kernel_c_args += [ '-DI460GX' ]
+endif
+
+_check_headers = [
+	'include/arch/istate_struct.h',
+	'include/arch/context_struct.h',
+]
+
+foreach h : _check_headers
+	arch_src += [ autocheck.process(h) ]
+endforeach
Index: rnel/arch/mips32/Makefile.inc
===================================================================
--- kernel/arch/mips32/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,85 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-COMMON_CFLAGS += -msoft-float -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mabi=32
-AS_PROLOG = .module softfloat;
-
-BITS = 32
-
-## Accepted MACHINEs
-#
-
-ifeq ($(MACHINE),msim)
-	ENDIANESS = LE
-	COMMON_CFLAGS += -march=r4000
-endif
-ifeq ($(MACHINE),bmalta)
-	ENDIANESS = BE
-	COMMON_CFLAGS += -D__BE__ -march=4kc
-endif
-ifeq ($(MACHINE),lmalta)
-	ENDIANESS = LE
-	COMMON_CFLAGS += -march=4kc
-endif
-
-ARCH_SOURCES = \
-	arch/$(KARCH)/src/start.S \
-	arch/$(KARCH)/src/context.S \
-	arch/$(KARCH)/src/mips32.c \
-	arch/$(KARCH)/src/asm.S \
-	arch/$(KARCH)/src/exception.c \
-	arch/$(KARCH)/src/interrupt.c \
-	arch/$(KARCH)/src/cache.c \
-	arch/$(KARCH)/src/debugger.c \
-	arch/$(KARCH)/src/cpu/cpu.c \
-	arch/$(KARCH)/src/debug/stacktrace.c \
-	arch/$(KARCH)/src/debug/stacktrace_asm.S \
-	arch/$(KARCH)/src/mm/km.c \
-	arch/$(KARCH)/src/mm/frame.c \
-	arch/$(KARCH)/src/mm/page.c \
-	arch/$(KARCH)/src/mm/tlb.c \
-	arch/$(KARCH)/src/mm/as.c \
-	arch/$(KARCH)/src/fpu_context.c \
-	arch/$(KARCH)/src/smc.c \
-	arch/$(KARCH)/src/smp/smp.c \
-	arch/$(KARCH)/src/machine_func.c
-
-ifeq ($(MACHINE),$(filter lmalta bmalta,$(MACHINE)))
-	ARCH_SOURCES += arch/$(KARCH)/src/mach/malta/malta.c
-endif
-
-ifeq ($(MACHINE),msim)
-	ARCH_SOURCES += \
-		arch/$(KARCH)/src/mach/msim/msim.c \
-		arch/$(KARCH)/src/mach/msim/dorder.c
-endif
-
-ARCH_AUTOCHECK_HEADERS = \
-	arch/$(KARCH)/include/arch/istate_struct.h \
-	arch/$(KARCH)/include/arch/context_struct.h \
-	arch/$(KARCH)/include/arch/fpu_context_struct.h
Index: kernel/arch/mips32/meson.build
===================================================================
--- kernel/arch/mips32/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
+++ kernel/arch/mips32/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -0,0 +1,81 @@
+#
+# Copyright (c) 2005 Martin Decky
+# 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.
+#
+
+kernel_c_args += [
+	'-msoft-float',
+	'-mno-abicalls',
+	'-G', '0',
+	'-fno-zero-initialized-in-bss',
+	'-mabi=32',
+]
+
+as_prolog = '.module softfloat;'
+
+arch_src += files(
+	'src/start.S',
+	'src/context.S',
+	'src/mips32.c',
+	'src/asm.S',
+	'src/exception.c',
+	'src/interrupt.c',
+	'src/cache.c',
+	'src/debugger.c',
+	'src/cpu/cpu.c',
+	'src/debug/stacktrace.c',
+	'src/debug/stacktrace_asm.S',
+	'src/mm/km.c',
+	'src/mm/frame.c',
+	'src/mm/page.c',
+	'src/mm/tlb.c',
+	'src/mm/as.c',
+	'src/fpu_context.c',
+	'src/smc.c',
+	'src/smp/smp.c',
+	'src/machine_func.c',
+)
+
+if MACHINE == 'lmalta' or MACHINE == 'bmalta'
+	arch_src += files('src/mach/malta/malta.c')
+
+elif MACHINE == 'msim'
+	arch_src += files(
+		'src/mach/msim/msim.c',
+		'src/mach/msim/dorder.c',
+	)
+
+endif
+
+_check_headers = [
+	'include/arch/istate_struct.h',
+	'include/arch/context_struct.h',
+	'include/arch/fpu_context_struct.h',
+]
+
+foreach h : _check_headers
+	arch_src += [ autocheck.process(h) ]
+endforeach
Index: rnel/genarch/Makefile.inc
===================================================================
--- kernel/genarch/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,206 +1,0 @@
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-## Accepted configuration directives
-#
-
-ifeq ($(CONFIG_ACPI),y)
-GENARCH_SOURCES += \
-	genarch/src/acpi/acpi.c \
-	genarch/src/acpi/madt.c
-endif
-
-ifeq ($(CONFIG_PAGE_PT),y)
-GENARCH_SOURCES += \
-	genarch/src/mm/page_pt.c \
-	genarch/src/mm/as_pt.c
-endif
-
-ifeq ($(CONFIG_PAGE_HT),y)
-GENARCH_SOURCES += \
-	genarch/src/mm/page_ht.c \
-	genarch/src/mm/as_ht.c
-endif
-
-ifeq ($(CONFIG_ASID),y)
-GENARCH_SOURCES += \
-	genarch/src/mm/asid.c
-endif
-
-ifeq ($(CONFIG_ASID_FIFO),y)
-GENARCH_SOURCES += \
-	genarch/src/mm/asid_fifo.c
-endif
-
-ifeq ($(CONFIG_SOFTINT),y)
-GENARCH_SOURCES += \
-	genarch/src/softint/division.c \
-	genarch/src/softint/multiplication.c
-endif
-
-ifeq ($(CONFIG_FB),y)
-GENARCH_SOURCES += \
-	genarch/src/fb/font-8x16.c \
-	genarch/src/fb/fb.c \
-	genarch/src/fb/bfb.c
-endif
-
-ifeq ($(CONFIG_DSRLNIN),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/dsrln/dsrlnin.c
-endif
-
-ifeq ($(CONFIG_DSRLNOUT),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/dsrln/dsrlnout.c
-endif
-
-ifeq ($(CONFIG_I8042),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/i8042/i8042.c
-endif
-
-ifeq ($(CONFIG_I8259),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/i8259/i8259.c
-endif
-
-ifeq ($(CONFIG_NS16550),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/ns16550/ns16550.c
-endif
-
-ifeq ($(CONFIG_PL011_UART),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/pl011/pl011.c
-endif
-
-ifeq ($(CONFIG_S3C24XX_IRQC),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/s3c24xx/irqc.c
-endif
-
-ifeq ($(CONFIG_S3C24XX_UART),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/s3c24xx/uart.c
-endif
-
-ifeq ($(CONFIG_OMAP_UART),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/omap/uart.c
-endif
-
-ifeq ($(CONFIG_AM335X_TIMERS),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/am335x/timer.c
-endif
-
-ifeq ($(CONFIG_BCM2835_MAILBOX),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/bcm2835/irc.c \
-	genarch/src/drivers/bcm2835/mbox.c \
-	genarch/src/drivers/bcm2835/timer.c
-endif
-
-ifeq ($(CONFIG_GICV2), y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/gicv2/gicv2.c
-endif
-
-ifeq ($(CONFIG_VIA_CUDA),y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/via-cuda/cuda.c
-endif
-
-ifeq ($(CONFIG_PC_KBD),y)
-GENARCH_SOURCES += \
-	genarch/src/kbrd/kbrd.c \
-	genarch/src/kbrd/scanc_pc.c
-endif
-
-ifeq ($(CONFIG_AT_KBD),y)
-GENARCH_SOURCES += \
-	genarch/src/kbrd/kbrd_at.c \
-	genarch/src/kbrd/scanc_at.c
-endif
-
-ifeq ($(CONFIG_SUN_KBD),y)
-GENARCH_SOURCES += \
-	genarch/src/kbrd/kbrd.c \
-	genarch/src/kbrd/scanc_sun.c
-endif
-
-ifeq ($(CONFIG_MAC_KBD),y)
-GENARCH_SOURCES += \
-	genarch/src/kbrd/kbrd.c \
-	genarch/src/kbrd/scanc_mac.c
-endif
-
-ifeq ($(CONFIG_SRLN),y)
-GENARCH_SOURCES += \
-	genarch/src/srln/srln.c
-endif
-
-ifeq ($(CONFIG_OFW_TREE),y)
-GENARCH_SOURCES += \
-	genarch/src/ofw/ofw_tree.c
-endif
-
-ifeq ($(CONFIG_OFW_PCI),y)
-GENARCH_SOURCES += \
-	genarch/src/ofw/ebus.c \
-	genarch/src/ofw/pci.c  \
-	genarch/src/ofw/sbus.c \
-	genarch/src/ofw/upa.c
-endif
-
-ifeq ($(CONFIG_MULTIBOOT), y)
-GENARCH_SOURCES += \
-	genarch/src/multiboot/common.c \
-	genarch/src/multiboot/multiboot.c \
-	genarch/src/multiboot/multiboot2.c
-
-GENARCH_AUTOCHECK_HEADERS += \
-	genarch/include/genarch/multiboot/multiboot_memmap_struct.h \
-	genarch/include/genarch/multiboot/multiboot_info_struct.h
-endif
-
-ifeq ($(CONFIG_EGA), y)
-GENARCH_SOURCES += \
-	genarch/src/drivers/ega/ega.c
-endif
-
-ifeq ($(CONFIG_IOMAP_BITMAP), y)
-GENARCH_SOURCES += \
-	genarch/src/ddi/ddi-bitmap.c
-endif
-
-ifeq ($(CONFIG_IOMAP_DUMMY), y)
-GENARCH_SOURCES += \
-	genarch/src/ddi/ddi-dummy.c
-endif
-
Index: kernel/genarch/meson.build
===================================================================
--- kernel/genarch/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
+++ kernel/genarch/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -0,0 +1,174 @@
+# Copyright (c) 2005 Martin Decky
+# Copyright (c) 2019 Jiří Zárevúcky
+# 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.
+#
+
+## Accepted configuration directives
+#
+
+_src = []
+_check = []
+
+if CONFIG_ACPI
+	_src += [ 'acpi/acpi.c', 'acpi/madt.c' ]
+endif
+
+if CONFIG_PAGE_PT
+	_src += [ 'mm/page_pt.c', 'mm/as_pt.c' ]
+endif
+
+if CONFIG_PAGE_HT
+	_src += [ 'mm/page_ht.c', 'mm/as_ht.c' ]
+endif
+
+if CONFIG_ASID
+	_src += [ 'mm/asid.c' ]
+endif
+
+if CONFIG_ASID_FIFO
+	_src += [ 'mm/asid_fifo.c' ]
+endif
+
+if CONFIG_SOFTINT
+	_src += [ 'softint/division.c', 'softint/multiplication.c' ]
+endif
+
+if CONFIG_FB
+	_src += [ 'fb/font-8x16.c', 'fb/fb.c', 'fb/bfb.c' ]
+endif
+
+if CONFIG_DSRLNIN
+	_src += [ 'drivers/dsrln/dsrlnin.c' ]
+endif
+
+if CONFIG_DSRLNOUT
+	_src += [ 'drivers/dsrln/dsrlnout.c' ]
+endif
+
+if CONFIG_I8042
+	_src += [ 'drivers/i8042/i8042.c' ]
+endif
+
+if CONFIG_I8259
+	_src += [ 'drivers/i8259/i8259.c' ]
+endif
+
+if CONFIG_NS16550
+	_src += [ 'drivers/ns16550/ns16550.c' ]
+endif
+
+if CONFIG_PL011_UART
+	_src += [ 'drivers/pl011/pl011.c' ]
+endif
+
+if CONFIG_PL050
+	_src += [ 'drivers/pl050/pl050.c' ]
+endif
+
+if CONFIG_S3C24XX_IRQC
+	_src += [ 'drivers/s3c24xx/irqc.c' ]
+endif
+
+if CONFIG_S3C24XX_UART
+	_src += [ 'drivers/s3c24xx/uart.c' ]
+endif
+
+if CONFIG_OMAP_UART
+	_src += [ 'drivers/omap/uart.c' ]
+endif
+
+if CONFIG_AM335X_TIMERS
+	_src += [ 'drivers/am335x/timer.c' ]
+endif
+
+if CONFIG_BCM2835_MAILBOX
+	_src += [ 'drivers/bcm2835/irc.c', 'drivers/bcm2835/mbox.c', 'drivers/bcm2835/timer.c' ]
+endif
+
+if CONFIG_GICV2
+	_src += [ 'drivers/gicv2/gicv2.c' ]
+endif
+
+if CONFIG_VIA_CUDA
+	_src += [ 'drivers/via-cuda/cuda.c' ]
+endif
+
+if CONFIG_PC_KBD
+	_src += [ 'kbrd/kbrd.c', 'kbrd/scanc_pc.c' ]
+endif
+
+if CONFIG_AT_KBD
+	_src += [ 'kbrd/kbrd_at.c', 'kbrd/scanc_at.c' ]
+endif
+
+if CONFIG_SUN_KBD
+	_src += [ 'kbrd/kbrd.c', 'kbrd/scanc_sun.c' ]
+endif
+
+if CONFIG_MAC_KBD
+	_src += [ 'kbrd/kbrd.c', 'kbrd/scanc_mac.c' ]
+endif
+
+if CONFIG_SRLN
+	_src += [ 'srln/srln.c' ]
+endif
+
+if CONFIG_OFW_TREE
+	_src += [ 'ofw/ofw_tree.c' ]
+endif
+
+if CONFIG_OFW_PCI
+	_src += [ 'ofw/ebus.c', 'ofw/pci.c ', 'ofw/sbus.c', 'ofw/upa.c' ]
+endif
+
+if CONFIG_MULTIBOOT
+	_src += [ 'multiboot/common.c', 'multiboot/multiboot.c', 'multiboot/multiboot2.c' ]
+	_check += [ 'multiboot/multiboot_memmap_struct.h', 'multiboot/multiboot_info_struct.h' ]
+endif
+
+if CONFIG_EGA
+	_src += [ 'drivers/ega/ega.c' ]
+endif
+
+if CONFIG_IOMAP_BITMAP
+	_src += [ 'ddi/ddi-bitmap.c' ]
+endif
+
+if CONFIG_IOMAP_DUMMY
+	_src += [ 'ddi/ddi-dummy.c' ]
+endif
+
+
+genarch_src = []
+genarch_check_headers = []
+
+foreach f : _src
+	genarch_src += files('src' / f)
+endforeach
+
+foreach f : _check
+	genarch_src += [ autocheck.process('include' / 'genarch' / f) ]
+endforeach
Index: kernel/generic/meson.build
===================================================================
--- kernel/generic/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
+++ kernel/generic/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -0,0 +1,122 @@
+# Generic kernel sources
+generic_src = []
+
+# Generic kernel sources that are instrumented when CONFIG_TRACE is enabled.
+# Must be disjoint with generic_src.
+instrumentable_src = []
+
+
+generic_src += files(
+	'src/adt/bitmap.c',
+	'src/adt/hash_table.c',
+	'src/adt/list.c',
+	'src/adt/odict.c',
+	'src/cap/cap.c',
+	'src/console/chardev.c',
+	'src/console/console.c',
+	'src/console/prompt.c',
+	'src/cpu/cpu_mask.c',
+	'src/ddi/irq.c',
+	'src/debug/debug.c',
+	'src/debug/panic.c',
+	'src/debug/stacktrace.c',
+	'src/debug/symtab.c',
+	'src/ipc/event.c',
+	'src/ipc/ipc.c',
+	'src/ipc/ipcrsc.c',
+	'src/ipc/irq.c',
+	'src/ipc/ops/conctmeto.c',
+	'src/ipc/ops/concttome.c',
+	'src/ipc/ops/dataread.c',
+	'src/ipc/ops/datawrite.c',
+	'src/ipc/ops/debug.c',
+	'src/ipc/ops/pagein.c',
+	'src/ipc/ops/sharein.c',
+	'src/ipc/ops/shareout.c',
+	'src/ipc/ops/stchngath.c',
+	'src/ipc/sysipc.c',
+	'src/ipc/sysipc_ops.c',
+	'src/lib/elf.c',
+	'src/lib/gsort.c',
+	'src/lib/halt.c',
+	'src/lib/mem.c',
+	'src/lib/memfnc.c',
+	'src/lib/ra.c',
+	'src/lib/rd.c',
+	'src/lib/str.c',
+	'src/lib/strtol.c',
+	'src/lib/str_error.c',
+	'src/lib/ubsan.c',
+	'src/log/log.c',
+	'src/main/shutdown.c',
+	'src/main/uinit.c',
+	'src/main/version.c',
+	'src/mm/backend_anon.c',
+	'src/mm/backend_elf.c',
+	'src/mm/backend_phys.c',
+	'src/mm/backend_user.c',
+	'src/mm/km.c',
+	'src/mm/malloc.c',
+	'src/mm/reserve.c',
+	'src/preempt/preemption.c',
+	'src/printf/printf.c',
+	'src/printf/printf_core.c',
+	'src/printf/snprintf.c',
+	'src/printf/vprintf.c',
+	'src/printf/vsnprintf.c',
+	'src/proc/program.c',
+	'src/proc/scheduler.c',
+	'src/proc/task.c',
+	'src/proc/thread.c',
+	'src/security/perm.c',
+	'src/smp/ipi.c',
+	'src/smp/smp.c',
+	'src/synch/condvar.c',
+	'src/synch/mutex.c',
+	'src/synch/semaphore.c',
+	'src/synch/smc.c',
+	'src/synch/spinlock.c',
+	'src/synch/syswaitq.c',
+	'src/synch/waitq.c',
+	'src/syscall/copy.c',
+	'src/syscall/syscall.c',
+	'src/sysinfo/stats.c',
+	'src/time/clock.c',
+	'src/time/delay.c',
+	'src/time/timeout.c',
+)
+
+instrumentable_src += files(
+	'src/cpu/cpu.c',
+	'src/ddi/ddi.c',
+	'src/interrupt/interrupt.c',
+	'src/main/kinit.c',
+	'src/main/main.c',
+	'src/mm/as.c',
+	'src/mm/frame.c',
+	'src/mm/page.c',
+	'src/mm/slab.c',
+	'src/mm/tlb.c',
+	'src/proc/current.c',
+	'src/sysinfo/sysinfo.c',
+)
+
+## Kernel console support
+#
+
+if CONFIG_KCONSOLE
+	generic_src += files('src/console/cmd.c')
+	instrumentable_src += files('src/console/kconsole.c')
+endif
+
+## Udebug interface sources
+#
+
+if CONFIG_UDEBUG
+	generic_src += files(
+		'src/ipc/kbox.c',
+		'src/udebug/udebug.c',
+		'src/udebug/udebug_ops.c',
+		'src/udebug/udebug_ipc.c',
+	)
+endif
Index: kernel/meson.build
===================================================================
--- kernel/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
+++ kernel/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -0,0 +1,186 @@
+
+## The at-sign
+#
+# The `atsign` variable holds the ASCII character representing the at-sign
+# ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that
+# don't use '@' for starting a comment, `atsign` is merely '@'. However, on
+# those that do use it for starting a comment (e.g. arm32), `atsign` must be
+# defined as the percentile-sign ('%') in the architecture-dependent files.
+#
+atsign = '@'
+
+## Some architectures need a particular string at the beginning of assembly files.
+as_prolog = ''
+
+kernel_c_args = []
+kernel_link_args = []
+kernel_includes = []
+arch_src = []
+
+subdir('arch' / h_arch)
+subdir('genarch')
+subdir('generic')
+subdir('test')
+
+## Cross-platform assembly to start a symtab.data section
+#
+symtab_section = '.section symtab.data, "a", ' + atsign + 'progbits;'
+
+kernel_includes += include_directories(
+	'generic/include',
+	'genarch/include',
+	'arch' / h_arch / 'include',
+	'..' / 'abi' / 'arch' / h_arch / 'include',
+	'..' / 'abi' / 'include',
+	'test',
+)
+
+kernel_defs = [
+	'-imacros', meson.source_root() / 'config.h',
+	'-D_HELENOS_SOURCE',
+	'-DKERNEL',
+	'-DRELEASE=' + HELENOS_RELEASE,
+	'-DCOPYRIGHT=' + HELENOS_COPYRIGHT,
+	'-DNAME=' + HELENOS_NAME,
+	'-D__@0@_BITS__'.format(meson.get_cross_property('bits')),
+]
+
+kernel_ldscript = custom_target('_link.ld',
+	input: 'arch' / h_arch / '_link.ld.in',
+	output: '_link.ld',
+	command: [
+		cc.cmd_array(),
+		kernel_defs,
+		'-I' + meson.current_source_dir() / 'arch' / h_arch / 'include',
+		'-D__ASSEMBLER__',
+		'-D__LINKER__',
+		'-E',
+		'-P',
+		'-x', 'c',
+		'@INPUT@',
+	],
+	capture: true,
+)
+
+kernel_link_args += [
+	'-Wl,--nmagic',
+	'-T', meson.current_build_dir() / '_link.ld',
+]
+
+if CONFIG_STRIP_BINARIES
+	# TODO: let meson do this
+	kernel_link_args += [ '-s' ]
+endif
+
+kernel_c_args += kernel_defs + [
+	'-ffreestanding',
+	# TODO: remove this flag
+	'-Wno-cast-function-type',
+]
+
+if cc.get_id() == 'clang'
+	kernel_c_args += [
+		'-fno-stack-protector',
+		'-fno-PIC',
+		'-mllvm', '-asm-macro-max-nesting-depth=1000',
+	]
+endif
+
+instrumentables = static_library('instrumentables', instrumentable_src,
+	include_directories: kernel_includes,
+	implicit_include_directories: false,
+	c_args: kernel_c_args + (CONFIG_TRACE ? [ '-finstrument-functions' ] : []),
+	pic: false,
+)
+
+noninstrumentables = static_library('noninstrumentables', arch_src, genarch_src, generic_src, test_src,
+	include_directories: kernel_includes,
+	implicit_include_directories: false,
+	c_args: kernel_c_args,
+	pic: false,
+)
+
+all_kernel_objects = [ instrumentables, noninstrumentables ]
+
+# We iterate the build several times to get symbol table right.
+# Three times is sufficient to get correct even symbols after symtab.
+
+if CONFIG_SYMTAB
+	# Iterate build three times.
+	iterations = [ 1, 2, 3 ]
+
+	# Generates symbol table information as an object file.
+	genmap = find_program('tools/genmap.py')
+
+	# Symbol table dump needed for genmap.
+	kernel_syms = custom_target('kernel_syms.txt',
+		input: all_kernel_objects,
+		output: 'kernel_syms.txt',
+		command: [ objdump, '-t', '@INPUT@' ],
+		capture: true,
+	)
+else
+	# Build just once.
+	iterations = [ 1 ]
+endif
+
+# Empty symbol map for first iteration.
+kernel_map_S = custom_target('empty_map.S',
+	output: 'empty_map.S',
+	capture: true,
+	command: [ 'echo', as_prolog + symtab_section ],
+)
+
+foreach iter : iterations
+	is_last = (iter == iterations.length())
+	kernel_name = is_last ? 'kernel' : 'kernel.@0@'.format(iter)
+	kernel_map_name = kernel_name + '.map'
+	kernel_map_path = meson.current_build_dir() / kernel_map_name
+
+	kernel_elf = executable(kernel_name + '.elf', kernel_map_S,
+		include_directories: kernel_includes,
+		implicit_include_directories: false,
+		c_args: kernel_c_args,
+		link_args: kernel_c_args + kernel_link_args + [
+			'-Wl,-Map,' + kernel_map_path,
+		],
+		link_depends: kernel_ldscript,
+		link_whole: all_kernel_objects,
+		install: is_last,
+		install_dir: 'boot',
+		pie: false,
+	)
+
+	# Generate symbol table if this is not the final iteration.
+	if not is_last
+
+		# TODO: Teach kernel to read its own ELF symbol table and get rid of this nonsense.
+		# Need to first make sure all architectures (even future ones with dumb bootloaders) can use ELF formatted kernel.
+
+		kernel_map_bin = custom_target(kernel_map_name + '.bin',
+			output: kernel_map_name + '.bin',
+			input: [ kernel_elf, kernel_syms ],
+			command: [ genmap, kernel_map_path, '@INPUT1@', '@OUTPUT@' ],
+		)
+
+		kernel_map_S_name = kernel_name + '.map.S'
+
+		kernel_map_S = custom_target(kernel_map_S_name,
+			input: kernel_map_bin,
+			output: kernel_map_S_name,
+			capture: true,
+			command: [ 'echo', as_prolog + symtab_section + ' .incbin "@INPUT@"' ],
+		)
+	endif
+endforeach
+
+kernel_disasm = custom_target(kernel_name + '.disasm',
+	command: [ objdump, '-S', '@INPUT@' ],
+	input: kernel_elf,
+	output: kernel_name + '.disasm',
+	capture: true,
+	build_by_default: true,
+	# TODO: Add configuration option for installing debug files
+	install: false,
+	install_dir: 'debug' / 'kernel',
+)
Index: kernel/test/meson.build
===================================================================
--- kernel/test/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
+++ kernel/test/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -0,0 +1,37 @@
+## Test sources
+#
+
+test_src = []
+
+if CONFIG_TEST
+	test_src += files(
+		'test.c',
+		'atomic/atomic1.c',
+		'fault/fault1.c',
+		'mm/falloc1.c',
+		'mm/falloc2.c',
+		'mm/mapping1.c',
+		'mm/slab1.c',
+		'mm/slab2.c',
+		'synch/semaphore1.c',
+		'synch/semaphore2.c',
+		'print/print1.c',
+		'print/print2.c',
+		'print/print3.c',
+		'print/print4.c',
+		'print/print5.c',
+		'thread/thread1.c',
+	)
+
+	if h_arch == 'mips32'
+		test_src += files('debug/mips1.c')
+	else
+		test_src += files('debug/mips1_skip.c')
+	endif
+
+	if h_arch == 'ia64'
+		test_src += files('mm/purge1.c')
+	else
+		test_src += files('mm/purge1_skip.c')
+	endif
+endif
Index: meson.build
===================================================================
--- meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -310,5 +310,5 @@
 endforeach
 
-#subdir('kernel')
+subdir('kernel')
 subdir('uspace')
 
Index: pace/lib/c/arch/amd64/Makefile.common
===================================================================
--- uspace/lib/c/arch/amd64/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,38 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-# TODO: We need to implement DWARF unwinding and get rid of this flag.
-COMMON_CFLAGS += -fno-omit-frame-pointer -Wl,-z,max-page-size=0x1000
-
-# XXX: This architecture requires unoptimized TLS pointer access,
-#      as with the GCC option `-mno-tls-direct-seg-refs`.
-#      The `amd64-helenos` target defaults to this behavior.
-
-LDFLAGS += -Wl,--gc-sections
-
-
Index: pace/lib/c/arch/amd64/Makefile.inc
===================================================================
--- uspace/lib/c/arch/amd64/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-ARCH_SOURCES = \
-	arch/$(UARCH)/src/entryjmp.S \
-	arch/$(UARCH)/src/thread_entry.S \
-	arch/$(UARCH)/src/syscall.S \
-	arch/$(UARCH)/src/fibril.S \
-	arch/$(UARCH)/src/tls.c \
-	arch/$(UARCH)/src/stacktrace.c \
-	arch/$(UARCH)/src/stacktrace_asm.S \
-	arch/$(UARCH)/src/rtld/dynamic.c \
-	arch/$(UARCH)/src/rtld/reloc.c
-
-ARCH_AUTOCHECK_HEADERS = \
-	arch/$(UARCH)/include/libarch/fibril_context.h
Index: pace/lib/c/arch/arm32/Makefile.common
===================================================================
--- uspace/lib/c/arch/arm32/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2007 Michal Kebrt
-# Copyright (c) 2007 Pavel Jancik
-# 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.
-#
-
-COMMON_CFLAGS += -ffixed-r9 -mtp=soft -fno-omit-frame-pointer -mapcs-frame \
-	-mcpu=$(subst _,-,$(PROCESSOR)) -Wl,-z,max-page-size=0x1000
-
-LDFLAGS += -Wl,--gc-sections
-
-ifeq ($(CONFIG_FPU),y)
-	COMMON_CFLAGS += -mfloat-abi=hard
-endif
-
-
Index: pace/lib/c/arch/arm32/Makefile.inc
===================================================================
--- uspace/lib/c/arch/arm32/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,41 +1,0 @@
-#
-# Copyright (c) 2007 Michal Kebrt
-# Copyright (c) 2007 Pavel Jancik
-# 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.
-#
-
-ARCH_SOURCES = \
-	arch/$(UARCH)/src/atomic.c \
-	arch/$(UARCH)/src/entryjmp.S \
-	arch/$(UARCH)/src/thread_entry.S \
-	arch/$(UARCH)/src/syscall.c \
-	arch/$(UARCH)/src/fibril.S \
-	arch/$(UARCH)/src/tls.c \
-	arch/$(UARCH)/src/eabi.S \
-	arch/$(UARCH)/src/stacktrace.c \
-	arch/$(UARCH)/src/stacktrace_asm.S \
-	arch/$(UARCH)/src/rtld/dynamic.c \
-	arch/$(UARCH)/src/rtld/reloc.c
Index: pace/lib/c/arch/arm64/Makefile.common
===================================================================
--- uspace/lib/c/arch/arm64/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,33 +1,0 @@
-#
-# Copyright (c) 2015 Petr Pavlu
-# 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.
-#
-
-COMMON_CFLAGS += -fno-omit-frame-pointer
-
-LDFLAGS += -Wl,--gc-sections
-
-
Index: pace/lib/c/arch/arm64/Makefile.inc
===================================================================
--- uspace/lib/c/arch/arm64/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2015 Petr Pavlu
-# 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.
-#
-
-ARCH_SOURCES = \
-	arch/$(UARCH)/src/entryjmp.S \
-	arch/$(UARCH)/src/fibril.S \
-	arch/$(UARCH)/src/stacktrace.c \
-	arch/$(UARCH)/src/stacktrace_asm.S \
-	arch/$(UARCH)/src/syscall.c \
-	arch/$(UARCH)/src/tls.c \
-	arch/$(UARCH)/src/thread_entry.S
-
-ARCH_AUTOCHECK_HEADERS = \
-	arch/$(UARCH)/include/libarch/fibril_context.h
Index: pace/lib/c/arch/ia64/Makefile.common
===================================================================
--- uspace/lib/c/arch/ia64/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,32 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-COMMON_CFLAGS += -fno-unwind-tables
-LDFLAGS += -Wl,--gc-sections
-
-
Index: pace/lib/c/arch/ia64/Makefile.inc
===================================================================
--- uspace/lib/c/arch/ia64/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-ARCH_SOURCES = \
-	arch/$(UARCH)/src/entryjmp.S \
-	arch/$(UARCH)/src/thread_entry.S \
-	arch/$(UARCH)/src/syscall.S \
-	arch/$(UARCH)/src/fibril.S \
-	arch/$(UARCH)/src/tls.c \
-	arch/$(UARCH)/src/ddi.c \
-	arch/$(UARCH)/src/stacktrace.c \
-	arch/$(UARCH)/src/stacktrace_asm.S \
-	arch/$(UARCH)/src/rtld/dynamic.c \
-	arch/$(UARCH)/src/rtld/reloc.c
-
-ARCH_AUTOCHECK_HEADERS = \
-	arch/$(UARCH)/include/libarch/fibril_context.h
Index: uspace/lib/c/arch/ia64/meson.build
===================================================================
--- uspace/lib/c/arch/ia64/meson.build	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ uspace/lib/c/arch/ia64/meson.build	(revision 2fff3c4405a90b5bd3f42603d5368be8b87be9e7)
@@ -10,4 +10,6 @@
 	'src/stacktrace.c',
 	'src/stacktrace_asm.S',
+	'src/rtld/dynamic.c',
+	'src/rtld/reloc.c',
 )
 
Index: pace/lib/c/arch/mips32/Makefile.common
===================================================================
--- uspace/lib/c/arch/mips32/Makefile.common	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,43 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-COMMON_CFLAGS += -msoft-float -mabi=32
-AS_PROLOG = .module softfloat;.abicalls;
-LDFLAGS += -Wl,--gc-sections
-
-ifeq ($(MACHINE),msim)
-	COMMON_CFLAGS += -march=r4000
-endif
-
-ifeq ($(MACHINE),lmalta)
-	COMMON_CFLAGS += -march=4kc
-endif
-
-ifeq ($(MACHINE),bmalta)
-	COMMON_CFLAGS += -march=4kc
-endif
Index: pace/lib/c/arch/mips32/Makefile.inc
===================================================================
--- uspace/lib/c/arch/mips32/Makefile.inc	(revision ecf56f8012dce1cff83b7c7cd0cdab2b6e1d082f)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#
-# Copyright (c) 2005 Martin Decky
-# 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.
-#
-
-ARCH_SOURCES = \
-	arch/$(UARCH)/src/entryjmp.S \
-	arch/$(UARCH)/src/thread_entry.S \
-	arch/$(UARCH)/src/syscall.c \
-	arch/$(UARCH)/src/fibril.S \
-	arch/$(UARCH)/src/tls.c \
-	arch/$(UARCH)/src/stacktrace.c \
-	arch/$(UARCH)/src/stacktrace_asm.S
-
-ARCH_AUTOCHECK_HEADERS = \
-	arch/$(UARCH)/include/libarch/fibril_context.h
