xref: /openbsd/sys/arch/luna88k/stand/boot/exec.c (revision 8352e4cb)
1*8352e4cbSmiod /*	$OpenBSD: exec.c,v 1.1 2023/01/10 17:10:57 miod Exp $	*/
2*8352e4cbSmiod /*	$NetBSD: boot.c,v 1.3 2013/03/05 15:34:53 tsutsui Exp $	*/
3*8352e4cbSmiod 
4*8352e4cbSmiod /*
5*8352e4cbSmiod  * Copyright (c) 1992 OMRON Corporation.
6*8352e4cbSmiod  *
7*8352e4cbSmiod  * This code is derived from software contributed to Berkeley by
8*8352e4cbSmiod  * OMRON Corporation.
9*8352e4cbSmiod  *
10*8352e4cbSmiod  * Redistribution and use in source and binary forms, with or without
11*8352e4cbSmiod  * modification, are permitted provided that the following conditions
12*8352e4cbSmiod  * are met:
13*8352e4cbSmiod  * 1. Redistributions of source code must retain the above copyright
14*8352e4cbSmiod  *    notice, this list of conditions and the following disclaimer.
15*8352e4cbSmiod  * 2. Redistributions in binary form must reproduce the above copyright
16*8352e4cbSmiod  *    notice, this list of conditions and the following disclaimer in the
17*8352e4cbSmiod  *    documentation and/or other materials provided with the distribution.
18*8352e4cbSmiod  * 3. All advertising materials mentioning features or use of this software
19*8352e4cbSmiod  *    must display the following acknowledgement:
20*8352e4cbSmiod  *	This product includes software developed by the University of
21*8352e4cbSmiod  *	California, Berkeley and its contributors.
22*8352e4cbSmiod  * 4. Neither the name of the University nor the names of its contributors
23*8352e4cbSmiod  *    may be used to endorse or promote products derived from this software
24*8352e4cbSmiod  *    without specific prior written permission.
25*8352e4cbSmiod  *
26*8352e4cbSmiod  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27*8352e4cbSmiod  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28*8352e4cbSmiod  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29*8352e4cbSmiod  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30*8352e4cbSmiod  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31*8352e4cbSmiod  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32*8352e4cbSmiod  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33*8352e4cbSmiod  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34*8352e4cbSmiod  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35*8352e4cbSmiod  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36*8352e4cbSmiod  * SUCH DAMAGE.
37*8352e4cbSmiod  *
38*8352e4cbSmiod  *	@(#)boot.c	8.1 (Berkeley) 6/10/93
39*8352e4cbSmiod  */
40*8352e4cbSmiod /*
41*8352e4cbSmiod  * Copyright (c) 1992, 1993
42*8352e4cbSmiod  *	The Regents of the University of California.  All rights reserved.
43*8352e4cbSmiod  *
44*8352e4cbSmiod  * This code is derived from software contributed to Berkeley by
45*8352e4cbSmiod  * OMRON Corporation.
46*8352e4cbSmiod  *
47*8352e4cbSmiod  * Redistribution and use in source and binary forms, with or without
48*8352e4cbSmiod  * modification, are permitted provided that the following conditions
49*8352e4cbSmiod  * are met:
50*8352e4cbSmiod  * 1. Redistributions of source code must retain the above copyright
51*8352e4cbSmiod  *    notice, this list of conditions and the following disclaimer.
52*8352e4cbSmiod  * 2. Redistributions in binary form must reproduce the above copyright
53*8352e4cbSmiod  *    notice, this list of conditions and the following disclaimer in the
54*8352e4cbSmiod  *    documentation and/or other materials provided with the distribution.
55*8352e4cbSmiod  * 3. Neither the name of the University nor the names of its contributors
56*8352e4cbSmiod  *    may be used to endorse or promote products derived from this software
57*8352e4cbSmiod  *    without specific prior written permission.
58*8352e4cbSmiod  *
59*8352e4cbSmiod  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
60*8352e4cbSmiod  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
61*8352e4cbSmiod  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
62*8352e4cbSmiod  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
63*8352e4cbSmiod  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
64*8352e4cbSmiod  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
65*8352e4cbSmiod  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66*8352e4cbSmiod  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
67*8352e4cbSmiod  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
68*8352e4cbSmiod  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
69*8352e4cbSmiod  * SUCH DAMAGE.
70*8352e4cbSmiod  *
71*8352e4cbSmiod  *	@(#)boot.c	8.1 (Berkeley) 6/10/93
72*8352e4cbSmiod  */
73*8352e4cbSmiod 
74*8352e4cbSmiod #include <sys/param.h>
75*8352e4cbSmiod #include <sys/reboot.h>
76*8352e4cbSmiod 
77*8352e4cbSmiod #include <luna88k/stand/boot/samachdep.h>
78*8352e4cbSmiod #include <lib/libsa/loadfile.h>
79*8352e4cbSmiod 
80*8352e4cbSmiod #define	BOOT_MAGIC	0xf1abde3f
81*8352e4cbSmiod 
82*8352e4cbSmiod void (*cpu_boot)(uint32_t, uint32_t, uint32_t, uint32_t);
83*8352e4cbSmiod uint32_t cpu_bootarg1;
84*8352e4cbSmiod uint32_t cpu_bootarg2;
85*8352e4cbSmiod uint32_t cpu_bootarg3;
86*8352e4cbSmiod uint32_t cpu_bootarg4;
87*8352e4cbSmiod 
88*8352e4cbSmiod void
run_loadfile(uint64_t * marks,int howto)89*8352e4cbSmiod run_loadfile(uint64_t *marks, int howto)
90*8352e4cbSmiod {
91*8352e4cbSmiod #ifdef DEBUG
92*8352e4cbSmiod 	printf("entry = 0x%lx\n", marks[MARK_ENTRY]);
93*8352e4cbSmiod 	printf("ssym  = 0x%lx\n", marks[MARK_SYM]);
94*8352e4cbSmiod 	printf("esym  = 0x%lx\n", marks[MARK_END]);
95*8352e4cbSmiod #endif
96*8352e4cbSmiod 
97*8352e4cbSmiod 	cpu_bootarg1 = BOOT_MAGIC;
98*8352e4cbSmiod 	cpu_bootarg2 = (uint32_t)marks[MARK_END];
99*8352e4cbSmiod 	cpu_bootarg3 = bootdev;		/* set by devopen */
100*8352e4cbSmiod 	cpu_bootarg4 = howto;
101*8352e4cbSmiod #ifdef DEBUG
102*8352e4cbSmiod 	printf("bootarg: 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
103*8352e4cbSmiod 	    cpu_bootarg1, cpu_bootarg2, cpu_bootarg3, howto);
104*8352e4cbSmiod #endif
105*8352e4cbSmiod 	cpu_boot = (void (*)(uint32_t, uint32_t, uint32_t, uint32_t))
106*8352e4cbSmiod 	    (uint32_t)marks[MARK_ENTRY];
107*8352e4cbSmiod 	(*cpu_boot)(cpu_bootarg1, cpu_bootarg2, cpu_bootarg3, cpu_bootarg4);
108*8352e4cbSmiod }
109