summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/powerpc/gen405/dlentry
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2001-11-08 23:46:58 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2001-11-08 23:46:58 +0000
commit57ed3939306d6db3543490c21bbd858c0b186c1c (patch)
tree43afa1978cb8d315be8d98ac87ff087d637fb799 /c/src/lib/libbsp/powerpc/gen405/dlentry
parent2001-11-08 Dennis Ehlin (ECS) <Dennis.Ehlin@ecs.ericsson.se> (diff)
downloadrtems-57ed3939306d6db3543490c21bbd858c0b186c1c.tar.bz2
2001-11-08 Dennis Ehlin (ECS) <Dennis.Ehlin@ecs.ericsson.se>
This modification is part of the submitted modifications necessary to support the IBM PPC405 family. This submission was reviewed by Thomas Doerfler <Thomas.Doerfler@imd-systems.de> who ensured it did not negatively impact the ppc403 BSPs. The submission and tracking process was captured as PR50. * ChangeLog, Makefile.am, README, bsp_specs, bsp_specs.dl, configure.ac, times, dlentry/.cvsignore, dlentry/Makefile.am, dlentry/dlentry.S, include/.cvsignore, include/Makefile.am, include/bsp.h, include/bspopts.h.in, include/coverhd.h, startup/.cvsignore, startup/Makefile.am, startup/bspclean.c, startup/bspstart.c, startup/linkcmds, startup/linkcmds.dl, startup/setvec.c, wrapup/.cvsignore, wrapup/Makefile.am: New files that are part of the new gen405 BSP.
Diffstat (limited to 'c/src/lib/libbsp/powerpc/gen405/dlentry')
-rw-r--r--c/src/lib/libbsp/powerpc/gen405/dlentry/.cvsignore2
-rw-r--r--c/src/lib/libbsp/powerpc/gen405/dlentry/Makefile.am33
-rw-r--r--c/src/lib/libbsp/powerpc/gen405/dlentry/dlentry.S161
3 files changed, 196 insertions, 0 deletions
diff --git a/c/src/lib/libbsp/powerpc/gen405/dlentry/.cvsignore b/c/src/lib/libbsp/powerpc/gen405/dlentry/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/gen405/dlentry/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/c/src/lib/libbsp/powerpc/gen405/dlentry/Makefile.am b/c/src/lib/libbsp/powerpc/gen405/dlentry/Makefile.am
new file mode 100644
index 0000000000..62d8995315
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/gen405/dlentry/Makefile.am
@@ -0,0 +1,33 @@
+##
+## $Id$
+##
+
+AUTOMAKE_OPTIONS = foreign 1.4
+
+PGM = $(ARCH)/dlentry.rel
+
+S_FILES = dlentry.S
+S_O_FILES = $(S_FILES:%.S=$(ARCH)/%.o)
+
+OBJS = $(S_O_FILES)
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../../../../../../automake/compile.am
+include $(top_srcdir)/../../../../../../automake/lib.am
+
+#
+# (OPTIONAL) Add local stuff here using +=
+#
+
+$(PGM): $(OBJS)
+ $(make-rel)
+
+# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
+
+all-local: $(ARCH) $(OBJS) $(PGM)
+
+.PRECIOUS: $(PGM)
+
+EXTRA_DIST = dlentry.S
+
+include $(top_srcdir)/../../../../../../automake/local.am
diff --git a/c/src/lib/libbsp/powerpc/gen405/dlentry/dlentry.S b/c/src/lib/libbsp/powerpc/gen405/dlentry/dlentry.S
new file mode 100644
index 0000000000..856e01cb06
--- /dev/null
+++ b/c/src/lib/libbsp/powerpc/gen405/dlentry/dlentry.S
@@ -0,0 +1,161 @@
+/* dlentry.s
+ *
+ * This file contains the entry code for RTEMS programs starting
+ * after download to RAM
+ *
+ * Author: Thomas Doerfler <td@imd.m.isar.de>
+ * IMD Ingenieurbuero fuer Microcomputertechnik
+ *
+ * COPYRIGHT (c) 1998 by IMD
+ *
+ * Changes from IMD are covered by the original distributions terms.
+ * This file has been derived from the papyrus BSP:
+ *
+ * This file contains the entry veneer for RTEMS programs
+ * downloaded to Papyrus.
+ *
+ * Author: Andrew Bray <andy@i-cubed.co.uk>
+ *
+ * COPYRIGHT (c) 1995 by i-cubed ltd.
+ *
+ * To anyone who acknowledges that this file is provided "AS IS"
+ * without any express or implied warranty:
+ * permission to use, copy, modify, and distribute this file
+ * for any purpose is hereby granted without fee, provided that
+ * the above copyright notice and this notice appears in all
+ * copies, and that the name of i-cubed limited not be used in
+ * advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ * i-cubed limited makes no representations about the suitability
+ * of this software for any purpose.
+ *
+ * $Id$
+ *
+ * derived from "helas403/dlentry.S":
+ * Id: dlentry.S,v 1.2 2000/08/02 16:30:57 joel Exp
+ */
+
+#include "asm.h"
+
+/*
+ * The gen405 ELF link scripts support three special sections:
+ * .entry The actual entry point
+ * .vectors The section containing the interrupt entry veneers.
+ */
+
+/*
+ * Downloaded code loads the vectors separately to 0x00000100,
+ * so .entry can be over 256 bytes.
+ *
+ * The other sections are linked in the following order:
+ * .entry
+ * .text
+ * .data
+ * .bss
+ * see linker command file for section placement
+ *
+ * The initial stack is set to stack.end
+ *
+ * All the entry veneer has to do is to clear the BSS.
+ */
+
+/*
+ * GDB likes to have debugging information for the entry veneer.
+ * Here was some DWARF information. IMD removed it, because we
+ * could not check, whether it was still correct. Sorry.
+
+ */
+
+.globl __eabi
+
+
+#if PPC_ASM == PPC_ASM_ELF
+ .section .entry
+#else
+ .csect .text[PR]
+#endif
+
+ PUBLIC_VAR (download_entry)
+SYM(download_entry):
+ bl .startup
+base_addr:
+
+/*---------------------------------------------------------------------------
+ * Parameters from linker
+ *--------------------------------------------------------------------------*/
+toc_pointer:
+#if PPC_ASM == PPC_ASM_ELF
+ .long s.got
+#else
+ .long TOC[tc0]
+#endif
+bss_length:
+ .long bss.size
+bss_addr:
+ .long bss.start
+stack_top:
+ .long stack.end
+/*---------------------------------------------------------------------------
+ * Reset_entry.
+ *--------------------------------------------------------------------------*/
+.startup:
+ /* Get start address, stack grows down from here... */
+ mflr r1
+
+ /* Assume Bank regs set up..., cache etc. */
+ bl bssclr
+
+ .extern SYM(__vectors)
+
+ lis r2,__vectors@h /* set EVPR exc. vector prefix */
+ mtspr evpr,r2
+
+ /*-------------------------------------------------------------------
+ * C_setup.
+ *------------------------------------------------------------------*/
+ lwz r2,toc_pointer-base_addr(r1) /* set r2 to toc */
+ lwz r1,stack_top-base_addr(r1) /* set r1 to stack_top */
+
+ addi r1,r1,-56-4 /* start stack at text_addr - 56 */
+ addi r3,r0,0x0 /* clear r3 */
+ stw r3, 0(r1) /* Clear stack chain */
+ stw r3, 4(r1)
+ stw r3, 8(r1)
+ stw r3, 12(r1)
+ lis r5,environ@ha
+ la r5,environ@l(r5) /* environp */
+ li r4, 0 /* argv */
+ li r3, 0 /* argc */
+ .extern SYM (boot_card)
+ b SYM (boot_card) /* call the first C routine */
+
+/*---------------------------------------------------------------------------
+ * bssclr.
+ *--------------------------------------------------------------------------*/
+bssclr:
+ /*-------------------------------------------------------------------
+ * Data move finished, zero out bss.
+ *------------------------------------------------------------------*/
+ lwz r2,bss_addr-base_addr(r1) /* start of bss set by loader */
+ lwz r3,bss_length-base_addr(r1) /* bss length */
+ rlwinm. r3,r3,30,0x3FFFFFFF /* form length/4 */
+ beqlr /* no bss */
+ mtctr r3 /* set ctr reg */
+ xor r6,r6,r6 /* r6 = 0 */
+clear_bss:
+ stswi r6,r2,0x4 /* store r6 */
+ addi r2,r2,0x4 /* update r2 */
+ bdnz clear_bss /* decrement counter and loop */
+ blr /* return */
+.L_text_e:
+
+#if PPC_ABI == PPC_ABI_POWEROPEN
+ DESCRIPTOR (startup)
+#endif
+
+ .comm environ,4,4
+
+/* no eabi */
+__eabi:
+ blr
+