Home | History | Annotate | Line # | Download | only in common
bootstrap.h revision 1.7.2.2
      1  1.7.2.2      yamt /*	$NetBSD: bootstrap.h,v 1.7.2.2 2014/05/22 11:39:53 yamt Exp $	*/
      2      1.1    cherry 
      3      1.1    cherry /*-
      4      1.1    cherry  * Copyright (c) 1998 Michael Smith <msmith (at) freebsd.org>
      5      1.1    cherry  * All rights reserved.
      6      1.1    cherry  *
      7      1.1    cherry  * Redistribution and use in source and binary forms, with or without
      8      1.1    cherry  * modification, are permitted provided that the following conditions
      9      1.1    cherry  * are met:
     10      1.1    cherry  * 1. Redistributions of source code must retain the above copyright
     11      1.1    cherry  *    notice, this list of conditions and the following disclaimer.
     12      1.1    cherry  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1    cherry  *    notice, this list of conditions and the following disclaimer in the
     14      1.1    cherry  *    documentation and/or other materials provided with the distribution.
     15      1.1    cherry  *
     16      1.1    cherry  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     17      1.1    cherry  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     18      1.1    cherry  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     19      1.1    cherry  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     20      1.1    cherry  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     21      1.1    cherry  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     22      1.1    cherry  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23      1.1    cherry  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     24      1.1    cherry  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25      1.1    cherry  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26      1.1    cherry  * SUCH DAMAGE.
     27      1.1    cherry  *
     28      1.2    cherry  * $FreeBSD: src/sys/boot/common/bootstrap.h,v 1.38.6.1 2004/09/03 19:25:40 iedowse Exp $
     29      1.1    cherry  */
     30      1.1    cherry 
     31      1.1    cherry #ifndef _BOOTSTRAP_H_
     32      1.1    cherry #define _BOOTSTRAP_H_
     33      1.1    cherry 
     34      1.1    cherry #include <sys/types.h>
     35      1.1    cherry #include <sys/queue.h>
     36      1.1    cherry 
     37      1.1    cherry /*
     38      1.7       wiz  * Generic device specifier; architecture-dependent
     39      1.1    cherry  * versions may be larger, but should be allowed to
     40      1.1    cherry  * overlap.
     41      1.1    cherry  */
     42      1.1    cherry 
     43      1.1    cherry struct devdesc
     44      1.1    cherry {
     45      1.1    cherry     struct devsw	*d_dev;
     46      1.1    cherry     int			d_type;
     47      1.1    cherry #define DEVT_NONE	0
     48      1.1    cherry #define DEVT_DISK	1
     49      1.1    cherry #define DEVT_NET	2
     50      1.1    cherry #define	DEVT_CD		3
     51      1.1    cherry };
     52      1.1    cherry 
     53      1.1    cherry typedef int	(bootblk_cmd_t)(int argc, char *argv[]);
     54  1.7.2.2      yamt int command_seterr(const char *fmt, ...) __printflike(1, 2);
     55  1.7.2.2      yamt const char *command_geterr(void);
     56  1.7.2.2      yamt 
     57      1.1    cherry #define CMD_OK		0
     58      1.1    cherry #define CMD_ERROR	1
     59      1.1    cherry 
     60  1.7.2.1      yamt 
     61      1.1    cherry /* interp.c */
     62      1.1    cherry void	interact(void);
     63      1.1    cherry int	include(const char *filename);
     64      1.1    cherry 
     65      1.1    cherry /* interp_backslash.c */
     66      1.1    cherry char	*backslash(char *str);
     67      1.1    cherry 
     68      1.1    cherry /* interp_parse.c */
     69      1.1    cherry int	parse(int *argc, char ***argv, char *str);
     70      1.1    cherry 
     71      1.1    cherry /* interp_forth.c */
     72      1.1    cherry void	bf_init(void);
     73      1.1    cherry int	bf_run(char *line);
     74      1.1    cherry 
     75      1.1    cherry /* boot.c */
     76      1.1    cherry int	autoboot(int timeout, char *prompt);
     77      1.1    cherry void	autoboot_maybe(void);
     78      1.1    cherry int	getrootmount(char *rootdev);
     79      1.1    cherry 
     80      1.1    cherry /* misc.c */
     81      1.1    cherry char	*unargv(int argc, char *argv[]);
     82      1.5  christos void	hexdump(void *region, size_t len);
     83      1.1    cherry size_t	strlenout(vaddr_t str);
     84      1.1    cherry char	*strdupout(vaddr_t str);
     85      1.1    cherry void	kern_bzero(vaddr_t dest, size_t len);
     86      1.1    cherry int	kern_pread(int fd, vaddr_t dest, size_t len, off_t off);
     87      1.1    cherry void	*alloc_pread(int fd, off_t off, size_t len);
     88      1.1    cherry 
     89      1.1    cherry /* bcache.c */
     90      1.1    cherry int	bcache_init(u_int nblks, size_t bsize);
     91      1.1    cherry void	bcache_flush(void);
     92      1.1    cherry int	bcache_strategy(void *devdata, int unit, int rw, daddr_t blk,
     93      1.1    cherry 			size_t size, char *buf, size_t *rsize);
     94      1.1    cherry 
     95      1.1    cherry 
     96      1.1    cherry /* strdup.c */
     97      1.1    cherry char	*strdup(const char*);
     98      1.1    cherry 
     99      1.1    cherry /*
    100      1.1    cherry  * Disk block cache
    101      1.1    cherry  */
    102      1.1    cherry struct bcache_devdata
    103      1.1    cherry {
    104      1.1    cherry     int         (*dv_strategy)(void *devdata, int rw, daddr_t blk, size_t size, char *buf, size_t *rsize);
    105      1.1    cherry     void	*dv_devdata;
    106      1.1    cherry };
    107      1.1    cherry 
    108      1.1    cherry /*
    109      1.1    cherry  * Modular console support.
    110      1.1    cherry  */
    111      1.1    cherry struct console
    112      1.1    cherry {
    113      1.1    cherry     const char	*c_name;
    114      1.1    cherry     const char	*c_desc;
    115      1.1    cherry     int		c_flags;
    116      1.1    cherry #define C_PRESENTIN	(1<<0)
    117      1.1    cherry #define C_PRESENTOUT	(1<<1)
    118      1.1    cherry #define C_ACTIVEIN	(1<<2)
    119      1.1    cherry #define C_ACTIVEOUT	(1<<3)
    120      1.1    cherry     void	(* c_probe)(struct console *cp);	/* set c_flags to match hardware */
    121      1.1    cherry     int		(* c_init)(int arg);			/* reinit XXX may need more args */
    122      1.1    cherry     void	(* c_out)(int c);			/* emit c */
    123      1.1    cherry     int		(* c_in)(void);				/* wait for and return input */
    124      1.1    cherry     int		(* c_ready)(void);			/* return nonzer if input waiting */
    125      1.1    cherry };
    126      1.1    cherry extern struct console	*consoles[];
    127      1.1    cherry void		cons_probe(void);
    128  1.7.2.1      yamt int		ischar(void);
    129      1.1    cherry 
    130      1.1    cherry /*
    131      1.1    cherry  * Plug-and-play enumerator/configurator interface.
    132      1.1    cherry  */
    133      1.1    cherry struct pnphandler
    134      1.1    cherry {
    135      1.1    cherry     const char	*pp_name;		/* handler/bus name */
    136      1.1    cherry     void	(* pp_enumerate)(void);	/* enumerate PnP devices, add to chain */
    137      1.1    cherry };
    138      1.1    cherry 
    139      1.1    cherry struct pnpident
    140      1.1    cherry {
    141      1.1    cherry     char			*id_ident;	/* ASCII identifier, actual format varies with bus/handler */
    142      1.1    cherry     STAILQ_ENTRY(pnpident)	id_link;
    143      1.1    cherry };
    144      1.1    cherry 
    145      1.1    cherry struct pnpinfo
    146      1.1    cherry {
    147      1.1    cherry     char			*pi_desc;	/* ASCII description, optional */
    148      1.1    cherry     int				pi_revision;	/* optional revision (or -1) if not supported */
    149      1.1    cherry     char			*pi_module;	/* module/args nominated to handle device */
    150      1.1    cherry     int				pi_argc;	/* module arguments */
    151      1.1    cherry     char			**pi_argv;
    152      1.1    cherry     struct pnphandler		*pi_handler;	/* handler which detected this device */
    153      1.1    cherry     STAILQ_HEAD(,pnpident)	pi_ident;	/* list of identifiers */
    154      1.1    cherry     STAILQ_ENTRY(pnpinfo)	pi_link;
    155      1.1    cherry };
    156      1.1    cherry 
    157      1.1    cherry STAILQ_HEAD(pnpinfo_stql, pnpinfo);
    158      1.1    cherry 
    159      1.1    cherry extern struct pnpinfo_stql pnp_devices;
    160      1.1    cherry 
    161      1.1    cherry extern struct pnphandler	*pnphandlers[];		/* provided by MD code */
    162      1.1    cherry 
    163      1.1    cherry void			pnp_addident(struct pnpinfo *pi, char *ident);
    164      1.1    cherry struct pnpinfo		*pnp_allocinfo(void);
    165      1.1    cherry void			pnp_freeinfo(struct pnpinfo *pi);
    166      1.1    cherry void			pnp_addinfo(struct pnpinfo *pi);
    167      1.1    cherry char			*pnp_eisaformat(u_int8_t *data);
    168      1.1    cherry 
    169      1.1    cherry /*
    170      1.1    cherry  *  < 0	- No ISA in system
    171      1.1    cherry  * == 0	- Maybe ISA, search for read data port
    172      1.1    cherry  *  > 0	- ISA in system, value is read data port address
    173      1.1    cherry  */
    174      1.1    cherry extern int			isapnp_readport;
    175      1.1    cherry 
    176      1.1    cherry struct preloaded_file;
    177      1.1    cherry 
    178      1.1    cherry /*
    179      1.1    cherry  * Preloaded file information. Depending on type, file can contain
    180      1.1    cherry  * additional units called 'modules'.
    181      1.1    cherry  *
    182      1.1    cherry  * At least one file (the kernel) must be loaded in order to boot.
    183      1.1    cherry  * The kernel is always loaded first.
    184      1.1    cherry  *
    185      1.1    cherry  * String fields (m_name, m_type) should be dynamically allocated.
    186      1.1    cherry  */
    187      1.1    cherry struct preloaded_file
    188      1.1    cherry {
    189      1.1    cherry     char			*f_name;	/* file name */
    190      1.1    cherry     char			*f_type;	/* verbose file type, eg 'ELF kernel', 'pnptable', etc. */
    191      1.1    cherry     char			*f_args;	/* arguments for the file */
    192      1.1    cherry     int				f_loader;	/* index of the loader that read the file */
    193      1.1    cherry     vaddr_t			f_addr;		/* load address */
    194      1.1    cherry     size_t			f_size;		/* file size */
    195      1.1    cherry     struct preloaded_file	*f_next;	/* next file */
    196      1.6  kiyohara     u_long                      marks[MARK_MAX];/* filled by loadfile() */
    197      1.1    cherry };
    198      1.1    cherry 
    199      1.1    cherry struct file_format
    200      1.1    cherry {
    201      1.1    cherry     /* Load function must return EFTYPE if it can't handle the module supplied */
    202      1.1    cherry     int		(* l_load)(char *filename, u_int64_t dest, struct preloaded_file **result);
    203      1.1    cherry     /* Only a loader that will load a kernel (first module) should have an exec handler */
    204      1.1    cherry     int		(* l_exec)(struct preloaded_file *mp);
    205      1.1    cherry };
    206      1.1    cherry 
    207      1.1    cherry extern struct file_format	*file_formats[];	/* supplied by consumer */
    208      1.1    cherry extern struct preloaded_file	*preloaded_files;
    209      1.1    cherry 
    210      1.1    cherry int			mod_load(char *name, int argc, char *argv[]);
    211      1.1    cherry int			mod_loadkld(const char *name, int argc, char *argv[]);
    212      1.1    cherry 
    213      1.1    cherry struct preloaded_file *file_alloc(void);
    214      1.1    cherry struct preloaded_file *file_findfile(char *name, char *type);
    215      1.1    cherry 
    216  1.7.2.1      yamt int file_loadkernel(char *filename, int argc, char *argv[]);
    217      1.1    cherry void file_discard(struct preloaded_file *fp);
    218      1.1    cherry 
    219      1.1    cherry int	elf64_loadfile(char *filename, u_int64_t dest, struct preloaded_file **result);
    220      1.1    cherry 
    221      1.1    cherry /*
    222      1.1    cherry  * Support for commands
    223      1.1    cherry  */
    224      1.1    cherry struct bootblk_command
    225      1.1    cherry {
    226      1.1    cherry     const char		*c_name;
    227      1.1    cherry     const char		*c_desc;
    228      1.1    cherry     bootblk_cmd_t	*c_fn;
    229      1.1    cherry };
    230      1.1    cherry 
    231      1.1    cherry /* Prototypes for the command handlers within stand/common/ */
    232      1.1    cherry 
    233      1.1    cherry /* command.c */
    234      1.1    cherry 
    235      1.1    cherry int command_help(int argc, char *argv[]) ;
    236      1.1    cherry int command_commandlist(int argc, char *argv[]);
    237      1.1    cherry int command_show(int argc, char *argv[]);
    238      1.1    cherry int command_set(int argc, char *argv[]);
    239      1.1    cherry int command_unset(int argc, char *argv[]);
    240      1.1    cherry int command_echo(int argc, char *argv[]);
    241      1.1    cherry int command_read(int argc, char *argv[]);
    242      1.1    cherry int command_more(int argc, char *argv[]);
    243      1.1    cherry int command_lsdev(int argc, char *argv[]);
    244      1.1    cherry 
    245      1.1    cherry /*	bcache.c	XXX: Fixme: Do we need the bcache ?*/
    246      1.1    cherry /* int command_bcache(int argc, char *argv[]); */
    247      1.1    cherry /*	boot.c		*/
    248      1.1    cherry int command_boot(int argc, char *argv[]);
    249      1.1    cherry int command_autoboot(int argc, char *argv[]);
    250      1.1    cherry /*	fileload.c	*/
    251      1.1    cherry int command_load(int argc, char *argv[]);
    252      1.1    cherry int command_unload(int argc, char *argv[]);
    253      1.1    cherry int command_lskern(int argc, char *argv[]);
    254      1.1    cherry /*	interp.c	*/
    255      1.1    cherry int command_include(int argc, char *argv[]);
    256      1.1    cherry /*	ls.c		*/
    257      1.1    cherry int command_ls(int argc, char *argv[]);
    258      1.1    cherry 
    259      1.1    cherry #define COMMAND_SET(a, b, c, d) /* nothing */
    260      1.1    cherry 
    261      1.1    cherry #define COMMON_COMMANDS							\
    262      1.1    cherry 	/*	common.c	*/					\
    263      1.1    cherry 	{ "help",	"detailed help",	command_help },		\
    264      1.1    cherry 	{ "?",		"list commands",	command_commandlist },	\
    265      1.1    cherry 	{ "show", "show variable(s)", command_show },			\
    266      1.1    cherry 	{ "set", "set a variable", command_set },			\
    267      1.1    cherry 	{ "unset", "unset a variable", command_unset },			\
    268      1.1    cherry 	{ "echo", "echo arguments", command_echo },			\
    269      1.1    cherry 	{ "read", "read input from the terminal", command_read },	\
    270      1.1    cherry 	{ "more", "show contents of a file", command_more },		\
    271      1.1    cherry 	{ "lsdev", "list all devices", command_lsdev },			\
    272      1.1    cherry 									\
    273      1.1    cherry 	/*	bcache.c	XXX: Fixme: Do we need the bcache ? */	\
    274      1.1    cherry 									\
    275      1.1    cherry /*	{ "bcachestat", "get disk block cache stats", command_bcache }, */\
    276      1.1    cherry 									\
    277      1.1    cherry 	/*	boot.c	*/						\
    278      1.1    cherry 									\
    279      1.1    cherry 	{ "boot", "boot a file or loaded kernel", command_boot },	\
    280      1.1    cherry 	{ "autoboot", "boot automatically after a delay", command_autoboot }, \
    281      1.1    cherry 									\
    282      1.1    cherry 	/*	fileload.c	*/					\
    283      1.1    cherry 									\
    284      1.1    cherry 	{ "load", "load a kernel", command_load },			\
    285      1.1    cherry 	{ "unload", "unload all modules", command_unload },		\
    286      1.1    cherry 	{ "lskern", "list loaded kernel", command_lskern },		\
    287      1.1    cherry 									\
    288      1.1    cherry 	/*	interp.c	*/					\
    289      1.1    cherry 									\
    290      1.1    cherry 	{ "include", "read commands from a file", command_include },	\
    291      1.1    cherry 									\
    292      1.1    cherry 	/*	ls.c	*/						\
    293      1.1    cherry 									\
    294      1.1    cherry 	{ "ls", "list files", command_ls }
    295      1.1    cherry 
    296      1.1    cherry extern struct bootblk_command commands[];
    297      1.1    cherry 
    298      1.1    cherry 
    299      1.1    cherry /*
    300      1.1    cherry  * The intention of the architecture switch is to provide a convenient
    301      1.1    cherry  * encapsulation of the interface between the bootstrap MI and MD code.
    302      1.1    cherry  * MD code may selectively populate the switch at runtime based on the
    303      1.1    cherry  * actual configuration of the target system.
    304      1.1    cherry  */
    305      1.1    cherry struct arch_switch
    306      1.1    cherry {
    307      1.1    cherry     /* Automatically load modules as required by detected hardware */
    308      1.1    cherry     int		(*arch_autoload)(void);
    309      1.1    cherry     /* Locate the device for (name), return pointer to tail in (*path) */
    310      1.1    cherry     int		(*arch_getdev)(void **dev, const char *name, const char **path);
    311      1.1    cherry     /* Copy from local address space to module address space, similar to bcopy() */
    312      1.1    cherry     ssize_t	(*arch_copyin)(const void *src, vaddr_t dest,
    313      1.1    cherry 			       const size_t len);
    314      1.1    cherry     /* Copy to local address space from module address space, similar to bcopy() */
    315      1.1    cherry     ssize_t	(*arch_copyout)(const vaddr_t src, void *dest,
    316      1.1    cherry 				const size_t len);
    317      1.1    cherry     /* Read from file to module address space, same semantics as read() */
    318      1.1    cherry     ssize_t	(*arch_readin)(const int fd, vaddr_t dest,
    319      1.1    cherry 			       const size_t len);
    320      1.1    cherry     /* Perform ISA byte port I/O (only for systems with ISA) */
    321      1.1    cherry     int		(*arch_isainb)(int port);
    322      1.1    cherry     void	(*arch_isaoutb)(int port, int value);
    323      1.1    cherry };
    324      1.1    cherry extern struct arch_switch archsw;
    325      1.1    cherry 
    326      1.1    cherry /* This must be provided by the MD code, but should it be in the archsw? */
    327      1.1    cherry void	delay(int delay);
    328      1.1    cherry 
    329      1.1    cherry void	dev_cleanup(void);
    330      1.1    cherry 
    331      1.1    cherry time_t	time(time_t *tloc);
    332      1.1    cherry 
    333      1.1    cherry /* calloc.c */
    334      1.1    cherry void    *calloc(unsigned int, unsigned int);
    335      1.1    cherry 
    336  1.7.2.1      yamt /* various string functions */
    337  1.7.2.1      yamt size_t	strspn(const char *s1, const char *s2);
    338  1.7.2.1      yamt size_t	strlen(const char *s);
    339  1.7.2.1      yamt char *strcpy(char * restrict dst, const char * restrict src);
    340  1.7.2.1      yamt char *strcat(char * restrict s, const char * restrict append);
    341  1.7.2.1      yamt 
    342      1.1    cherry /* pager.c */
    343      1.1    cherry extern void	pager_open(void);
    344      1.1    cherry extern void	pager_close(void);
    345      1.1    cherry extern int	pager_output(const char *lines);
    346      1.1    cherry extern int	pager_file(const char *fname);
    347      1.1    cherry 
    348      1.1    cherry /* environment.c */
    349      1.1    cherry #define EV_DYNAMIC	(1<<0)		/* value was dynamically allocated, free if changed/unset */
    350      1.1    cherry #define EV_VOLATILE	(1<<1)		/* value is volatile, make a copy of it */
    351      1.1    cherry #define EV_NOHOOK	(1<<2)		/* don't call hook when setting */
    352      1.1    cherry 
    353      1.1    cherry struct env_var;
    354      1.1    cherry typedef char	*(ev_format_t)(struct env_var *ev);
    355      1.1    cherry typedef int	(ev_sethook_t)(struct env_var *ev, int flags,
    356      1.1    cherry 		    const void *value);
    357      1.1    cherry typedef int	(ev_unsethook_t)(struct env_var *ev);
    358      1.1    cherry 
    359      1.1    cherry struct env_var
    360      1.1    cherry {
    361      1.1    cherry     char		*ev_name;
    362      1.1    cherry     int			ev_flags;
    363      1.1    cherry     void		*ev_value;
    364      1.1    cherry     ev_sethook_t	*ev_sethook;
    365      1.1    cherry     ev_unsethook_t	*ev_unsethook;
    366      1.1    cherry     struct env_var	*ev_next, *ev_prev;
    367      1.1    cherry };
    368      1.1    cherry extern struct env_var	*environ;
    369      1.1    cherry 
    370      1.1    cherry extern struct env_var	*env_getenv(const char *name);
    371      1.1    cherry extern int		env_setenv(const char *name, int flags,
    372      1.1    cherry 				   const void *value, ev_sethook_t sethook,
    373      1.1    cherry 				   ev_unsethook_t unsethook);
    374      1.1    cherry extern char		*getenv(const char *name);
    375      1.1    cherry extern int		setenv(const char *name, const char *value,
    376      1.1    cherry 			       int overwrite);
    377      1.1    cherry extern int		putenv(const char *string);
    378      1.1    cherry extern int		unsetenv(const char *name);
    379      1.1    cherry 
    380      1.1    cherry extern ev_sethook_t	env_noset;		/* refuse set operation */
    381      1.1    cherry extern ev_unsethook_t	env_nounset;		/* refuse unset operation */
    382      1.1    cherry 
    383      1.1    cherry 
    384      1.1    cherry 
    385      1.1    cherry /* FreeBSD wrappers */
    386      1.1    cherry 
    387      1.1    cherry 
    388      1.1    cherry struct dirent *readdirfd(int);               /* XXX move to stand.h */
    389      1.1    cherry 
    390      1.1    cherry #define free(ptr) dealloc(ptr, 0) /* XXX UGLY HACK!!! This should work for just now though. See: libsa/alloc.c:free() */
    391      1.1    cherry 
    392      1.1    cherry /* XXX Hack Hack Hack!!! Need to update stand.h with fs_ops->fo_readdir */
    393      1.1    cherry #ifdef SKIFS /* defined via stand/ia64/ski/Makefile */
    394      1.1    cherry #define FS_READDIR(f, dirptr) skifs_readdir(f, dirptr)
    395      1.1    cherry #else
    396      1.1    cherry #define FS_READDIR(f, dirptr) efifs_readdir(f, dirptr)
    397      1.1    cherry #endif
    398      1.1    cherry 
    399      1.4    cherry /* gets.c XXX move to libsa/ */
    400      1.1    cherry 
    401      1.1    cherry extern int	fgetstr(char *buf, int size, int fd);
    402      1.1    cherry extern void	ngets(char *, int);
    403      1.1    cherry 
    404      1.4    cherry /* imports from stdlib, modified for sa */
    405      1.1    cherry 
    406      1.1    cherry extern long	strtol(const char *, char **, int);
    407      1.1    cherry extern char	*optarg;			/* getopt(3) external variables */
    408      1.1    cherry extern int	optind, opterr, optopt, optreset;
    409      1.1    cherry extern int	getopt(int, char * const [], const char *);
    410      1.1    cherry 
    411      1.1    cherry extern long	strtol(const char *, char **, int);
    412      1.1    cherry 
    413      1.1    cherry /* XXX: From <fcntl.h>. Its not very _STANDALONE friendly */
    414      1.1    cherry /* open-only flags */
    415      1.1    cherry #define	O_RDONLY	0x00000000	/* open for reading only */
    416      1.1    cherry #define	O_WRONLY	0x00000001	/* open for writing only */
    417      1.1    cherry #define	O_RDWR		0x00000002	/* open for reading and writing */
    418      1.1    cherry #define	O_ACCMODE	0x00000003	/* mask for above modes */
    419      1.1    cherry 
    420      1.1    cherry #define ELF64_KERNELTYPE "elf kernel"
    421      1.1    cherry 
    422      1.1    cherry #endif /* _BOOTSTRAP_H_ */
    423