Annotation of sys/arch/amd64/stand/libsa/exec_i386.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: exec_i386.c,v 1.5 2007/07/27 17:48:01 tom Exp $ */
2:
3: /*
4: * Copyright (c) 1997-1998 Michael Shalayeff
5: * Copyright (c) 1997 Tobias Weingartner
6: * All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: *
17: * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
18: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27: * SUCH DAMAGE.
28: *
29: */
30:
31: #include <sys/param.h>
32: #include <dev/cons.h>
33: #include <stand/boot/bootarg.h>
34: #include <machine/biosvar.h>
35: #include <sys/disklabel.h>
36: #include "disk.h"
37: #include "libsa.h"
38: #include <lib/libsa/loadfile.h>
39:
40: typedef void (*startfuncp)(int, int, int, int, int, int, int, int)
41: __attribute__ ((noreturn));
42:
43: char *bootmac = NULL;
44:
45: void
46: run_loadfile(u_long *marks, int howto)
47: {
48: u_long entry;
49: #ifdef EXEC_DEBUG
50: extern int debug;
51: #endif
52: dev_t bootdev = bootdev_dip->bootdev;
53: size_t ac = BOOTARG_LEN;
54: caddr_t av = (caddr_t)BOOTARG_OFF;
55: bios_consdev_t cd;
56: extern int com_speed; /* from bioscons.c */
57:
58: if (sa_cleanup != NULL)
59: (*sa_cleanup)();
60:
61: cd.consdev = cn_tab->cn_dev;
62: cd.conspeed = com_speed;
63: addbootarg(BOOTARG_CONSDEV, sizeof(cd), &cd);
64:
65: if (bootmac != NULL)
66: addbootarg(BOOTARG_BOOTMAC, sizeof(bios_bootmac_t), bootmac);
67:
68: /* Pass memory map to the kernel */
69: mem_pass();
70:
71: makebootargs(av, &ac);
72:
73: entry = marks[MARK_ENTRY] & 0x0fffffff;
74:
75: printf("entry point at 0x%lx [%x, %x, %x, %x]\n", entry,
76: ((int *)entry)[0], ((int *)entry)[1], ((int *)entry)[2], ((int *)entry)[3]);
77: /* stack and the gung is ok at this point, so, no need for asm setup */
78: (*(startfuncp)entry)(howto, bootdev, BOOTARG_APIVER,
79: marks[MARK_END], extmem, cnvmem, ac, (int)av);
80: /* not reached */
81: }
CVSweb