main.c (39944) | main.c (40555) |
---|---|
1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $Id: main.c,v 1.10 1998/10/03 18:27:50 rnordier Exp $ | 26 * $Id: main.c,v 1.11 1998/10/04 09:12:54 msmith Exp $ |
27 */ 28 29/* 30 * MD bootstrap main() and assorted miscellaneous 31 * commands. 32 */ 33 34#include <stand.h> --- 18 unchanged lines hidden (view full) --- 53 54static u_int32_t initial_howto; 55static u_int32_t initial_bootdev; 56static struct bootinfo *initial_bootinfo; 57 58struct arch_switch archsw; /* MI/MD interface boundary */ 59 60static void extract_currdev(void); | 27 */ 28 29/* 30 * MD bootstrap main() and assorted miscellaneous 31 * commands. 32 */ 33 34#include <stand.h> --- 18 unchanged lines hidden (view full) --- 53 54static u_int32_t initial_howto; 55static u_int32_t initial_bootdev; 56static struct bootinfo *initial_bootinfo; 57 58struct arch_switch archsw; /* MI/MD interface boundary */ 59 60static void extract_currdev(void); |
61static int isa_inb(int port); 62static void isa_outb(int port, int value); |
|
61 62/* from vers.c */ 63extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; 64 65/* XXX debugging */ 66extern char end[]; 67 68void --- 44 unchanged lines hidden (view full) --- 113 extract_currdev(); /* set $currdev and $loaddev */ 114 setenv("LINES", "24", 1); /* optional */ 115 116 archsw.arch_autoload = i386_autoload; 117 archsw.arch_getdev = i386_getdev; 118 archsw.arch_copyin = i386_copyin; 119 archsw.arch_copyout = i386_copyout; 120 archsw.arch_readin = i386_readin; | 63 64/* from vers.c */ 65extern char bootprog_name[], bootprog_rev[], bootprog_date[], bootprog_maker[]; 66 67/* XXX debugging */ 68extern char end[]; 69 70void --- 44 unchanged lines hidden (view full) --- 115 extract_currdev(); /* set $currdev and $loaddev */ 116 setenv("LINES", "24", 1); /* optional */ 117 118 archsw.arch_autoload = i386_autoload; 119 archsw.arch_getdev = i386_getdev; 120 archsw.arch_copyin = i386_copyin; 121 archsw.arch_copyout = i386_copyout; 122 archsw.arch_readin = i386_readin; |
123 archsw.arch_isainb = isa_inb; 124 archsw.arch_isaoutb = isa_outb; |
|
121 122 interact(); /* doesn't return */ 123} 124 125/* 126 * Set the 'current device' by (if possible) recovering the boot device as 127 * supplied by the initial bootstrap. 128 * --- 61 unchanged lines hidden (view full) --- 190 191static int 192command_heap(int argc, char *argv[]) 193{ 194 mallocstats(); 195 printf("heap base at %p, top at %p\n", end, sbrk(0)); 196 return(CMD_OK); 197} | 125 126 interact(); /* doesn't return */ 127} 128 129/* 130 * Set the 'current device' by (if possible) recovering the boot device as 131 * supplied by the initial bootstrap. 132 * --- 61 unchanged lines hidden (view full) --- 194 195static int 196command_heap(int argc, char *argv[]) 197{ 198 mallocstats(); 199 printf("heap base at %p, top at %p\n", end, sbrk(0)); 200 return(CMD_OK); 201} |
202 203/* ISA bus access functions for PnP, derived from <machine/cpufunc.h> */ 204static int 205isa_inb(int port) 206{ 207 u_char data; 208 209 if (__builtin_constant_p(port) && 210 (((port) & 0xffff) < 0x100) && 211 ((port) < 0x10000)) { 212 __asm __volatile("inb %1,%0" : "=a" (data) : "id" ((u_short)(port))); 213 } else { 214 __asm __volatile("inb %%dx,%0" : "=a" (data) : "d" (port)); 215 } 216 return(data); 217} 218 219static void 220isa_outb(int port, int value) 221{ 222 u_char al = value; 223 224 if (__builtin_constant_p(port) && 225 (((port) & 0xffff) < 0x100) && 226 ((port) < 0x10000)) { 227 __asm __volatile("outb %0,%1" : : "a" (al), "id" ((u_short)(port))); 228 } else { 229 __asm __volatile("outb %0,%%dx" : : "a" (al), "d" (port)); 230 } 231} 232 |
|