Module Name: src
Committed By: matt
Date: Thu Jul 11 16:40:28 UTC 2013
Added Files:
src/lib/csu/arch/alpha: Makefile.inc crt0.S crtbegin.h crtend.S crti.S
crtn.S
Log Message:
Add crtstuff for alpha. Compile tested only.
To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/csu/arch/alpha/Makefile.inc \
src/lib/csu/arch/alpha/crt0.S src/lib/csu/arch/alpha/crtbegin.h \
src/lib/csu/arch/alpha/crtend.S src/lib/csu/arch/alpha/crti.S \
src/lib/csu/arch/alpha/crtn.S
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Added files:
Index: src/lib/csu/arch/alpha/Makefile.inc
diff -u /dev/null src/lib/csu/arch/alpha/Makefile.inc:1.1
--- /dev/null Thu Jul 11 16:40:28 2013
+++ src/lib/csu/arch/alpha/Makefile.inc Thu Jul 11 16:40:27 2013
@@ -0,0 +1,3 @@
+# $NetBSD: Makefile.inc,v 1.1 2013/07/11 16:40:27 matt Exp $
+
+CPPFLAGS+= -I${ARCHDIR} -DELFSIZE=64
Index: src/lib/csu/arch/alpha/crt0.S
diff -u /dev/null src/lib/csu/arch/alpha/crt0.S:1.1
--- /dev/null Thu Jul 11 16:40:28 2013
+++ src/lib/csu/arch/alpha/crt0.S Thu Jul 11 16:40:27 2013
@@ -0,0 +1,54 @@
+/* $NetBSD: crt0.S,v 1.1 2013/07/11 16:40:27 matt Exp $ */
+
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+#include <alpha/asm.h>
+
+RCSID("$NetBSD: crt0.S,v 1.1 2013/07/11 16:40:27 matt Exp $")
+
+STRONG_ALIAS(_start,__start)
+
+/*
+ * Assumes kernel (or ld_elf.so) passes the following parameters to
+ * user-space in registers:
+ *
+ * a0 stack pointer
+ * a1 cleanup
+ * a2 Obj_Entry
+ * a3 ps_strings
+ */
+
+LEAF(__start, 4)
+ LDGP(pv)
+ mov a1, a0 /* cleanup */
+ mov a2, a1 /* Obj_Entry */
+ mov a3, a2 /* ps_strings */
+ CALL(___start)
+END(__start)
Index: src/lib/csu/arch/alpha/crtbegin.h
diff -u /dev/null src/lib/csu/arch/alpha/crtbegin.h:1.1
--- /dev/null Thu Jul 11 16:40:28 2013
+++ src/lib/csu/arch/alpha/crtbegin.h Thu Jul 11 16:40:27 2013
@@ -0,0 +1,50 @@
+/* $NetBSD: crtbegin.h,v 1.1 2013/07/11 16:40:27 matt Exp $ */
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+#include <sys/cdefs.h>
+#include <alpha/asm.h>
+
+/* Assume we need to reload our GP. */
+__asm( ".pushsection .init"
+"\n\t" "br $29, 1f"
+"\n\t" "1: ldgp $29, 0($29)"
+"\n\t" "unop"
+"\n\t" "jsr $26, __do_global_ctors_aux"
+"\n\t" ".p2align 3"
+"\n\t" ".popsection");
+
+/* Assume we need to reload our GP. */
+__asm( ".pushsection .fini"
+"\n\t" "br $29, 1f"
+"\n\t" "1: ldgp $29, 0($29)"
+"\n\t" "unop"
+"\n\t" "jsr $26, __do_global_dtors_aux"
+"\n\t" ".p2align 3"
+"\n\t" ".popsection");
Index: src/lib/csu/arch/alpha/crtend.S
diff -u /dev/null src/lib/csu/arch/alpha/crtend.S:1.1
--- /dev/null Thu Jul 11 16:40:28 2013
+++ src/lib/csu/arch/alpha/crtend.S Thu Jul 11 16:40:27 2013
@@ -0,0 +1,55 @@
+/* $NetBSD: crtend.S,v 1.1 2013/07/11 16:40:27 matt Exp $ */
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+#include <alpha/asm.h>
+
+RCSID("$NetBSD: crtend.S,v 1.1 2013/07/11 16:40:27 matt Exp $")
+
+ .section .ctors, "aw", @progbits
+ .p2align 3
+ .global __CTOR_LIST_END__
+ .hidden __CTOR_LIST_END__
+__CTOR_LIST_END__:
+ .word 0
+
+ .section .dtors, "aw", @progbits
+ .p2align 3
+ .global __DTOR_LIST_END__
+ .hidden __DTOR_LIST_END__
+__DTOR_LIST_END__:
+ .word 0
+
+ .section .eh_frame, "a", @progbits
+ .p2align 3
+ .word 0
+
+ .section .jcr, "aw", @progbits
+ .p2align 3
+ .word 0
Index: src/lib/csu/arch/alpha/crti.S
diff -u /dev/null src/lib/csu/arch/alpha/crti.S:1.1
--- /dev/null Thu Jul 11 16:40:28 2013
+++ src/lib/csu/arch/alpha/crti.S Thu Jul 11 16:40:27 2013
@@ -0,0 +1,55 @@
+/* $NetBSD: crti.S,v 1.1 2013/07/11 16:40:27 matt Exp $ */
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+#include <alpha/asm.h>
+
+RCSID("$NetBSD: crti.S,v 1.1 2013/07/11 16:40:27 matt Exp $")
+
+#include "sysident.S"
+
+ .section ".init", "ax", @progbits
+ .global _init
+ .type _init, @function
+_init:
+ LDGP(pv)
+ lda sp, -32(sp)
+ stq ra, 0(sp)
+ stq gp, 8(sp)
+ .p2align 5
+
+ .section ".fini", "ax", @progbits
+ .global _fini
+ .type _fini, @function
+_fini:
+ LDGP(pv)
+ lda sp, -32(sp)
+ stq ra, 0(sp)
+ stq gp, 8(sp)
+ .p2align 5
Index: src/lib/csu/arch/alpha/crtn.S
diff -u /dev/null src/lib/csu/arch/alpha/crtn.S:1.1
--- /dev/null Thu Jul 11 16:40:28 2013
+++ src/lib/csu/arch/alpha/crtn.S Thu Jul 11 16:40:27 2013
@@ -0,0 +1,45 @@
+/* $NetBSD: crtn.S,v 1.1 2013/07/11 16:40:27 matt Exp $ */
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``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 FOUNDATION OR CONTRIBUTORS
+ * 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.
+ */
+
+#include <alpha/asm.h>
+
+RCSID("$NetBSD: crtn.S,v 1.1 2013/07/11 16:40:27 matt Exp $")
+
+ .section ".init", "ax", @progbits
+ ldq gp, 8(sp)
+ ldq ra, 0(sp)
+ lda sp, 32(sp)
+ RET
+
+ .section ".fini", "ax", @progbits
+ ldq gp, 8(sp)
+ ldq ra, 0(sp)
+ lda sp, 32(sp)
+ RET