/*
* Copyright (c) 1996 Ignatios Souvatzis
* Copyright (c) 1994 Michael L. Hitch
* 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.
*
* 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.
*
*
* From: $NetBSD: startit.s,v 1.9 2009/11/15 20:38:36 snj Exp $
*/
#include <machine/asm.h>
| removed Z flag
| tstl %a3 | Can we load to fastmem?
| jeq L0 | No, leave destination at 0
movl %a0,%a3 | Move to start of fastmem chunk
addl %a0,%a6 | relocate kernel entry point
addl #3,%d2
andl #0xfffffffc,%d2 | round up.
| determine if the kernel need be copied upwards or downwards
cmpl %a1,%a3 | %a3-a1
bcs above | source is above
movl %a0,%sp
addl %d0,%sp | move the stack to the end of segment
| copy from below upwards requires copying from end to start.
addl %d2,%a3 | one long word past
addl %d2,%a1 | one long word past
subl #4,%sp | alloc space
movl %a1,%sp@- | save source
movl %a3,%sp@- | save destination
| copy copier to end of segment
movl %sp,%a3
subl #256,%a3 | end of segment save our stack
lea %pc@(_C_LABEL(startit_end):w),%a1
movl %a0,%sp@- | save segment start
lea %pc@(below:w),%a0
L0: movw %a1@-,%a3@-
cmpl %a0,%a1
bne L0
movl %sp@,%a0 | restore segment start
movl %a3,%sp@ | address of relocated below
addl #(ckend - below),%a3
movl %a3,%sp@(12) | address of ckend for later
| ---- switch off cache ----
bra Lchoff | and to relocated below
noDraCo:
moveq #0,%d2 | zero out unused registers
movel %d2,%a1 | (might make future compatibility
movel %d2,%a3 | would have known contents)
movel %d2,%a5
movel %a6,%sp | entry point into stack pointer
movel %d2,%a6