[BACK]Return to srt0.S CVS log [TXT][DIR] Up to [local] / sys / arch / hppa64 / stand / boot

Annotation of sys/arch/hppa64/stand/boot/srt0.S, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: srt0.S,v 1.1 2005/04/01 10:40:48 mickey Exp $ */
        !             2:
        !             3: /*
        !             4:  * Copyright (c) 2005 Michael Shalayeff
        !             5:  * All rights reserved.
        !             6:  *
        !             7:  * Permission to use, copy, modify, and distribute this software for any
        !             8:  * purpose with or without fee is hereby granted, provided that the above
        !             9:  * copyright notice and this permission notice appear in all copies.
        !            10:  *
        !            11:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
        !            12:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
        !            13:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
        !            14:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
        !            15:  * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN
        !            16:  * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
        !            17:  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
        !            18:  */
        !            19: /*
        !            20:  * Copyright 1996 1995 by Open Software Foundation, Inc.
        !            21:  *              All Rights Reserved
        !            22:  *
        !            23:  * Permission to use, copy, modify, and distribute this software and
        !            24:  * its documentation for any purpose and without fee is hereby granted,
        !            25:  * provided that the above copyright notice appears in all copies and
        !            26:  * that both the copyright notice and this permission notice appear in
        !            27:  * supporting documentation.
        !            28:  *
        !            29:  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
        !            30:  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
        !            31:  * FOR A PARTICULAR PURPOSE.
        !            32:  *
        !            33:  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
        !            34:  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
        !            35:  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
        !            36:  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
        !            37:  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
        !            38:  *
        !            39:  */
        !            40: ;
        !            41: ; Copyright (c) 1990 mt Xinu, Inc.  All rights reserved.
        !            42: ; Copyright (c) 1990 University of Utah.  All rights reserved.
        !            43: ;
        !            44: ; This file may be freely distributed in any form as long as
        !            45: ; this copyright notice is included.
        !            46: ; THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
        !            47: ; IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
        !            48: ; WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            49: ;
        !            50: ;      Utah $Hdr: srt0.c 1.3 94/12/13$
        !            51: ;
        !            52:
        !            53: #define        _LOCORE
        !            54: #include <machine/iomod.h>
        !            55: #include <machine/asm.h>
        !            56: #include <machine/frame.h>
        !            57:
        !            58: /*
        !            59:  * This is the ending of the begin
        !            60:  */
        !            61: ENTRY(begin,0)
        !            62:
        !            63:        blr     %r0,%r5                 ; Get address of 'boff' into 'r5',
        !            64:        ldo     begin-boff(%r5),%r5     ;   and subtract to get 'begin'.
        !            65: boff
        !            66:        ldil    L%RELOC,%r4
        !            67:        ldo     R%RELOC(%r4),%r4
        !            68:        ldo     start-begin(%r4),%rp
        !            69:        ldil    L%edata,%r3
        !            70:        ldo     R%edata(%r3),%r3        ; Get address of edata.
        !            71:        ldil    L%begin,%r1
        !            72:        ldo     R%begin(%r1),%r1        ; Get address of begin
        !            73:        sub     %r3,%r1,%r3             ; Subtract to get # of bytes to copy
        !            74: copyloop                               ; do
        !            75:        ldwm    4(%r5),%r1              ;   *r4++ = *r5++;
        !            76:        addib,>= -4,%r3,copyloop        ; while (--r3 >= 0);
        !            77:        stwm    %r1,4(%r4)
        !            78:
        !            79:        ; here we zero the .bss
        !            80:        ldil    L%__bss_start, %r4
        !            81:        ldo     R%__bss_start(%r4), %r4
        !            82:        ldil    L%__bss_end, %r3
        !            83:        ldo     R%__bss_end(%r3), %r3
        !            84: zeroloop
        !            85:        combf,<,n %r3,%r4, zeroloop     ; while (r4 < r3);
        !            86:        stwm    %r0,4(%r4)              ;       *r4++ = 0;
        !            87:
        !            88:        ldil    L%$global$,%dp
        !            89:        ldo     R%$global$(%dp),%dp
        !            90:        ldil    L%start,%r1
        !            91:        ldo     R%start(%r1),%r1
        !            92:        sub     %dp,%r1,%dp             ; Subtract to get difference
        !            93:        add     %rp,%dp,%dp             ;   and relocate it.
        !            94:
        !            95: ;
        !            96: ; We have relocated ourself to RELOC.  If we are running on a machine
        !            97: ; with separate instruction and data caches, we must flush our data
        !            98: ; cache before trying to execute the code starting at rp.
        !            99: ;
        !           100:        ldil    L%RELOC,%r22            ; Set %t1 to start of relocated code.
        !           101:        ldo     R%RELOC(%r22),%r22
        !           102:        ldil    L%edata,%r21            ; Set r21 to address of edata
        !           103:        ldo     R%edata(%r21),%r21
        !           104:        ldil    L%begin,%r1             ; set %r1 to address of begin
        !           105:        ldo     R%begin(%r1),%r1
        !           106:        sub     %r21,%r1,%r21           ; Subtract to get length
        !           107:        mtsp    %r0,%sr0                ; Set sr0 to kernel space.
        !           108:        ldo     -1(%r21),%r21
        !           109:        fdc     %r21(0,%r22)
        !           110: loop   addib,>,n -16,%r21,loop         ; Decrement by cache line size (16).
        !           111:        fdc     %r21(%sr0,%r22)
        !           112:        fdc     0(%sr0,%r22)            ; Flush first word at addr to handle
        !           113:        sync                            ;   arbitrary cache line boundary.
        !           114:        nop                             ; Prevent prefetching.
        !           115:        nop
        !           116:        nop
        !           117:        nop
        !           118:        nop
        !           119:        nop
        !           120:        nop
        !           121:        bv      0(%rp)
        !           122:        nop
        !           123: EXIT(begin)                            /* jump to relocated code */
        !           124:
        !           125: start
        !           126:        ldil    L%HEAP_LIMIT, %sp
        !           127:        ldo     R%HEAP_LIMIT(%sp), %sp
        !           128:
        !           129:        .import bootprompt, data
        !           130:        ldil    L%bootprompt, %r1
        !           131:        stw     %arg0, R%bootprompt(%r1)
        !           132:        b       boot                    ; Call boot(),
        !           133:        copy    %r0, %arg0              ; use default boot device
        !           134:        nop
        !           135:
        !           136: /*
        !           137:  * rtt - restart the box
        !           138:  */
        !           139: LEAF_ENTRY(_rtt)
        !           140:        ldil    L%LBCAST_ADDR, %arg1
        !           141:        ldi     CMD_RESET, %arg0
        !           142:        stw     %arg0, R%iomod_command(%arg1)
        !           143: forever                                 ; Loop until bus reset takes effect.
        !           144:        b,n     forever
        !           145:
        !           146:        bv      0(%rp)
        !           147:        ldo     -48(%sp),%sp
        !           148: EXIT(_rtt)
        !           149:
        !           150: ENTRY(pdc_call,96)
        !           151:        copy    %r3, %r1
        !           152:        std     %rp, HPPA_FRAME_RP(%sp)
        !           153:        copy    %sp, %r3
        !           154:        std,ma  %r1, HPPA_FRAME_SIZE+8*4(%sp)
        !           155:
        !           156:        copy    %arg0, %r1
        !           157:        copy    %arg1, %arg0
        !           158:        copy    %arg2, %arg1
        !           159:        copy    %arg3, %arg2
        !           160:        copy    arg4, %arg3
        !           161:        stw     arg5, -(32 + 4*(4 + 1))(%sp)
        !           162:        stw     arg6, -(32 + 4*(5 + 1))(%sp)
        !           163:        stw     arg7, -(32 + 4*(6 + 1))(%sp)
        !           164:        ldw     0(ap), arg5
        !           165:        ldw     8(ap), arg6
        !           166:        ldw     16(ap), arg7
        !           167:        stw     arg5, -(32 + 4*(7 + 1))(%sp)
        !           168:        stw     arg6, -(32 + 4*(8 + 1))(%sp)
        !           169:        stw     arg7, -(32 + 4*(9 + 1))(%sp)
        !           170:
        !           171:        .call
        !           172:        blr     %r0, %rp
        !           173:        bv,n    %r0(%r1)
        !           174:        nop
        !           175:
        !           176:        ldd     HPPA_FRAME_RP(%r3), %rp
        !           177:        bv      %r0(%rp)
        !           178:        ldd,mb  -(HPPA_FRAME_SIZE+8*4)(%sp), %r3
        !           179: EXIT(pdc_call)
        !           180:
        !           181:        .end

CVSweb