Annotation of sys/arch/vax/boot/common/srt0.S, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: srt0.S,v 1.1 2002/06/11 09:36:24 hugh Exp $ */
! 2: /* $NetBSD: srt0.S,v 1.2 2002/03/31 00:11:14 matt Exp $ */
! 3: /*
! 4: * Copyright (c) 1994 Ludd, University of Lule}, Sweden.
! 5: * All rights reserved.
! 6: *
! 7: * Redistribution and use in source and binary forms, with or without
! 8: * modification, are permitted provided that the following conditions
! 9: * are met:
! 10: * 1. Redistributions of source code must retain the above copyright
! 11: * notice, this list of conditions and the following disclaimer.
! 12: * 2. Redistributions in binary form must reproduce the above copyright
! 13: * notice, this list of conditions and the following disclaimer in the
! 14: * documentation and/or other materials provided with the distribution.
! 15: * 3. All advertising materials mentioning features or use of this software
! 16: * must display the following acknowledgement:
! 17: * This product includes software developed at Ludd, University of Lule}.
! 18: * 4. The name of the author may not be used to endorse or promote products
! 19: * derived from this software without specific prior written permission
! 20: *
! 21: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 22: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! 23: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
! 24: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
! 25: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
! 26: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
! 27: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
! 28: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 29: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
! 30: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! 31: */
! 32:
! 33: /* All bugs are subject to removal without further notice */
! 34:
! 35: #include "../include/asm.h"
! 36:
! 37: /*
! 38: * Auto-moving startup code for standalone programs. Can be loaded
! 39: * (almost) anywhere in memory but moves itself to the position
! 40: * it is linked for. Must be started at first position, recommended
! 41: * is phys addr 0 (boot loads programs at 0, but starts them at the
! 42: * position set in a.out header.
! 43: */
! 44:
! 45: .globl nisse # pass -e nisse to ld gives OK start addr
! 46: .set nisse,0
! 47:
! 48: ALTENTRY(start)
! 49: nop;nop;
! 50: movl $_C_LABEL(start), sp # Probably safe place for stack
! 51: pushr $0x1fff # save for later usage
! 52:
! 53: subl3 $_C_LABEL(start), $_C_LABEL(edata), r0
! 54: movab _C_LABEL(start), r1 # get where we are
! 55: movl $_C_LABEL(start), r3 # get where we want to be
! 56: cmpl r1,r3 # are we where we want to be?
! 57: beql relocated # already relocated, skip copy
! 58: movc3 r0,(r1),(r3) # copy
! 59: subl3 $_C_LABEL(edata), $_C_LABEL(end), r2
! 60: movc5 $0,(r3),$0,r2,(r3) # Zero bss
! 61:
! 62: movpsl -(sp)
! 63: pushl $relocated
! 64: rei
! 65: relocated: # now relocation is done !!!
! 66: movl sp,_C_LABEL(bootregs) # *bootregs
! 67: calls $0, _C_LABEL(Xmain) # Were here!
! 68: halt # no return
! 69:
! 70: ENTRY(machdep_start, 0)
! 71: calls $0,_C_LABEL(niclose) # Evil hack to shutdown DEBNA.
! 72: mtpr $0x1f,$0x12 # Block all interrupts
! 73: mtpr $0,$0x18 # stop real time interrupt clock
! 74: movl 4(ap), r6
! 75: movl 20(ap), r9 # end of symbol table
! 76: pushl 8(ap) # number of symbols
! 77: pushl 16(ap) # start of symbols
! 78: movab _C_LABEL(bootrpb),r10 # get RPB address
! 79: pushl r10 # argument for new boot
! 80: ashl $9,76(r10),r8 # memory size (COMPAT)
! 81: movl $3,r11 # ask boot (COMPAT)
! 82: clrl r10 # no boot dev (COMPAT)
! 83:
! 84: calls $3,(r6)
! 85: halt
CVSweb