Home | History | Annotate | Line # | Download | only in common
exec.c revision 1.3.10.1
      1  1.3.10.1      yamt /*	$NetBSD: exec.c,v 1.3.10.1 2005/03/19 08:32:58 yamt Exp $ */
      2       1.1  gmcgarry 
      3       1.1  gmcgarry /*-
      4       1.1  gmcgarry  * Copyright (c) 1982, 1986, 1990, 1993
      5       1.1  gmcgarry  *	The Regents of the University of California.  All rights reserved.
      6       1.1  gmcgarry  *
      7       1.1  gmcgarry  * Redistribution and use in source and binary forms, with or without
      8       1.1  gmcgarry  * modification, are permitted provided that the following conditions
      9       1.1  gmcgarry  * are met:
     10       1.1  gmcgarry  * 1. Redistributions of source code must retain the above copyright
     11       1.1  gmcgarry  *    notice, this list of conditions and the following disclaimer.
     12       1.1  gmcgarry  * 2. Redistributions in binary form must reproduce the above copyright
     13       1.1  gmcgarry  *    notice, this list of conditions and the following disclaimer in the
     14       1.1  gmcgarry  *    documentation and/or other materials provided with the distribution.
     15       1.2       agc  * 3. Neither the name of the University nor the names of its contributors
     16       1.1  gmcgarry  *    may be used to endorse or promote products derived from this software
     17       1.1  gmcgarry  *    without specific prior written permission.
     18       1.1  gmcgarry  *
     19       1.1  gmcgarry  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     20       1.1  gmcgarry  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     21       1.1  gmcgarry  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     22       1.1  gmcgarry  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     23       1.1  gmcgarry  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     24       1.1  gmcgarry  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     25       1.1  gmcgarry  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26       1.1  gmcgarry  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     27       1.1  gmcgarry  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     28       1.1  gmcgarry  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     29       1.1  gmcgarry  * SUCH DAMAGE.
     30       1.1  gmcgarry  *
     31       1.1  gmcgarry  *	@(#)boot.c	8.1 (Berkeley) 6/10/93
     32       1.1  gmcgarry  */
     33       1.1  gmcgarry 
     34       1.1  gmcgarry #include <sys/param.h>
     35       1.1  gmcgarry 
     36       1.1  gmcgarry #include <machine/bootinfo.h>
     37       1.1  gmcgarry 
     38       1.3   tsutsui #include <lib/libsa/stand.h>
     39       1.1  gmcgarry #include <lib/libsa/loadfile.h>
     40       1.1  gmcgarry 
     41       1.1  gmcgarry #include <hp300/stand/common/samachdep.h>
     42       1.1  gmcgarry 
     43       1.1  gmcgarry #define	round_to_size(x) \
     44       1.1  gmcgarry 	(((x) + sizeof(u_long) - 1) & ~(sizeof(u_long) - 1))
     45       1.1  gmcgarry 
     46       1.1  gmcgarry void
     47  1.3.10.1      yamt exec_hp300(char *file, u_long loadaddr, int howto)
     48       1.1  gmcgarry {
     49       1.1  gmcgarry 	u_long marks[MARK_MAX];
     50       1.1  gmcgarry 	struct btinfo_magic *bt;
     51       1.1  gmcgarry 	int fd;
     52       1.1  gmcgarry 
     53       1.1  gmcgarry 	marks[MARK_START] = loadaddr;
     54       1.1  gmcgarry 	if ((fd = loadfile(file, marks, LOAD_KERNEL)) == -1)
     55       1.1  gmcgarry 		return;
     56       1.1  gmcgarry 
     57       1.1  gmcgarry 	marks[MARK_END] = round_to_size(marks[MARK_END] - loadaddr);
     58       1.1  gmcgarry 	printf("Start @ 0x%lx [%ld=0x%lx-0x%lx]...\n",
     59       1.1  gmcgarry 	    marks[MARK_ENTRY], marks[MARK_NSYM],
     60       1.1  gmcgarry 	    marks[MARK_SYM], marks[MARK_END]);
     61       1.1  gmcgarry 
     62       1.1  gmcgarry 	bt = (struct btinfo_magic *)loadaddr;
     63       1.3   tsutsui 	bt->common.type = BTINFO_MAGIC;
     64       1.3   tsutsui 	bt->magic1 = BOOTINFO_MAGIC1;
     65       1.3   tsutsui 	bt->magic2 = BOOTINFO_MAGIC2;
     66       1.1  gmcgarry 
     67       1.1  gmcgarry 	machdep_start((char *)marks[MARK_ENTRY], howto,
     68       1.1  gmcgarry 	    (char *)loadaddr, (char *)marks[MARK_SYM],
     69       1.1  gmcgarry 	    (char *)marks[MARK_END]);
     70       1.1  gmcgarry }
     71