Index: libc/Makefile
===================================================================
--- libc/Makefile	(revision b7e65d4a00b31b5bc17e54551c9d99653b2999f9)
+++ libc/Makefile	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
@@ -44,7 +44,6 @@
 	generic/io.c
 
-ARCH_SOURCES = \
-	arch/$(ARCH)/src/entry.s \
-	arch/$(ARCH)/src/syscall.c
+ARCH_SOURCES += \
+	arch/$(ARCH)/src/entry.s
 
 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
Index: libc/arch/amd64/Makefile.inc
===================================================================
--- libc/arch/amd64/Makefile.inc	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
+++ libc/arch/amd64/Makefile.inc	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
@@ -0,0 +1,35 @@
+#
+# 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.
+#
+
+## Toolchain configuration
+#
+
+TARGET = amd64-linux-gnu
+TOOLCHAIN_DIR = /usr/local/amd64/bin
+
+ARCH_SOURCES += arch/$(ARCH)/src/syscall.S
Index: libc/arch/amd64/_link.ld.in
===================================================================
--- libc/arch/amd64/_link.ld.in	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
+++ libc/arch/amd64/_link.ld.in	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
@@ -0,0 +1,8 @@
+OUTPUT_FORMAT(binary)
+STARTUP(../libc/arch/ARCH/src/entry.o)
+ENTRY(__entry)
+
+SECTIONS {
+ .text 0x00001000 : {
+ }
+}
Index: libc/arch/amd64/include/types.h
===================================================================
--- libc/arch/amd64/include/types.h	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
+++ libc/arch/amd64/include/types.h	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2006 Ondrej Palkovsky
+ * 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.
+ */
+
+#ifndef __LIBC__TYPES_H__
+#define __LIBC__TYPES_H__
+
+typedef unsigned long long sysarg_t;
+typedef unsigned int size_t;
+typedef signed int ssize_t;
+
+#endif
Index: libc/arch/amd64/src/entry.s
===================================================================
--- libc/arch/amd64/src/entry.s	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
+++ libc/arch/amd64/src/entry.s	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2006 Ondrej Palkovsky
+# 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.
+#
+
+.text
+
+.org 0
+
+.globl __entry
+
+## User-space task entry point
+#
+#
+__entry:
+	call main
+	call __exit
+	
+.end __entry
Index: libc/arch/amd64/src/syscall.S
===================================================================
--- libc/arch/amd64/src/syscall.S	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
+++ libc/arch/amd64/src/syscall.S	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2006 Ondrej Palkovsky
+# 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.
+#
+
+.text
+	
+.globl __syscall
+
+	
+__syscall:
+	# rcx gets rewritten on syscall
+	movq %rcx, %r9
+	syscall
+	ret
+	
+.end __syscall
Index: libc/arch/ia32/Makefile.inc
===================================================================
--- libc/arch/ia32/Makefile.inc	(revision b7e65d4a00b31b5bc17e54551c9d99653b2999f9)
+++ libc/arch/ia32/Makefile.inc	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
@@ -32,2 +32,4 @@
 TARGET = i686-pc-linux-gnu
 TOOLCHAIN_DIR = /usr/local/i686/bin
+
+ARCH_SOURCES += arch/$(ARCH)/src/syscall.c
Index: libc/arch/mips32/Makefile.inc
===================================================================
--- libc/arch/mips32/Makefile.inc	(revision b7e65d4a00b31b5bc17e54551c9d99653b2999f9)
+++ libc/arch/mips32/Makefile.inc	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
@@ -33,2 +33,4 @@
 TOOLCHAIN_DIR = /usr/local/mipsel/bin
 CFLAGS += -mno-abicalls -mips3 
+
+ARCH_SOURCES += arch/$(ARCH)/src/syscall.c
Index: libc/arch/mips32eb/_link.ld.in
===================================================================
--- libc/arch/mips32eb/_link.ld.in	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
+++ libc/arch/mips32eb/_link.ld.in	(revision f1f95f291dac786cc80a0343251b409cea02a4c1)
@@ -0,0 +1,1 @@
+../mips32/_link.ld.in
