From b72ca30bc274dbb9ca14ddd3212f273be1d7330a Mon Sep 17 00:00:00 2001 From: Bunnaroath Sou Date: Wed, 1 Apr 2020 19:51:11 -0700 Subject: [PATCH 1/5] Initial stab --- Makefile.am | 1 + Makefile.in | 3 +++ src/scrub.S | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 src/scrub.S diff --git a/Makefile.am b/Makefile.am index c108218c..4e595a78 100644 --- a/Makefile.am +++ b/Makefile.am @@ -135,6 +135,7 @@ libmetal_a_SOURCES = \ src/clock.c \ src/cpu.c \ src/entry.S \ + src/scrub.S \ src/trap.S \ src/gpio.c \ src/hpm.c \ diff --git a/Makefile.in b/Makefile.in index 01ab61f3..7f03be6e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -539,6 +539,7 @@ libmetal_a_SOURCES = \ src/clock.c \ src/cpu.c \ src/entry.S \ + src/scrub.S \ src/trap.S \ src/gpio.c \ src/hpm.c \ @@ -862,6 +863,7 @@ src/cache.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/clock.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/cpu.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/entry.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) +src/scrub.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/trap.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/gpio.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) src/hpm.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) @@ -962,6 +964,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/privilege.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/pwm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/rtc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/scrub.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/shutdown.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/spi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/switch.Po@am__quote@ diff --git a/src/scrub.S b/src/scrub.S new file mode 100644 index 00000000..5a58bf7a --- /dev/null +++ b/src/scrub.S @@ -0,0 +1,49 @@ +/* Copyright 2020 SiFive, Inc */ +/* SPDX-License-Identifier: Apache-2.0 */ + +/* + * Scrub memory with zero + */ +.type _metal_memory_scrub, @function +_metal_memory_scrub: + /* Zero out memory if exist. */ + bge t1, t2, 2f +1: +#if __riscv_xlen == 32 + sw x0, 0(t1) + addi t1, t1, 4 + blt t1, t2, 1b +#else + sd x0, 0(t1) + addi t1, t1, 8 + blt t1, t2, 1b +#endif +2: + ret + +/* + * Initialize all memories available to zero + * This must be call before seting up any stack(s) + */ +.global __metal_before_start +.type __metal_before_start, @function +__metal_before_start: + /* Zero out itim memory. */ + la t1, metal_itim_memory_start + la t2, metal_itim_memory_end + jal _metal_memory_scrub + + /* Zero out dtim memory. */ + la t1, metal_dtim_memory_start + la t2, metal_dtim_memory_end + jal _metal_memory_scrub + + /* Zero out ils memory. */ + /* Zero out dls memory. */ + + /* Zero out main memory. */ + la t1, metal_main_memory_start + la t2, metal_main_memory_end + jal _metal_memory_scrub + + ret From c654a393e530318eeb8ae055ab126e88af4fae18 Mon Sep 17 00:00:00 2001 From: Bunnaroath Sou Date: Thu, 2 Apr 2020 19:15:09 -0700 Subject: [PATCH 2/5] Fix build error --- src/entry.S | 1 - src/scrub.S | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/entry.S b/src/entry.S index 3550fe4a..b4a254f1 100644 --- a/src/entry.S +++ b/src/entry.S @@ -73,7 +73,6 @@ _enter: * segments having been initialized. This is done to avoid putting a * burden on systems that can be initialized without having a C environment * set up. */ - .weak __metal_before_start la ra, __metal_before_start beqz ra, 1f jalr ra diff --git a/src/scrub.S b/src/scrub.S index 5a58bf7a..2be2c0c3 100644 --- a/src/scrub.S +++ b/src/scrub.S @@ -25,23 +25,34 @@ _metal_memory_scrub: * Initialize all memories available to zero * This must be call before seting up any stack(s) */ +.weak __metal_before_start .global __metal_before_start .type __metal_before_start, @function __metal_before_start: /* Zero out itim memory. */ + .weak metal_itim_memory_start + .weak metal_itim_memory_end la t1, metal_itim_memory_start la t2, metal_itim_memory_end jal _metal_memory_scrub /* Zero out dtim memory. */ + .weak metal_dtim_memory_start + .weak metal_dtim_memory_end la t1, metal_dtim_memory_start la t2, metal_dtim_memory_end jal _metal_memory_scrub /* Zero out ils memory. */ + .weak metal_ils_memory_start + .weak metal_ils_memory_end /* Zero out dls memory. */ + .weak metal_dls_memory_start + .weak metal_dls_memory_end /* Zero out main memory. */ + .weak metal_main_memory_start + .weak metal_main_memory_end la t1, metal_main_memory_start la t2, metal_main_memory_end jal _metal_memory_scrub From 18eb23c6b044185fa2e632ac0f9454e9f5ed94b3 Mon Sep 17 00:00:00 2001 From: Bunnaroath Sou Date: Mon, 6 Apr 2020 13:08:26 -0700 Subject: [PATCH 3/5] Save caller ra prior leaf func call --- src/scrub.S | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/scrub.S b/src/scrub.S index 2be2c0c3..36056fb4 100644 --- a/src/scrub.S +++ b/src/scrub.S @@ -29,6 +29,9 @@ _metal_memory_scrub: .global __metal_before_start .type __metal_before_start, @function __metal_before_start: + /* Save caller ra */ + mv s0, ra + /* Zero out itim memory. */ .weak metal_itim_memory_start .weak metal_itim_memory_end @@ -57,4 +60,6 @@ __metal_before_start: la t2, metal_main_memory_end jal _metal_memory_scrub + /* Restore caller ra */ + mv ra, s0 ret From c5bdc28dbde57d4d9ef564708a5319aae2cbdd51 Mon Sep 17 00:00:00 2001 From: Bunnaroath Sou Date: Fri, 10 Apr 2020 18:48:06 -0700 Subject: [PATCH 4/5] Add eccscrub_bit check and other harts to wait and skip --- src/scrub.S | 86 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 20 deletions(-) diff --git a/src/scrub.S b/src/scrub.S index 36056fb4..c88fe9c1 100644 --- a/src/scrub.S +++ b/src/scrub.S @@ -6,19 +6,17 @@ */ .type _metal_memory_scrub, @function _metal_memory_scrub: - /* Zero out memory if exist. */ - bge t1, t2, 2f + /* Zero out memory */ 1: #if __riscv_xlen == 32 - sw x0, 0(t1) - addi t1, t1, 4 - blt t1, t2, 1b + sw x0, 0(t1) + addi t1, t1, 4 + blt t1, t2, 1b #else - sd x0, 0(t1) - addi t1, t1, 8 - blt t1, t2, 1b + sd x0, 0(t1) + addi t1, t1, 8 + blt t1, t2, 1b #endif -2: ret /* @@ -30,36 +28,84 @@ _metal_memory_scrub: .type __metal_before_start, @function __metal_before_start: /* Save caller ra */ - mv s0, ra + mv s0, ra + + la t0, __metal_eccscrub_bit + beqz t0, skip_scrub + + la t0, __metal_boot_hart + csrr a5, mhartid + /* Disable machine interrupts to be safe */ + li a3, 8 + csrc mstatus, a3 + bne a5, t0, wait_scrub /* Zero out itim memory. */ .weak metal_itim_memory_start .weak metal_itim_memory_end - la t1, metal_itim_memory_start - la t2, metal_itim_memory_end - jal _metal_memory_scrub + la t1, metal_itim_memory_start + la t2, metal_itim_memory_end + beq t1, t2, dtim_scrub + jal _metal_memory_scrub +dtim_scrub: /* Zero out dtim memory. */ .weak metal_dtim_memory_start .weak metal_dtim_memory_end - la t1, metal_dtim_memory_start - la t2, metal_dtim_memory_end - jal _metal_memory_scrub + la t1, metal_dtim_memory_start + la t2, metal_dtim_memory_end + beq t1, t2, ils_scrub + jal _metal_memory_scrub +ils_scrub: /* Zero out ils memory. */ .weak metal_ils_memory_start .weak metal_ils_memory_end + la t1, metal_ils_memory_start + la t2, metal_ils_memory_end + beq t1, t2, dls_scrub + jal _metal_memory_scrub + +dls_scrub: /* Zero out dls memory. */ .weak metal_dls_memory_start .weak metal_dls_memory_end + la t1, metal_dls_memory_start + la t2, metal_dls_memory_end + beq t1, t2, sram_scrub + jal _metal_memory_scrub +sram_scrub: + /* Zero out sram memory. */ + .weak metal_sram_memory_start + .weak metal_sram_memory_end + la t1, metal_sram_memory_start + la t2, metal_sram_memory_end + beq t1, t2, memory_scrub + jal _metal_memory_scrub + +memory_scrub: /* Zero out main memory. */ .weak metal_main_memory_start .weak metal_main_memory_end - la t1, metal_main_memory_start - la t2, metal_main_memory_end - jal _metal_memory_scrub + la t1, metal_main_memory_start + la t2, metal_main_memory_end + beq t1, t2, done_scrub + jal _metal_memory_scrub + +done_scrub: + lui a4, 0x2000 + li a5,1 + sw a5,0(a4) + fence w,rw + j skip_scrub + +wait_scrub: + lui a4, 0x2000 + lw a5, 0(a4) + beqz a5, wait_scrub +skip_scrub: /* Restore caller ra */ - mv ra, s0 + mv ra, s0 ret From 4c221ae715ac4a80b41ee251042ca09488885599 Mon Sep 17 00:00:00 2001 From: Bunnaroath Sou Date: Mon, 13 Apr 2020 22:09:05 -0700 Subject: [PATCH 5/5] Update memories label to match LDS --- Makefile.in | 31 +++++++++++++++--------------- aclocal.m4 | 50 ++++++++++++++++++++++++------------------------- src/scrub.S | 54 +++++++++++++++++++++++++++++------------------------ 3 files changed, 71 insertions(+), 64 deletions(-) diff --git a/Makefile.in b/Makefile.in index 7f03be6e..c1e13369 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. +# Makefile.in generated by automake 1.15.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2014 Free Software Foundation, Inc. +# Copyright (C) 1994-2017 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -259,15 +259,16 @@ am_libmetal_a_OBJECTS = src/drivers/fixed-clock.$(OBJEXT) \ src/drivers/sifive_wdog0.$(OBJEXT) \ src/drivers/ucb_htif0.$(OBJEXT) src/atomic.$(OBJEXT) \ src/button.$(OBJEXT) src/cache.$(OBJEXT) src/clock.$(OBJEXT) \ - src/cpu.$(OBJEXT) src/entry.$(OBJEXT) src/trap.$(OBJEXT) \ - src/gpio.$(OBJEXT) src/hpm.$(OBJEXT) src/i2c.$(OBJEXT) \ - src/init.$(OBJEXT) src/interrupt.$(OBJEXT) src/led.$(OBJEXT) \ - src/lock.$(OBJEXT) src/memory.$(OBJEXT) src/pmp.$(OBJEXT) \ - src/privilege.$(OBJEXT) src/pwm.$(OBJEXT) src/rtc.$(OBJEXT) \ - src/shutdown.$(OBJEXT) src/spi.$(OBJEXT) src/switch.$(OBJEXT) \ - src/synchronize_harts.$(OBJEXT) src/timer.$(OBJEXT) \ - src/time.$(OBJEXT) src/trap.$(OBJEXT) src/tty.$(OBJEXT) \ - src/uart.$(OBJEXT) src/vector.$(OBJEXT) src/watchdog.$(OBJEXT) + src/cpu.$(OBJEXT) src/entry.$(OBJEXT) src/scrub.$(OBJEXT) \ + src/trap.$(OBJEXT) src/gpio.$(OBJEXT) src/hpm.$(OBJEXT) \ + src/i2c.$(OBJEXT) src/init.$(OBJEXT) src/interrupt.$(OBJEXT) \ + src/led.$(OBJEXT) src/lock.$(OBJEXT) src/memory.$(OBJEXT) \ + src/pmp.$(OBJEXT) src/privilege.$(OBJEXT) src/pwm.$(OBJEXT) \ + src/rtc.$(OBJEXT) src/shutdown.$(OBJEXT) src/spi.$(OBJEXT) \ + src/switch.$(OBJEXT) src/synchronize_harts.$(OBJEXT) \ + src/timer.$(OBJEXT) src/time.$(OBJEXT) src/trap.$(OBJEXT) \ + src/tty.$(OBJEXT) src/uart.$(OBJEXT) src/vector.$(OBJEXT) \ + src/watchdog.$(OBJEXT) libmetal_a_OBJECTS = $(am_libmetal_a_OBJECTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) @@ -1162,7 +1163,7 @@ distdir: $(DISTFILES) ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir @@ -1188,7 +1189,7 @@ dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir @@ -1206,7 +1207,7 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ @@ -1216,7 +1217,7 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac diff --git a/aclocal.m4 b/aclocal.m4 index 42ec7eed..2e4e7235 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.15 -*- Autoconf -*- +# generated automatically by aclocal 1.15.1 -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -20,7 +20,7 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# Copyright (C) 2002-2014 Free Software Foundation, Inc. +# Copyright (C) 2002-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.15' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.15], [], +m4_if([$1], [1.15.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -51,12 +51,12 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.15])dnl +[AM_AUTOMAKE_VERSION([1.15.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) -# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# Copyright (C) 2011-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -118,7 +118,7 @@ AC_SUBST([AR])dnl # Figure out how to run the assembler. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -138,7 +138,7 @@ _AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -190,7 +190,7 @@ am_aux_dir=`cd "$ac_aux_dir" && pwd` # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -221,7 +221,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -412,7 +412,7 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -488,7 +488,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -685,7 +685,7 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -706,7 +706,7 @@ if test x"${install_sh+set}" != xset; then fi AC_SUBST([install_sh])]) -# Copyright (C) 2003-2014 Free Software Foundation, Inc. +# Copyright (C) 2003-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -728,7 +728,7 @@ AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -763,7 +763,7 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -813,7 +813,7 @@ rm -f confinc confmf # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- -# Copyright (C) 1997-2014 Free Software Foundation, Inc. +# Copyright (C) 1997-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -852,7 +852,7 @@ fi # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -881,7 +881,7 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -928,7 +928,7 @@ AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -947,7 +947,7 @@ AC_DEFUN([AM_RUN_LOG], # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1028,7 +1028,7 @@ AC_CONFIG_COMMANDS_PRE( rm -f conftest.file ]) -# Copyright (C) 2009-2014 Free Software Foundation, Inc. +# Copyright (C) 2009-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1088,7 +1088,7 @@ AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) -# Copyright (C) 2001-2014 Free Software Foundation, Inc. +# Copyright (C) 2001-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1116,7 +1116,7 @@ fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2014 Free Software Foundation, Inc. +# Copyright (C) 2006-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1135,7 +1135,7 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2014 Free Software Foundation, Inc. +# Copyright (C) 2004-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/src/scrub.S b/src/scrub.S index c88fe9c1..409351bd 100644 --- a/src/scrub.S +++ b/src/scrub.S @@ -41,55 +41,61 @@ __metal_before_start: bne a5, t0, wait_scrub /* Zero out itim memory. */ - .weak metal_itim_memory_start - .weak metal_itim_memory_end - la t1, metal_itim_memory_start - la t2, metal_itim_memory_end + .weak metal_itim_0_memory_start + .weak metal_itim_0_memory_end + la t1, metal_itim_0_memory_start + la t2, metal_itim_0_memory_end + beq t1, t2, dtim_scrub + jal _metal_memory_scrub + .weak metal_itim_1_memory_start + .weak metal_itim_1_memory_end + la t1, metal_itim_1_memory_start + la t2, metal_itim_1_memory_end beq t1, t2, dtim_scrub jal _metal_memory_scrub dtim_scrub: /* Zero out dtim memory. */ - .weak metal_dtim_memory_start - .weak metal_dtim_memory_end - la t1, metal_dtim_memory_start - la t2, metal_dtim_memory_end + .weak metal_dtim_0_memory_start + .weak metal_dtim_0_memory_end + la t1, metal_dtim_0_memory_start + la t2, metal_dtim_0_memory_end beq t1, t2, ils_scrub jal _metal_memory_scrub ils_scrub: /* Zero out ils memory. */ - .weak metal_ils_memory_start - .weak metal_ils_memory_end - la t1, metal_ils_memory_start - la t2, metal_ils_memory_end + .weak metal_ils_0_memory_start + .weak metal_ils_0_memory_end + la t1, metal_ils_0_memory_start + la t2, metal_ils_0_memory_end beq t1, t2, dls_scrub jal _metal_memory_scrub dls_scrub: /* Zero out dls memory. */ - .weak metal_dls_memory_start - .weak metal_dls_memory_end - la t1, metal_dls_memory_start - la t2, metal_dls_memory_end + .weak metal_dls_0_memory_start + .weak metal_dls_0_memory_end + la t1, metal_dls_0_memory_start + la t2, metal_dls_0_memory_end beq t1, t2, sram_scrub jal _metal_memory_scrub sram_scrub: /* Zero out sram memory. */ - .weak metal_sram_memory_start - .weak metal_sram_memory_end - la t1, metal_sram_memory_start - la t2, metal_sram_memory_end + .weak metal_sys_sram_0_memory_start + .weak metal_sys_sram_0_memory_end + la t1, metal_sys_sram_0_memory_start + la t2, metal_sys_sram_0_memory_end beq t1, t2, memory_scrub jal _metal_memory_scrub memory_scrub: /* Zero out main memory. */ - .weak metal_main_memory_start - .weak metal_main_memory_end - la t1, metal_main_memory_start - la t2, metal_main_memory_end + .weak metal_memory_0_memory_start + .weak metal_memory_0_memory_end + la t1, metal_memory_0_memory_start + la t2, metal_memory_0_memory_end beq t1, t2, done_scrub jal _metal_memory_scrub