Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/nathanw_sa]: src/sys/arch/next68k switch next68k to ELF. highlight incl...
details: https://anonhg.NetBSD.org/src/rev/a780f5a88215
branches: nathanw_sa
changeset: 504665:a780f5a88215
user: chs <chs%NetBSD.org@localhost>
date: Sat May 12 22:35:30 2001 +0000
description:
switch next68k to ELF. highlight include:
add "%" prefix to register names in assembly code.
change assembly functions to return pointer values in %a0 instead of %d0.
C symbols no longer prepend an underscore, adjust assembly code for this.
32-bit values are now 32-bit aligned instead of 16-bit aligned,
adjust structure packing and padding to override this where necessary.
make EXEC_ELF std, make EXEC_AOUT and COMPAT_AOUT_M68K optional.
use the MI loadfile() instead of several home-grown versions.
diffstat:
sys/arch/next68k/conf/std.next68k | 8 ++
sys/arch/next68k/include/db_machdep.h | 5 +
sys/arch/next68k/stand/boot/srt0.s | 127 ++++++++++++++++++++++++++++++++++
3 files changed, 140 insertions(+), 0 deletions(-)
diffs (152 lines):
diff -r 5c9439804dc5 -r a780f5a88215 sys/arch/next68k/conf/std.next68k
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/next68k/conf/std.next68k Sat May 12 22:35:30 2001 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: std.next68k,v 1.9.8.2 2001/05/12 22:35:30 chs Exp $
+
+# Standard information for next68k
+machine next68k m68k
+
+# Standard defines
+options EXEC_ELF32
+options EXEC_SCRIPT
diff -r 5c9439804dc5 -r a780f5a88215 sys/arch/next68k/include/db_machdep.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/next68k/include/db_machdep.h Sat May 12 22:35:30 2001 +0000
@@ -0,0 +1,5 @@
+/* $NetBSD: db_machdep.h,v 1.2.8.2 2001/05/12 22:35:30 chs Exp $ */
+
+#include <m68k/db_machdep.h>
+#define DB_ELF_SYMBOLS
+#define DB_ELFSIZE 32
diff -r 5c9439804dc5 -r a780f5a88215 sys/arch/next68k/stand/boot/srt0.s
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/next68k/stand/boot/srt0.s Sat May 12 22:35:30 2001 +0000
@@ -0,0 +1,127 @@
+/* $NetBSD: srt0.s,v 1.2.8.2 2001/05/12 22:35:31 chs Exp $ */
+/*
+ * Copyright (c) 1994 Rolf Grossmann
+ * 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 Rolf Grossmann.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * 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/asm.h>
+
+/*
+ * Startup code for standalone system
+ */
+
+ .text
+ASENTRY_NOPROFILE(start)
+ || clear bss (this should not hurt us i.e. cause an exception)
+ movel #_C_LABEL(edata),%a2 | start of BSS
+ movel #_C_LABEL(end),%a3 | end
+Lclr:
+ clrb %a2@+ | clear BSS
+ cmpl %a2,%a3 | done?
+ bne Lclr | no, keep going
+
+ movl #0x0808,%d0
+ movc %d0,%cacr | clear and disable on-chip cache(s)
+
+ || catch exceptions myself
+ movec %vbr,%a3
+ movel %a3,save_vbr | save register for restoration
+ lea vectbl,%a4
+ movel %a3@(4),%a4@(4) | copy mg, just for sure
+ movel %a3@(180),%a4@(180) | copy vector for trap #13
+ movel %a3@(124),%a4@(124) | copy vector for int 7
+ movec %a4,%vbr | use the new table
+
+ || save mg as pi
+ movel %a3@(4),_C_LABEL(mg)
+
+ || make sure we disallow interrupts
+ movew #0x2600,%sr
+
+ || away we go
+ movel %sp@(4),%sp@- | copy the argument we got
+ jsr _C_LABEL(main) | call C
+ addql #4,%sp
+
+ || restore prom vectors
+ movel save_vbr,%a0
+ movec %a0,%vbr
+
+ || return kernel start address (still in d0)
+ rts
+
+ENTRY(_halt)
+ movel save_vbr,%a0
+ movec %a0,%vbr | restore prom vbr
+hloop:
+ movel #halt,%d0
+ trap #13 | halt the system
+ bra hloop | and do not allow continuation
+
+ASENTRY_NOPROFILE(astrap)
+ moveml %d0-%d7/%a0-%a7,%sp@- | save all registers
+
+ movel %sp,%sp@- | push pointer to registers
+ jsr _C_LABEL(trap) | call C to handle things (dump regs)
+ addql #4,%sp
+ tstl %d0
+ jeq Lstop
+ moveml %sp@+,%d0-%d7/%a0-%a7
+ rte
+Lstop:
+ bra Lstop | stay here
+
+ .data
+save_vbr:
+ .long 0
+halt:
+ .asciz "-h"
+
+#define TRAP16 \
+ VECTOR(astrap); VECTOR(astrap); VECTOR(astrap); VECTOR(astrap); \
+ VECTOR(astrap); VECTOR(astrap); VECTOR(astrap); VECTOR(astrap); \
+ VECTOR(astrap); VECTOR(astrap); VECTOR(astrap); VECTOR(astrap); \
+ VECTOR(astrap); VECTOR(astrap); VECTOR(astrap); VECTOR(astrap);
+
+vectbl:
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
+ TRAP16
Home |
Main Index |
Thread Index |
Old Index