-# $OpenBSD: Makefile.octeon,v 1.32 2017/06/05 12:43:59 deraadt Exp $
+# $OpenBSD: Makefile.octeon,v 1.33 2017/06/05 15:23:11 visa Exp $
# For instructions on building kernels consult the config(8) and options(4)
# manual pages.
CMACHFLAGS= -mno-abicalls ${ABI} -msoft-float -G 0
CMACHFLAGS+= -ffreestanding ${NOPIE_FLAGS}
+SORTR= sort -R
.if ${IDENT:M-DNO_PROPOLICE}
CMACHFLAGS+= -fno-stack-protector
.endif
+.if ${IDENT:M-DSMALL_KERNEL}
+SORTR= cat
+.endif
DEBUG?= -g
COPTS?= -O2
# ${SYSTEM_LD_HEAD}
# ${SYSTEM_LD} swapxxx.o
# ${SYSTEM_LD_TAIL}
-SYSTEM_HEAD= locore.o param.o ioconf.o
-SYSTEM_OBJ= ${SYSTEM_HEAD} ${OBJS}
+SYSTEM_HEAD= locore0.o gap.o
+SYSTEM_OBJ= ${SYSTEM_HEAD} ${OBJS} param.o ioconf.o
SYSTEM_DEP= Makefile ${SYSTEM_OBJ} ld.script
SYSTEM_LD_HEAD= @rm -f $@
SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_HEAD} vers.o $${OBJS}'; \
umask 007; \
- ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} vers.o ${OBJS}
+ echo ${OBJS} param.o ioconf.o vers.o | tr " " "\n" | ${SORTR} > lorder; \
+ ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_HEAD} `cat lorder`
SYSTEM_LD_TAIL= @${SIZE} $@
.if ${DEBUG} == "-g"
sh $S/conf/newvers.sh
${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
+gap.S: ${SYSTEM_SWAP_DEP} Makefile $S/conf/makegap.sh
+ umask 007; sh $S/conf/makegap.sh 0xef > gap.S
+
+gap.o: gap.S
+ umask 007; ${CC} ${AFLAGS} ${CPPFLAGS} ${PROF} -c gap.S
+
clean:
- rm -f *bsd *bsd.gdb *.[dio] [a-z]*.s assym.* ${DB_STRUCTINFO} param.c
+ rm -f *bsd *bsd.gdb *.[dio] [a-z]*.s assym.* ${DB_STRUCTINFO} \
+ gap.S lorder param.c
cleandir: clean
rm -f Makefile *.h ioconf.c options machine ${_mach} vers.c
objdump -g db_structinfo.o | perl $S/ddb/parse_structinfo.pl > $@
rm -f db_structinfo.o
-locore.o: ${_machdir}/${_mach}/locore.S assym.h
-context.o cp0access.o exception.o: assym.h
+locore0.o: ${_machdir}/${_mach}/locore0.S assym.h
+context.o cp0access.o exception.o locore.o: assym.h
lcore_access.o lcore_ddb.o lcore_float.o tlbhandler.o: assym.h
mips64r2.o: assym.h
-# $OpenBSD: files.octeon,v 1.35 2017/05/02 13:26:49 visa Exp $
+# $OpenBSD: files.octeon,v 1.36 2017/06/05 15:23:11 visa Exp $
# Standard stanzas config(8) can't run without
maxpartitions 16
file arch/octeon/octeon/disksubr.c disk
file arch/octeon/octeon/machdep.c
file arch/octeon/octeon/cn3xxx_dts.S
+file arch/octeon/octeon/locore.S
include "dev/ata/files.ata"
include "dev/atapiscsi/files.atapiscsi"
-/* $OpenBSD: locore.S,v 1.12 2017/05/09 15:11:33 visa Exp $ */
+/* $OpenBSD: locore.S,v 1.13 2017/06/05 15:23:11 visa Exp $ */
/*
* Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
.set noreorder # Noreorder is default style!
.set mips64r2
- .globl start
- .globl kernel_text
-kernel_text = start
-start:
+ .globl locore_start
+locore_start:
/* initialize ebase */
dla t0, 0xffffffff80000000
mtc0 t0, COP_0_EBASE
blt t0, t1, 1b
sd v0, -8(t0) # store to randomdata
+ /*
+ * Smash the very early boot code by overwriting it.
+ */
+ li v0, 0x00000034 # TEQ zero, zero
+ LA t0, start
+ LA t1, endboot
+1:
+ daddu t0, t0, 4
+ blt t0, t1, 1b
+ sw v0, -4(t0)
+
/*
* Initialize stack and call machine startup.
*/
--- /dev/null
+/* $OpenBSD: locore0.S,v 1.1 2017/06/05 15:23:11 visa Exp $ */
+
+/*
+ * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
+ *
+ * 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 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.
+ *
+ */
+
+#include <machine/param.h>
+#include <machine/asm.h>
+
+#include "assym.h"
+
+ .set noreorder # Noreorder is default style!
+ .set mips64r2
+ .globl start
+ .globl kernel_text
+kernel_text = start
+start:
+ j locore_start
+ nop