Home | History | Annotate | Line # | Download | only in libsa
exec_mvme.c revision 1.2
      1 /*	$NetBSD: exec_mvme.c,v 1.2 2003/08/07 16:28:49 agc Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Steve C. Woodford.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *        This product includes software developed by the NetBSD
     21  *        Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 /*-
     40  * Copyright (c) 1982, 1986, 1990, 1993
     41  *	The Regents of the University of California.  All rights reserved.
     42  *
     43  * Redistribution and use in source and binary forms, with or without
     44  * modification, are permitted provided that the following conditions
     45  * are met:
     46  * 1. Redistributions of source code must retain the above copyright
     47  *    notice, this list of conditions and the following disclaimer.
     48  * 2. Redistributions in binary form must reproduce the above copyright
     49  *    notice, this list of conditions and the following disclaimer in the
     50  *    documentation and/or other materials provided with the distribution.
     51  * 3. Neither the name of the University nor the names of its contributors
     52  *    may be used to endorse or promote products derived from this software
     53  *    without specific prior written permission.
     54  *
     55  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     56  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     57  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     58  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     59  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     60  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     61  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     62  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     63  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     64  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     65  * SUCH DAMAGE.
     66  *
     67  * 	@(#)boot.c	8.1 (Berkeley) 6/10/93
     68  */
     69 
     70 #include <sys/param.h>
     71 #include <sys/reboot.h>
     72 
     73 #include <machine/bootinfo.h>
     74 
     75 #include "loadfile.h"
     76 
     77 #include "stand.h"
     78 #include "libsa.h"
     79 
     80 /* These must agree with what locore.s expects */
     81 #define	KERN_LOADADDR	0x0
     82 typedef void (*kentry_t)(u_int, u_int, struct mvmeppc_bootinfo *);
     83 
     84 
     85 /*ARGSUSED*/
     86 void
     87 exec_mvme(file, flag, part)
     88 	const char *file;
     89 	int	flag;
     90 	int	part;
     91 {
     92 	kentry_t	entry;
     93 	u_long		marks[MARK_MAX];
     94 	int		fd;
     95 	int		lflags;
     96 
     97 	lflags = LOAD_KERNEL;
     98 #if 0
     99 	if ((flag & RB_NOSYM) != 0 )
    100 		lflags &= ~LOAD_SYM;
    101 #endif
    102 
    103 	marks[MARK_START] = KERN_LOADADDR;
    104 	if ((fd = loadfile(file, marks, lflags)) == -1)
    105 		return;
    106 	close(fd);
    107 
    108 	marks[MARK_END] = (((u_long) marks[MARK_END] + sizeof(int) - 1)) &
    109 	    (-sizeof(int));
    110 
    111 	printf("Start @ 0x%lx [%ld=0x%lx-0x%lx]...\n",
    112 	    marks[MARK_ENTRY], marks[MARK_NSYM],
    113 	    marks[MARK_SYM], marks[MARK_END]);
    114 
    115 	entry = (kentry_t) marks[MARK_ENTRY];
    116 
    117 	(*entry)(marks[MARK_SYM], marks[MARK_END], &bootinfo);
    118 
    119 	printf("exec: kernel returned!\n");
    120 	return;
    121 }
    122