Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src NetBSD, meet the SH-5 cpu.



details:   https://anonhg.NetBSD.org/src/rev/06ebb21d54f5
branches:  trunk
changeset: 533614:06ebb21d54f5
user:      scw <scw%NetBSD.org@localhost>
date:      Fri Jul 05 13:31:28 2002 +0000

description:
NetBSD, meet the SH-5 cpu.
SH-5, meet NetBSD.

Let's hope this is the start of a long and fruitful relationship. :-)

This code, funded by Wasabi Systems, adds initial support for the
Hitachi SuperH(tm) SH-5 cpu architecture to NetBSD.

At the present time, NetBSD/evbsh5 only runs on a SH-5 core simulator
which has no simulated devices other than a simple console. However, it
is good enough to get to the "root device: " prompt.

Device driver support for Real SH-5 Hardware is in place, particularly for
supporting the up-coming Cayman evaluation board, and should be quite
easy to get running when the hardware is available.

There is no in-tree toolchain for this port at this time. Gcc-current has
rudimentary SH-5 support but it is known to be buggy. A working toolchain
was obtained from SuperH to facilitate this port. Gcc-current will be
fixed in due course.

The SH-5 architecture is fully 64-bit capable, although NetBSD/evbsh5 has
currently only been tested in 32-bit mode. It is bi-endian, via a boot-
time option and it also has an "SHcompact" mode in which it will execute
SH-[34] user-land instructions.

For more information on the SH-5, see www.superh.com. Suffice to say it
is *not* just another respin of the SH-[34].

diffstat:

 lib/csu/sh5/Makefile                     |     6 +
 lib/csu/sh5/crt0.c                       |    90 +
 lib/csu/sh5/dot_init.h                   |   108 +
 lib/libc/arch/sh5/gen/Makefile.inc       |     9 +
 lib/libc/arch/sh5/gen/_setjmp.S          |   141 ++
 lib/libc/arch/sh5/gen/alloca.S           |    45 +
 lib/libc/arch/sh5/gen/byte_swap_2.S      |    49 +
 lib/libc/arch/sh5/gen/byte_swap_4.S      |    49 +
 lib/libc/arch/sh5/gen/byte_swap_8.S      |    44 +
 lib/libc/arch/sh5/gen/fabs.S             |    43 +
 lib/libc/arch/sh5/gen/sigsetjmp.S        |    42 +
 lib/libc/arch/sh5/net/Makefile.inc       |     7 +
 lib/libc/arch/sh5/stdlib/Makefile.inc    |     3 +
 lib/libc/arch/sh5/stdlib/abs.S           |    47 +
 lib/libc/arch/sh5/stdlib/llabs.S         |    47 +
 lib/libc/arch/sh5/sys/Ovfork.S           |   103 +
 lib/libc/arch/sh5/sys/__clone.S          |    68 +
 lib/libc/arch/sh5/sys/__semctl.S         |    42 +
 lib/libc/arch/sh5/sys/__sigreturn14.S    |    44 +
 lib/libc/arch/sh5/sys/__syscall.S        |    40 +
 lib/libc/arch/sh5/sys/__vfork14.S        |   100 +
 lib/libc/arch/sh5/sys/brk.S              |   110 +
 lib/libc/arch/sh5/sys/cerror.S           |   107 +
 lib/libc/arch/sh5/sys/exect.S            |    89 +
 lib/libc/arch/sh5/sys/fork.S             |    93 +
 lib/libc/arch/sh5/sys/msgctl.S           |    45 +
 lib/libc/arch/sh5/sys/pipe.S             |    96 +
 lib/libc/arch/sh5/sys/ptrace.S           |   109 +
 lib/libc/arch/sh5/sys/sbrk.S             |   108 +
 lib/libc/arch/sh5/sys/setlogin.S         |    86 +
 lib/libc/arch/sh5/sys/shmat.S            |    79 +
 lib/libc/arch/sh5/sys/shmctl.S           |    45 +
 lib/libc/arch/sh5/sys/sigaction.S        |    45 +
 lib/libc/arch/sh5/sys/sigpending.S       |    94 +
 lib/libc/arch/sh5/sys/sigprocmask.S      |   104 +
 lib/libc/arch/sh5/sys/sigreturn.S        |    43 +
 lib/libc/arch/sh5/sys/sigsuspend.S       |    92 +
 lib/libc/arch/sh5/sys/syscall.S          |    40 +
 sys/arch/README                          |     6 +-
 sys/arch/evbsh5/compile/.keep_me         |     1 +
 sys/arch/evbsh5/conf/CAYMAN              |   118 +
 sys/arch/evbsh5/conf/SIMULATOR           |    61 +
 sys/arch/evbsh5/conf/files.evbsh5        |    21 +
 sys/arch/evbsh5/conf/std.evbsh5.el       |    10 +
 sys/arch/evbsh5/dev/superio.c            |   708 +++++++++++
 sys/arch/evbsh5/dev/superioreg.h         |   107 +
 sys/arch/evbsh5/dev/superiovar.h         |    54 +
 sys/arch/evbsh5/dev/sysfpga.c            |   329 +++++
 sys/arch/evbsh5/dev/sysfpgareg.h         |   107 +
 sys/arch/evbsh5/dev/sysfpgavar.h         |    77 +
 sys/arch/evbsh5/evbsh5/cons_machdep.c    |   184 ++
 sys/arch/evbsh5/evbsh5/locore.S          |   192 +++
 sys/arch/evbsh5/evbsh5/machdep.c         |   339 +++++
 sys/arch/evbsh5/evbsh5/machdep.h         |    49 +
 sys/arch/evbsh5/evbsh5/mainbus.c         |   109 +
 sys/arch/evbsh5/include/ansi.h           |     3 +
 sys/arch/evbsh5/include/aout_machdep.h   |     3 +
 sys/arch/evbsh5/include/asm.h            |     3 +
 sys/arch/evbsh5/include/bootparams.h     |    46 +
 sys/arch/evbsh5/include/bswap.h          |     3 +
 sys/arch/evbsh5/include/bus.h            |    45 +
 sys/arch/evbsh5/include/cacheops.h       |     3 +
 sys/arch/evbsh5/include/cdefs.h          |     3 +
 sys/arch/evbsh5/include/conreg.h         |     3 +
 sys/arch/evbsh5/include/cpu.h            |     6 +
 sys/arch/evbsh5/include/disklabel.h      |     3 +
 sys/arch/evbsh5/include/elf_machdep.h    |     3 +
 sys/arch/evbsh5/include/endian.h         |     3 +
 sys/arch/evbsh5/include/endian_machdep.h |    10 +
 sys/arch/evbsh5/include/frame.h          |     3 +
 sys/arch/evbsh5/include/int_const.h      |     3 +
 sys/arch/evbsh5/include/int_fmtio.h      |     3 +
 sys/arch/evbsh5/include/int_limits.h     |     3 +
 sys/arch/evbsh5/include/int_mwgwtypes.h  |     3 +
 sys/arch/evbsh5/include/int_types.h      |     3 +
 sys/arch/evbsh5/include/intr.h           |    48 +
 sys/arch/evbsh5/include/isa_machdep.h    |    72 +
 sys/arch/evbsh5/include/limits.h         |     3 +
 sys/arch/evbsh5/include/lock.h           |     3 +
 sys/arch/evbsh5/include/memregion.h      |     3 +
 sys/arch/evbsh5/include/param.h          |    25 +
 sys/arch/evbsh5/include/pcb.h            |     3 +
 sys/arch/evbsh5/include/pmap.h           |     3 +
 sys/arch/evbsh5/include/proc.h           |     3 +
 sys/arch/evbsh5/include/ptrace.h         |     3 +
 sys/arch/evbsh5/include/reg.h            |     3 +
 sys/arch/evbsh5/include/setjmp.h         |     3 +
 sys/arch/evbsh5/include/signal.h         |     3 +
 sys/arch/evbsh5/include/stdarg.h         |     3 +
 sys/arch/evbsh5/include/trap.h           |     3 +
 sys/arch/evbsh5/include/types.h          |     3 +
 sys/arch/evbsh5/include/varargs.h        |     3 +
 sys/arch/evbsh5/include/vmparam.h        |     3 +
 sys/arch/sh5/conf/Makefile.sh5           |   102 +
 sys/arch/sh5/conf/files.sh5              |   127 ++
 sys/arch/sh5/dev/cprc.c                  |   349 +++++
 sys/arch/sh5/dev/cprcreg.h               |    95 +
 sys/arch/sh5/dev/cprcvar.h               |    64 +
 sys/arch/sh5/dev/cpu_sh.c                |   107 +
 sys/arch/sh5/dev/dtfcons.c               |   207 +++
 sys/arch/sh5/dev/dtfconsvar.h            |    44 +
 sys/arch/sh5/dev/femi.c                  |   160 ++
 sys/arch/sh5/dev/femivar.h               |    48 +
 sys/arch/sh5/dev/intc.c                  |   214 +++
 sys/arch/sh5/dev/intcreg.h               |   194 +++
 sys/arch/sh5/dev/intcvar.h               |    52 +
 sys/arch/sh5/dev/pbridge.c               |   165 ++
 sys/arch/sh5/dev/pbridgereg.h            |    57 +
 sys/arch/sh5/dev/pbridgevar.h            |    52 +
 sys/arch/sh5/dev/rtc.c                   |   248 +++
 sys/arch/sh5/dev/rtcreg.h                |    91 +
 sys/arch/sh5/dev/rtcvar.h                |    43 +
 sys/arch/sh5/dev/scif.c                  |  1520 ++++++++++++++++++++++++
 sys/arch/sh5/dev/scifreg.h               |   144 ++
 sys/arch/sh5/dev/scifvar.h               |     4 +
 sys/arch/sh5/dev/superhyway.c            |   113 +
 sys/arch/sh5/dev/superhywayvar.h         |    81 +
 sys/arch/sh5/dev/tmu.c                   |   242 +++
 sys/arch/sh5/dev/tmureg.h                |    90 +
 sys/arch/sh5/include/ansi.h              |    94 +
 sys/arch/sh5/include/aout_machdep.h      |    35 +
 sys/arch/sh5/include/asm.h               |   303 ++++
 sys/arch/sh5/include/bswap.h             |    95 +
 sys/arch/sh5/include/bus.h               |  1007 +++++++++++++++
 sys/arch/sh5/include/cacheops.h          |    44 +
 sys/arch/sh5/include/cdefs.h             |     7 +
 sys/arch/sh5/include/conreg.h            |   114 +
 sys/arch/sh5/include/cpu.h               |   240 +++
 sys/arch/sh5/include/cputypes.h          |    48 +
 sys/arch/sh5/include/db_machdep.h        |   118 +
 sys/arch/sh5/include/disklabel.h         |    57 +
 sys/arch/sh5/include/elf_machdep.h       |    82 +
 sys/arch/sh5/include/endian.h            |     3 +
 sys/arch/sh5/include/endian_machdep.h    |    23 +
 sys/arch/sh5/include/frame.h             |   194 +++
 sys/arch/sh5/include/int_const.h         |    63 +
 sys/arch/sh5/include/int_fmtio.h         |   219 +++
 sys/arch/sh5/include/int_limits.h        |   158 ++
 sys/arch/sh5/include/int_mwgwtypes.h     |    93 +
 sys/arch/sh5/include/int_types.h         |    70 +
 sys/arch/sh5/include/intr.h              |   109 +
 sys/arch/sh5/include/limits.h            |   107 +
 sys/arch/sh5/include/lock.h              |    55 +
 sys/arch/sh5/include/memregion.h         |    47 +
 sys/arch/sh5/include/param.h             |   136 ++
 sys/arch/sh5/include/pcb.h               |    51 +
 sys/arch/sh5/include/pmap.h              |   112 +
 sys/arch/sh5/include/proc.h              |    57 +
 sys/arch/sh5/include/pte.h               |   152 ++
 sys/arch/sh5/include/ptrace.h            |    44 +
 sys/arch/sh5/include/reg.h               |    59 +
 sys/arch/sh5/include/setjmp.h            |   111 +
 sys/arch/sh5/include/signal.h            |    92 +
 sys/arch/sh5/include/stdarg.h            |    67 +
 sys/arch/sh5/include/trap.h              |   111 +
 sys/arch/sh5/include/types.h             |    85 +
 sys/arch/sh5/include/varargs.h           |    56 +
 sys/arch/sh5/include/vmparam.h           |   194 +++
 sys/arch/sh5/sh5/autoconf.c              |    73 +
 sys/arch/sh5/sh5/bus_dma.c               |   715 +++++++++++
 sys/arch/sh5/sh5/bus_space.c             |   535 ++++++++
 sys/arch/sh5/sh5/bus_subr.S              |   201 +++
 sys/arch/sh5/sh5/clockvar.h              |    63 +
 sys/arch/sh5/sh5/conf.c                  |   327 +++++
 sys/arch/sh5/sh5/cpu_switch.S            |   495 +++++++
 sys/arch/sh5/sh5/disksubr.c              |   603 +++++++++
 sys/arch/sh5/sh5/dtf_comms.c             |   362 +++++
 sys/arch/sh5/sh5/dtf_comms.h             |    56 +
 sys/arch/sh5/sh5/exception.S             |  1299 ++++++++++++++++++++
 sys/arch/sh5/sh5/genassym.cf             |   341 +++++
 sys/arch/sh5/sh5/in_cksum.c              |   243 +++
 sys/arch/sh5/sh5/interrupt.c             |   265 ++++
 sys/arch/sh5/sh5/locore_subr.S           |   810 ++++++++++++
 sys/arch/sh5/sh5/mainbus.h               |    47 +
 sys/arch/sh5/sh5/mem.c                   |   206 +++
 sys/arch/sh5/sh5/pmap.c                  |  1896 ++++++++++++++++++++++++++++++
 sys/arch/sh5/sh5/process_machdep.c       |   370 +++++
 sys/arch/sh5/sh5/sh5_clock.c             |   320 +++++
 sys/arch/sh5/sh5/sh5_machdep.c           |   112 +
 sys/arch/sh5/sh5/sig_machdep.c           |    79 +
 sys/arch/sh5/sh5/sigcode.S               |    59 +
 sys/arch/sh5/sh5/softintr.c              |   301 ++++
 sys/arch/sh5/sh5/stb1_locore.S           |   449 +++++++
 sys/arch/sh5/sh5/stb1var.h               |    50 +
 sys/arch/sh5/sh5/syscall.c               |   397 ++++++
 sys/arch/sh5/sh5/trap.c                  |   464 +++++++
 sys/arch/sh5/sh5/vm_machdep.c            |   318 +++++
 sys/lib/libkern/arch/sh5/Makefile.inc    |    14 +
 sys/lib/libkern/arch/sh5/sdivsi3.S       |    90 +
 sys/lib/libkern/arch/sh5/udivsi3.S       |    93 +
 190 files changed, 26305 insertions(+), 2 deletions(-)

diffs (truncated from 27082 to 300 lines):

diff -r 3fd78e28bc65 -r 06ebb21d54f5 lib/csu/sh5/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/sh5/Makefile      Fri Jul 05 13:31:28 2002 +0000
@@ -0,0 +1,6 @@
+#      $NetBSD: Makefile,v 1.1 2002/07/05 13:31:28 scw Exp $
+
+#Uncomment the next line to enable the new .init fallthru
+CPPFLAGS+=     -I- -I${.CURDIR}
+
+.include "${.CURDIR}/../common_elf/Makefile.inc"
diff -r 3fd78e28bc65 -r 06ebb21d54f5 lib/csu/sh5/crt0.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/sh5/crt0.c        Fri Jul 05 13:31:28 2002 +0000
@@ -0,0 +1,90 @@
+/*     $NetBSD: crt0.c,v 1.1 2002/07/05 13:31:28 scw Exp $     */
+
+/*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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 "common.h"
+
+/*
+ * SH5 needs no assembler trampoline for _start as the kernel sets up
+ * all the necessary parameters.
+ */
+void   _start(int argc, char **argv, char **envp, void (*cleanup)(void),
+           const Obj_Entry *obj, struct ps_strings *ps_strings);
+
+void
+_start(int argc, char **argv, char **envp, void (*cleanup)(void),
+    const Obj_Entry *obj, struct ps_strings *ps_strings)
+{
+       char *pn;
+
+       environ = envp;
+
+       if ((pn = argv[0]) != NULL) {
+               if ((pn = _strrchr(argv[0], '/')) == NULL)
+                       pn = argv[0];
+               else
+                       pn++;
+       }
+
+       __progname = pn;
+
+       if (ps_strings)
+               __ps_strings = ps_strings;
+
+#ifdef DYNAMIC
+       if (&_DYNAMIC != NULL)
+               _rtld_setup(cleanup, obj);
+#endif
+
+#ifdef MCRT0
+       atexit(_mcleanup);
+       monstartup((u_long)&_eprol, (u_long)&_etext);
+#endif
+
+       atexit(_fini);
+       _init();
+
+       exit(main(argc, argv, environ));
+}
+
+/*
+ * NOTE: Leave the RCS ID _after_ _start(), in case it gets placed in .text.
+  */
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: crt0.c,v 1.1 2002/07/05 13:31:28 scw Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include "common.c"
diff -r 3fd78e28bc65 -r 06ebb21d54f5 lib/csu/sh5/dot_init.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/csu/sh5/dot_init.h    Fri Jul 05 13:31:28 2002 +0000
@@ -0,0 +1,108 @@
+/*     $NetBSD: dot_init.h,v 1.1 2002/07/05 13:31:28 scw Exp $ */
+
+/*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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.
+ */
+/*-
+ * Copyright (c) 2001 Ross Harvey
+ * All rights reserved.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * 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>                 /* RCS ID & Copyright macro defns */
+
+/*
+ * These must be extern to avoid warnings ("declared static but never defined")
+ * However, only the declaration is extern, the actually __asm() defines them
+ * as static.
+ */
+#define        INIT_FALLTHRU_DECL void init_fallthru(void)
+#define        FINI_FALLTHRU_DECL void fini_fallthru(void)
+
+#define        INIT_FALLTHRU() init_fallthru()
+#define        FINI_FALLTHRU() fini_fallthru()
+
+#define        MD_SECTION_PROLOGUE(sect, entry_pt)             \
+               __asm (                                 \
+               ".section "#sect",\"ax\",@progbits      \n"\
+               #entry_pt":                             \n"\
+               "       addi    r15, -16, r15           \n"\
+               "       st.q    r15, 0, r14             \n"\
+               "       st.q    r15, 8, r18             \n"\
+               "       add     r15, r63, r14           \n"\
+               "       /* fall thru */                 \n"\
+               ".previous")
+
+#define        MD_SECTION_EPILOGUE(sect)                       \
+               __asm (                                 \
+               ".section "#sect",\"ax\",@progbits      \n"\
+               "       ld.q    r15, 8, r18             \n"\
+               "       ld.q    r15, 0, r14             \n"\
+               "       ptabs/l r18, tr0                \n"\
+               "       addi    r15, 16, r15            \n"\
+               "       blink   tr0, r63                \n"\
+               ".previous")
+
+#define        MD_INIT_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.init, init_fallthru)
+#define        MD_FINI_SECTION_PROLOGUE MD_SECTION_PROLOGUE(.fini, fini_fallthru)
+
+#define        MD_INIT_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.init)
+#define        MD_FINI_SECTION_EPILOGUE MD_SECTION_EPILOGUE(.fini)
diff -r 3fd78e28bc65 -r 06ebb21d54f5 lib/libc/arch/sh5/gen/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/sh5/gen/Makefile.inc        Fri Jul 05 13:31:28 2002 +0000
@@ -0,0 +1,9 @@
+#      $NetBSD: Makefile.inc,v 1.1 2002/07/05 13:31:29 scw Exp $
+
+SRCS+= alloca.S \
+       byte_swap_2.S byte_swap_4.S byte_swap_8.S \
+       fabs.S \
+       sigsetjmp.S _setjmp.S
+
+LSRCS+= Lint_bswap16.c Lint_bswap32.c Lint_bswap64.c
+DPSRCS+= Lint_bswap16.c Lint_bswap32.c Lint_bswap64.c
diff -r 3fd78e28bc65 -r 06ebb21d54f5 lib/libc/arch/sh5/gen/_setjmp.S
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/libc/arch/sh5/gen/_setjmp.S   Fri Jul 05 13:31:28 2002 +0000
@@ -0,0 +1,141 @@
+/*     $NetBSD: _setjmp.S,v 1.1 2002/07/05 13:31:30 scw Exp $  */
+
+/*
+ * Copyright 2002 Wasabi Systems, Inc.
+ * All rights reserved.
+ *
+ * Written by Steve C. Woodford for Wasabi Systems, Inc.
+ *
+ * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *      This product includes software developed for the NetBSD Project by
+ *      Wasabi Systems, Inc.
+ * 4. The name of Wasabi Systems, Inc. may not be used to endorse
+ *    or promote products derived from this software without specific prior
+ *    written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
+ * 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 <machine/asm.h>
+
+#define _O(n)  ((n)*8)
+
+/*
+ * C library -- _setjmp, _longjmp
+ *
+ *      _longjmp(a,v)
+ * will generate a "return(v)" from
+ * the last call to
+ *      _setjmp(a)
+ * by restoring registers from the stack,
+ * The previous signal state is NOT restored.
+ */
+
+ENTRY_NOPROFILE(_setjmp)
+       st.q    r2, _O(_JB_R10), r10
+       st.q    r2, _O(_JB_R11), r11
+       st.q    r2, _O(_JB_R12), r12
+       st.q    r2, _O(_JB_R13), r13
+       st.q    r2, _O(_JB_R14), r14
+       st.q    r2, _O(_JB_R26), r26
+       st.q    r2, _O(_JB_R27), r27
+       st.q    r2, _O(_JB_R28), r28
+       st.q    r2, _O(_JB_R29), r29
+       st.q    r2, _O(_JB_R30), r30
+       st.q    r2, _O(_JB_R31), r31
+       st.q    r2, _O(_JB_R32), r32
+       st.q    r2, _O(_JB_R33), r33
+       st.q    r2, _O(_JB_R34), r34



Home | Main Index | Thread Index | Old Index