From dc62b251da95640322845b6c3170ccc7249e96d7 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 10 Nov 2003 06:12:17 +0000 Subject: [PATCH] Fully synchronize sys/boot from FreeBSD-5.x, but add / to the module path so /kernel will be found and loaded instead of /boot/kernel. This will give us all the capabilities of the FreeBSD-5 boot code including AMD64 and ELF64 support. As part of this work, rather then try to adjust ufs/fs.h and friends to get UFS2 info I instead copied the fs.h and friends from FreeBSD-5 into the sys/boot subtree Additionally, import Peter Wemm's linker set improvements from FreeBSD-5.x. They happen to be compatible with GCC 2.95.x and it allows very few changes to be made to the boot code. Additionally import a number of other elements from FreeBSD-5 including sys/diskmbr.h separation. --- sys/bus/cam/cam_periph.c | 12 +- sys/bus/cam/cam_periph.h | 7 +- sys/bus/cam/cam_xpt.c | 33 +++-- sys/conf/Makefile.alpha | 20 +-- sys/conf/Makefile.i386 | 20 +-- sys/conf/Makefile.pc98 | 20 +-- sys/conf/kmod.mk | 9 +- sys/cpu/i386/include/elf.h | 13 +- sys/ddb/db_command.c | 41 +++--- sys/dev/misc/kbd/kbd.c | 16 ++- sys/dev/misc/kbd/kbdreg.h | 3 +- sys/dev/misc/syscons/scterm.c | 8 +- sys/dev/misc/syscons/scvgarndr.c | 4 +- sys/dev/misc/syscons/scvidctl.c | 8 +- sys/dev/misc/syscons/syscons.h | 14 +- sys/dev/serial/ic_layer/ns16550.h | 165 ++++++++++++++++++++++-- sys/dev/serial/sio/sioreg.h | 5 +- sys/dev/video/fb/fb.c | 17 ++- sys/dev/video/fb/fbreg.h | 3 +- sys/emulation/linux/i386/linux.h | 5 +- sys/emulation/linux/i386/linux_sysvec.c | 13 +- sys/emulation/linux/linux_ioctl.c | 36 +----- sys/i386/include/bootinfo.h | 47 ++++++- sys/i386/include/elf.h | 13 +- sys/i386/include/metadata.h | 35 +++++ sys/kern/init_main.c | 53 ++++---- sys/kern/kern_linker.c | 80 ++++++------ sys/kern/kern_sysctl.c | 27 +--- sys/kern/link_aout.c | 45 ++++++- sys/kern/link_elf.c | 66 +++++++++- sys/kern/subr_diskmbr.c | 3 +- sys/kern/subr_diskslice.c | 3 +- sys/kern/tty_cons.c | 7 +- sys/netproto/ncp/ncp_conn.c | 4 +- sys/netproto/smb/smb_conn.c | 4 +- sys/platform/pc32/include/bootinfo.h | 47 ++++++- sys/platform/pc32/include/metadata.h | 35 +++++ sys/sys/cdefs.h | 54 +++++++- sys/sys/cons.h | 3 +- sys/sys/disklabel.h | 57 +------- sys/sys/disklabel32.h | 57 +------- sys/sys/diskmbr.h | 82 ++++++++++++ sys/sys/elf32.h | 3 +- sys/sys/elf64.h | 3 +- sys/sys/elf_generic.h | 4 +- sys/sys/kernel.h | 4 +- sys/sys/linker.h | 29 ++++- sys/sys/linker_set.h | 80 ++++++------ sys/sys/module.h | 35 ++++- sys/sys/odisklabel.h | 57 +------- sys/sys/reboot.h | 3 +- sys/sys/sysctl.h | 8 +- sys/vfs/nwfs/nwfs_io.c | 4 +- sys/vfs/nwfs/nwfs_node.c | 4 +- sys/vfs/smbfs/smbfs_io.c | 4 +- sys/vfs/smbfs/smbfs_node.c | 3 +- 56 files changed, 892 insertions(+), 543 deletions(-) create mode 100644 sys/i386/include/metadata.h create mode 100644 sys/platform/pc32/include/metadata.h create mode 100644 sys/sys/diskmbr.h diff --git a/sys/bus/cam/cam_periph.c b/sys/bus/cam/cam_periph.c index 363ca7a957..68d86d3389 100644 --- a/sys/bus/cam/cam_periph.c +++ b/sys/bus/cam/cam_periph.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/cam_periph.c,v 1.24.2.3 2003/01/25 19:04:40 dillon Exp $ - * $DragonFly: src/sys/bus/cam/cam_periph.c,v 1.5 2003/08/07 21:16:44 dillon Exp $ + * $DragonFly: src/sys/bus/cam/cam_periph.c,v 1.6 2003/11/10 06:12:00 dillon Exp $ */ #include @@ -113,8 +113,7 @@ cam_periph_alloc(periph_ctor_t *periph_ctor, init_level++; - for (p_drv = (struct periph_driver **)periphdriver_set.ls_items; - *p_drv != NULL; p_drv++) { + SET_FOREACH(p_drv, periphdriver_set) { if (strcmp((*p_drv)->driver_name, name) == 0) break; } @@ -202,9 +201,7 @@ cam_periph_find(struct cam_path *path, char *name) struct cam_periph *periph; int s; - for (p_drv = (struct periph_driver **)periphdriver_set.ls_items; - *p_drv != NULL; p_drv++) { - + SET_FOREACH(p_drv, periphdriver_set) { if (name != NULL && (strcmp((*p_drv)->driver_name, name) != 0)) continue; @@ -402,8 +399,7 @@ camperiphfree(struct cam_periph *periph) int s; struct periph_driver **p_drv; - for (p_drv = (struct periph_driver **)periphdriver_set.ls_items; - *p_drv != NULL; p_drv++) { + SET_FOREACH(p_drv, periphdriver_set) { if (strcmp((*p_drv)->driver_name, periph->periph_name) == 0) break; } diff --git a/sys/bus/cam/cam_periph.h b/sys/bus/cam/cam_periph.h index b7cc666b28..6a15b72b87 100644 --- a/sys/bus/cam/cam_periph.h +++ b/sys/bus/cam/cam_periph.h @@ -26,19 +26,22 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/cam_periph.h,v 1.6.2.1 2000/05/07 18:16:49 n_hibma Exp $ - * $DragonFly: src/sys/bus/cam/cam_periph.h,v 1.3 2003/07/19 21:14:11 dillon Exp $ + * $DragonFly: src/sys/bus/cam/cam_periph.h,v 1.4 2003/11/10 06:12:00 dillon Exp $ */ #ifndef _CAM_CAM_PERIPH_H #define _CAM_CAM_PERIPH_H 1 #include +#ifndef _SYS_LINKER_SET_H_ +#include +#endif #ifdef _KERNEL extern struct cam_periph *xpt_periph; -extern struct linker_set periphdriver_set; +SET_DECLARE(periphdriver_set, struct periph_driver); typedef void (periph_init_t)(void); /* * Callback informing the peripheral driver diff --git a/sys/bus/cam/cam_xpt.c b/sys/bus/cam/cam_xpt.c index abd2cfc377..af770aeebd 100644 --- a/sys/bus/cam/cam_xpt.c +++ b/sys/bus/cam/cam_xpt.c @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/cam/cam_xpt.c,v 1.80.2.18 2002/12/09 17:31:55 gibbs Exp $ - * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.6 2003/08/07 21:16:44 dillon Exp $ + * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.7 2003/11/10 06:12:00 dillon Exp $ */ #include #include @@ -1173,10 +1173,10 @@ ptstartover: cur_generation = xsoftc.generation; /* first find our driver in the list of drivers */ - for (p_drv = (struct periph_driver **)periphdriver_set.ls_items; - *p_drv != NULL; p_drv++) + SET_FOREACH(p_drv, periphdriver_set) { if (strcmp((*p_drv)->driver_name, name) == 0) break; + } if (*p_drv == NULL) { splx(s); @@ -2334,9 +2334,7 @@ xptplistperiphfunc(struct cam_periph *periph, void *arg) * peripheral driver linker set entry would cost * more in the long run than doing this quick lookup. */ - for (pdrv = - (struct periph_driver **)periphdriver_set.ls_items; - *pdrv != NULL; pdrv++) { + SET_FOREACH(pdrv, periphdriver_set) { if (strcmp((*pdrv)->driver_name, periph->periph_name) == 0) break; @@ -2538,13 +2536,16 @@ xptpdrvtraverse(struct periph_driver **start_pdrv, * change while the system is running), the list traversal should * be modified to work like the other traversal functions. */ - for (pdrv = (start_pdrv ? start_pdrv : - (struct periph_driver **)periphdriver_set.ls_items); - *pdrv != NULL; pdrv++) { - retval = tr_func(pdrv, arg); - - if (retval == 0) - return(retval); + if (start_pdrv == NULL) { + SET_FOREACH(pdrv, periphdriver_set) { + } + } else { + while (*start_pdrv != NULL) { + retval = tr_func(start_pdrv, arg); + if (retval == 0) + return(retval); + ++start_pdrv; + } } return(retval); @@ -6182,7 +6183,6 @@ static void xpt_finishconfig(struct cam_periph *periph, union ccb *done_ccb) { struct periph_driver **p_drv; - int i; if (done_ccb != NULL) { CAM_DEBUG(done_ccb->ccb_h.path, CAM_DEBUG_TRACE, @@ -6207,9 +6207,8 @@ xpt_finishconfig(struct cam_periph *periph, union ccb *done_ccb) if (busses_to_config == 0) { /* Register all the peripheral drivers */ /* XXX This will have to change when we have loadable modules */ - p_drv = (struct periph_driver **)periphdriver_set.ls_items; - for (i = 0; p_drv[i] != NULL; i++) { - (*p_drv[i]->init)(); + SET_FOREACH(p_drv, periphdriver_set) { + (*p_drv)->init(); } /* diff --git a/sys/conf/Makefile.alpha b/sys/conf/Makefile.alpha index f5764f2ed1..d426e807dd 100644 --- a/sys/conf/Makefile.alpha +++ b/sys/conf/Makefile.alpha @@ -2,7 +2,7 @@ # Copyright 1990 W. Jolitz # from: @(#)Makefile.alpha 7.1 5/10/91 # $FreeBSD: src/sys/conf/Makefile.alpha,v 1.47.2.15 2002/11/18 11:26:49 ru Exp $ -# $DragonFly: src/sys/conf/Attic/Makefile.alpha,v 1.2 2003/06/17 04:28:19 dillon Exp $ +# $DragonFly: src/sys/conf/Attic/Makefile.alpha,v 1.3 2003/11/10 06:12:03 dillon Exp $ # # Makefile for FreeBSD # @@ -77,15 +77,10 @@ NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC} PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC} GEN_CFILES= $S/$M/$M/genassym.c -# setdef0.c and setdef1.c are intentionally -# omitted from SYSTEM_CFILES. They include setdefs.h, a header which -# is generated from all of ${OBJS}. We don't want to have to compile -# everything just to do a make depend. SYSTEM_CFILES= ioconf.c vnode_if.c config.c SYSTEM_SFILES= $S/$M/$M/locore.s SYSTEM_DEP= Makefile ${SYSTEM_OBJS} -SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o config.o \ - setdef1.o hack.So +SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o config.o hack.So SYSTEM_LD= @${LD} -Bdynamic -T $S/conf/ldscript.$M \ -e locorestart \ -export-dynamic -dynamic-linker /red/herring \ @@ -157,17 +152,6 @@ hack.So: Makefile ${CC} -shared -nostdlib hack.c -o hack.So rm -f hack.c -.ORDER: setdefs.h setdef0.c setdef1.c - -setdef0.o: setdef0.c setdefs.h - ${NORMAL_C} - -setdef1.o: setdef1.c setdefs.h - ${NORMAL_C} - -setdef0.c setdef1.c setdefs.h: ${OBJS} - @gensetdefs ${OBJS} - # this rule stops ./assym.s in .depend from causing problems ./assym.s: assym.s diff --git a/sys/conf/Makefile.i386 b/sys/conf/Makefile.i386 index 076ba9cba2..4f1482f46a 100644 --- a/sys/conf/Makefile.i386 +++ b/sys/conf/Makefile.i386 @@ -2,7 +2,7 @@ # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 # $FreeBSD: src/sys/conf/Makefile.i386,v 1.179.2.16 2002/11/18 11:26:49 ru Exp $ -# $DragonFly: src/sys/conf/Attic/Makefile.i386,v 1.6 2003/09/24 03:32:15 drhodus Exp $ +# $DragonFly: src/sys/conf/Attic/Makefile.i386,v 1.7 2003/11/10 06:12:03 dillon Exp $ # # Makefile for FreeBSD # @@ -85,15 +85,10 @@ NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC} PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC} GEN_CFILES= $S/$M/$M/genassym.c -# setdef0.c and setdef1.c are intentionally -# omitted from SYSTEM_CFILES. They include setdefs.h, a header which -# is generated from all of ${OBJS}. We don't want to have to compile -# everything just to do a make depend. SYSTEM_CFILES= ioconf.c vnode_if.c config.c SYSTEM_SFILES= $S/$M/$M/locore.s SYSTEM_DEP= Makefile ${SYSTEM_OBJS} -SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o config.o \ - setdef1.o hack.So +SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o config.o hack.So SYSTEM_LD= @${LD} -Bdynamic -T $S/conf/ldscript.$M \ -export-dynamic -dynamic-linker /red/herring \ -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o @@ -165,17 +160,6 @@ hack.So: Makefile ${CC} -shared -nostdlib hack.c -o hack.So rm -f hack.c -.ORDER: setdefs.h setdef0.c setdef1.c - -setdef0.o: setdef0.c setdefs.h - ${NORMAL_C} - -setdef1.o: setdef1.c setdefs.h - ${NORMAL_C} - -setdef0.c setdef1.c setdefs.h: ${OBJS} - @gensetdefs ${OBJS} - # this rule stops ./assym.s in .depend from causing problems ./assym.s: assym.s diff --git a/sys/conf/Makefile.pc98 b/sys/conf/Makefile.pc98 index 624a1daa62..f28de31e76 100644 --- a/sys/conf/Makefile.pc98 +++ b/sys/conf/Makefile.pc98 @@ -4,7 +4,7 @@ # Copyright 1990 W. Jolitz # from: @(#)Makefile.i386 7.1 5/10/91 # $FreeBSD: src/sys/conf/Makefile.pc98,v 1.82.2.17 2002/11/18 11:26:49 ru Exp $ -# $DragonFly: src/sys/conf/Attic/Makefile.pc98,v 1.2 2003/06/17 04:28:19 dillon Exp $ +# $DragonFly: src/sys/conf/Attic/Makefile.pc98,v 1.3 2003/11/10 06:12:03 dillon Exp $ # # Makefile for FreeBSD # @@ -79,15 +79,10 @@ NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC} PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC} GEN_CFILES= $S/$M/$M/genassym.c -# setdef0.c and setdef1.c are intentionally -# omitted from SYSTEM_CFILES. They include setdefs.h, a header which -# is generated from all of ${OBJS}. We don't want to have to compile -# everything just to do a make depend. SYSTEM_CFILES= ioconf.c vnode_if.c config.c SYSTEM_SFILES= $S/$M/$M/locore.s SYSTEM_DEP= Makefile ${SYSTEM_OBJS} -SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o config.o \ - setdef1.o hack.So +SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o config.o hack.So SYSTEM_LD= @${LD} -Bdynamic -T $S/conf/ldscript.$M \ -export-dynamic -dynamic-linker /red/herring \ -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o @@ -159,17 +154,6 @@ hack.So: Makefile ${CC} -shared -nostdlib hack.c -o hack.So rm -f hack.c -.ORDER: setdefs.h setdef0.c setdef1.c - -setdef0.o: setdef0.c setdefs.h - ${NORMAL_C} - -setdef1.o: setdef1.c setdefs.h - ${NORMAL_C} - -setdef0.c setdef1.c setdefs.h: ${OBJS} - @gensetdefs ${OBJS} - # this rule stops ./assym.s in .depend from causing problems ./assym.s: assym.s diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index bc29866179..54a8534d04 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -1,6 +1,6 @@ # From: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 # $FreeBSD: src/sys/conf/kmod.mk,v 1.82.2.15 2003/02/10 13:11:50 nyan Exp $ -# $DragonFly: src/sys/conf/kmod.mk,v 1.5 2003/08/15 06:32:58 dillon Exp $ +# $DragonFly: src/sys/conf/kmod.mk,v 1.6 2003/11/10 06:12:03 dillon Exp $ # # The include file handles installing Kernel Loadable Device # drivers (KLD's). @@ -110,14 +110,7 @@ PROG= ${KMOD}.ko .endif ${PROG}: ${KMOD}.kld ${KMODDEPS} -.if ${OBJFORMAT} == elf - gensetdefs ${KMOD}.kld - ${CC} ${CFLAGS} -c setdef0.c - ${CC} ${CFLAGS} -c setdef1.c - ${LD} -Bshareable ${LDFLAGS} -o ${.TARGET} setdef0.o ${KMOD}.kld setdef1.o ${KMODDEPS} -.else ${LD} -Bshareable ${LDFLAGS} -o ${.TARGET} ${KMOD}.kld ${KMODDEPS} -.endif .if defined(KMODDEPS) .for dep in ${KMODDEPS} diff --git a/sys/cpu/i386/include/elf.h b/sys/cpu/i386/include/elf.h index 1ad1b41655..ca28c597b8 100644 --- a/sys/cpu/i386/include/elf.h +++ b/sys/cpu/i386/include/elf.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/elf.h,v 1.9.2.1 2001/11/03 01:41:08 ps Exp $ - * $DragonFly: src/sys/cpu/i386/include/elf.h,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/cpu/i386/include/elf.h,v 1.3 2003/11/10 06:12:12 dillon Exp $ */ #ifndef _MACHINE_ELF_H_ @@ -35,8 +35,12 @@ */ #include /* Definitions common to all 32 bit architectures. */ +#include /* Definitions common to all 32 bit architectures. */ +#ifndef __ELF_WORD_SIZE #define __ELF_WORD_SIZE 32 /* Used by */ +#endif + #include #define ELF_ARCH EM_386 @@ -59,6 +63,13 @@ typedef struct { /* Auxiliary vector entry on initial stack */ } a_un; } Elf32_Auxinfo; +#if __ELF_WORD_SIZE == 64 +/* Fake for amd64 loader support */ +typedef struct { + int fake; +} Elf64_Auxinfo; +#endif + __ElfType(Auxinfo); /* Values for a_type. */ diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c index b6bfdef081..88c6fabf1e 100644 --- a/sys/ddb/db_command.c +++ b/sys/ddb/db_command.c @@ -24,7 +24,7 @@ * rights to redistribute these changes. * * $FreeBSD: src/sys/ddb/db_command.c,v 1.34.2.2 2001/07/29 22:48:36 kris Exp $ - * $DragonFly: src/sys/ddb/db_command.c,v 1.5 2003/08/27 10:47:13 rob Exp $ + * $DragonFly: src/sys/ddb/db_command.c,v 1.6 2003/11/10 06:12:04 dillon Exp $ */ /* @@ -54,13 +54,14 @@ * Exported global variables */ boolean_t db_cmd_loop_done; -extern struct linker_set db_cmd_set; db_addr_t db_dot; jmp_buf db_jmpbuf; db_addr_t db_last_addr; db_addr_t db_prev; db_addr_t db_next; -extern struct linker_set db_show_cmd_set; + +SET_DECLARE(db_cmd_set, struct command); +SET_DECLARE(db_show_cmd_set, struct command); static db_cmdfcn_t db_fncall; static db_cmdfcn_t db_gdb; @@ -98,22 +99,26 @@ db_skip_to_eol() #define CMD_HELP 4 static void db_cmd_list (struct command *table, - struct command **aux_tablep); + struct command **aux_tablep, + struct command **aux_tablep_end); static int db_cmd_search (char *name, struct command *table, struct command **aux_tablep, + struct command **aux_tablep_end, struct command **cmdp); static void db_command (struct command **last_cmdp, struct command *cmd_table, - struct command **aux_cmd_tablep); + struct command **aux_cmd_tablep, + struct command **aux_cmd_tablep_end); /* * Search for command prefix. */ static int -db_cmd_search(name, table, aux_tablep, cmdp) +db_cmd_search(name, table, aux_tablep, aux_tablep_end, cmdp) char * name; struct command *table; struct command **aux_tablep; + struct command **aux_tablep_end; struct command **cmdp; /* out */ { struct command *cmd; @@ -152,7 +157,7 @@ db_cmd_search(name, table, aux_tablep, cmdp) } if (result == CMD_NONE && aux_tablep != 0) /* XXX repeat too much code. */ - for (aux_cmdp = aux_tablep; *aux_cmdp != 0; aux_cmdp++) { + for (aux_cmdp = aux_tablep; aux_cmdp < aux_tablep_end; aux_cmdp++) { char *lp; char *rp; int c; @@ -192,9 +197,10 @@ db_cmd_search(name, table, aux_tablep, cmdp) } static void -db_cmd_list(table, aux_tablep) +db_cmd_list(table, aux_tablep, aux_tablep_end) struct command *table; struct command **aux_tablep; + struct command **aux_tablep_end; { struct command *cmd; struct command **aux_cmdp; @@ -205,17 +211,18 @@ db_cmd_list(table, aux_tablep) } if (aux_tablep == 0) return; - for (aux_cmdp = aux_tablep; *aux_cmdp != 0; aux_cmdp++) { + for (aux_cmdp = aux_tablep; aux_cmdp < aux_tablep_end; aux_cmdp++) { db_printf("%-12s", (*aux_cmdp)->name); db_end_line(); } } static void -db_command(last_cmdp, cmd_table, aux_cmd_tablep) +db_command(last_cmdp, cmd_table, aux_cmd_tablep, aux_cmd_tablep_end) struct command **last_cmdp; /* IN_OUT */ struct command *cmd_table; struct command **aux_cmd_tablep; + struct command **aux_cmd_tablep_end; { struct command *cmd; int t; @@ -250,6 +257,7 @@ db_command(last_cmdp, cmd_table, aux_cmd_tablep) result = db_cmd_search(db_tok_string, cmd_table, aux_cmd_tablep, + aux_cmd_tablep_end, &cmd); switch (result) { case CMD_NONE: @@ -261,7 +269,7 @@ db_command(last_cmdp, cmd_table, aux_cmd_tablep) db_flush_lex(); return; case CMD_HELP: - db_cmd_list(cmd_table, aux_cmd_tablep); + db_cmd_list(cmd_table, aux_cmd_tablep, aux_cmd_tablep_end); db_flush_lex(); return; default: @@ -270,13 +278,14 @@ db_command(last_cmdp, cmd_table, aux_cmd_tablep) if ((cmd_table = cmd->more) != 0) { /* XXX usually no more aux's. */ aux_cmd_tablep = 0; - if (cmd_table == db_show_cmds) - aux_cmd_tablep = - (struct command **)&db_show_cmd_set.ls_items[0]; + if (cmd_table == db_show_cmds) { + aux_cmd_tablep = SET_BEGIN(db_show_cmd_set); + aux_cmd_tablep_end = SET_LIMIT(db_show_cmd_set); + } t = db_read_token(); if (t != tIDENT) { - db_cmd_list(cmd_table, aux_cmd_tablep); + db_cmd_list(cmd_table, aux_cmd_tablep, aux_cmd_tablep_end); db_flush_lex(); return; } @@ -461,7 +470,7 @@ db_command_loop() (void) db_read_line(); db_command(&db_last_command, db_command_table, - (struct command **)&db_cmd_set.ls_items[0]); + SET_BEGIN(db_cmd_set), SET_LIMIT(db_cmd_set)); } } diff --git a/sys/dev/misc/kbd/kbd.c b/sys/dev/misc/kbd/kbd.c index 02685cfc65..f389103885 100644 --- a/sys/dev/misc/kbd/kbd.c +++ b/sys/dev/misc/kbd/kbd.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/kbd/kbd.c,v 1.17.2.2 2001/07/30 16:46:43 yokota Exp $ - * $DragonFly: src/sys/dev/misc/kbd/kbd.c,v 1.6 2003/08/07 21:16:56 dillon Exp $ + * $DragonFly: src/sys/dev/misc/kbd/kbd.c,v 1.7 2003/11/10 06:12:05 dillon Exp $ */ #include "opt_kbd.h" @@ -56,6 +56,8 @@ typedef struct genkbd_softc { static SLIST_HEAD(, keyboard_driver) keyboard_drivers = SLIST_HEAD_INITIALIZER(keyboard_drivers); +SET_DECLARE(kbddriver_set, const keyboard_driver_t); + /* local arrays */ /* @@ -203,8 +205,8 @@ kbd_register(keyboard_t *kbd) return index; } } - list = (const keyboard_driver_t **)kbddriver_set.ls_items; - while ((p = *list++) != NULL) { + SET_FOREACH(list, kbddriver_set) { + p = *list; if (strcmp(p->name, kbd->kb_name) == 0) { keyboard[index] = kbd; kbdsw[index] = p->kbdsw; @@ -258,8 +260,8 @@ keyboard_switch_t if (strcmp(p->name, driver) == 0) return p->kbdsw; } - list = (const keyboard_driver_t **)kbddriver_set.ls_items; - while ((p = *list++) != NULL) { + SET_FOREACH(list, kbddriver_set) { + p = *list; if (strcmp(p->name, driver) == 0) return p->kbdsw; } @@ -397,8 +399,8 @@ kbd_configure(int flags) if (p->configure != NULL) (*p->configure)(flags); } - list = (const keyboard_driver_t **)kbddriver_set.ls_items; - while ((p = *list++) != NULL) { + SET_FOREACH(list, kbddriver_set) { + p = *list; if (p->configure != NULL) (*p->configure)(flags); } diff --git a/sys/dev/misc/kbd/kbdreg.h b/sys/dev/misc/kbd/kbdreg.h index f1d20052e5..ca56a7638e 100644 --- a/sys/dev/misc/kbd/kbdreg.h +++ b/sys/dev/misc/kbd/kbdreg.h @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/kbd/kbdreg.h,v 1.9.2.2 2001/07/30 16:46:44 yokota Exp $ - * $DragonFly: src/sys/dev/misc/kbd/kbdreg.h,v 1.2 2003/06/17 04:28:28 dillon Exp $ + * $DragonFly: src/sys/dev/misc/kbd/kbdreg.h,v 1.3 2003/11/10 06:12:05 dillon Exp $ */ #ifndef _DEV_KBD_KBDREG_H_ @@ -175,7 +175,6 @@ typedef struct keyboard_driver { /* global variables */ extern keyboard_switch_t **kbdsw; -extern struct linker_set kbddriver_set; /* functions for the keyboard driver */ int kbd_add_driver(keyboard_driver_t *driver); diff --git a/sys/dev/misc/syscons/scterm.c b/sys/dev/misc/syscons/scterm.c index d89d70c8ca..56c4e2c004 100644 --- a/sys/dev/misc/syscons/scterm.c +++ b/sys/dev/misc/syscons/scterm.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/scterm.c,v 1.2 2000/01/29 15:08:46 peter Exp $ - * $DragonFly: src/sys/dev/misc/syscons/scterm.c,v 1.3 2003/08/07 21:16:59 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/scterm.c,v 1.4 2003/11/10 06:12:06 dillon Exp $ */ #include "opt_syscons.h" @@ -37,6 +37,8 @@ #include "syscons.h" #include "sctermvar.h" +SET_DECLARE(scterm_set, sc_term_sw_t); + /* exported subroutines */ void @@ -96,8 +98,8 @@ sc_term_sw_t } } } else { - list = (sc_term_sw_t **)scterm_set.ls_items; - while ((p = *list++) != NULL) { + SET_FOREACH(list, scterm_set) { + p = *list; if ((strcmp(name, p->te_name) == 0) || (strcmp(name, "*") == 0)) { return p; diff --git a/sys/dev/misc/syscons/scvgarndr.c b/sys/dev/misc/syscons/scvgarndr.c index 69cb15952f..c3ddaf6439 100644 --- a/sys/dev/misc/syscons/scvgarndr.c +++ b/sys/dev/misc/syscons/scvgarndr.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/scvgarndr.c,v 1.5.2.3 2001/07/28 12:51:47 yokota Exp $ - * $DragonFly: src/sys/dev/misc/syscons/scvgarndr.c,v 1.3 2003/08/07 21:16:59 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/scvgarndr.c,v 1.4 2003/11/10 06:12:06 dillon Exp $ */ #include "opt_syscons.h" @@ -79,8 +79,6 @@ static vr_draw_border_t vga_grborder; static void vga_nop(scr_stat *scp, ...); -static struct linker_set vga_set; - static sc_rndr_sw_t txtrndrsw = { vga_txtclear, vga_txtborder, diff --git a/sys/dev/misc/syscons/scvidctl.c b/sys/dev/misc/syscons/scvidctl.c index acb11e9d2c..3ab7391204 100644 --- a/sys/dev/misc/syscons/scvidctl.c +++ b/sys/dev/misc/syscons/scvidctl.c @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/scvidctl.c,v 1.19.2.2 2000/05/05 09:16:08 nyan Exp $ - * $DragonFly: src/sys/dev/misc/syscons/scvidctl.c,v 1.4 2003/08/07 21:16:59 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/scvidctl.c,v 1.5 2003/11/10 06:12:06 dillon Exp $ */ #include "opt_syscons.h" @@ -41,6 +41,8 @@ #include #include "syscons.h" +SET_DECLARE(scrndr_set, const sc_renderer_t); + /* for compatibility with previous versions */ /* 3.0-RELEASE used the following structure */ typedef struct old_video_adapter { @@ -804,8 +806,8 @@ sc_rndr_sw_t } } } else { - list = (const sc_renderer_t **)scrndr_set.ls_items; - while ((p = *list++) != NULL) { + SET_FOREACH(list, scrndr_set) { + p = *list; if ((strcmp(p->name, name) == 0) && (mode == p->mode)) { scp->status &= diff --git a/sys/dev/misc/syscons/syscons.h b/sys/dev/misc/syscons/syscons.h index ff25b750e4..adbd55d374 100644 --- a/sys/dev/misc/syscons/syscons.h +++ b/sys/dev/misc/syscons/syscons.h @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/syscons/syscons.h,v 1.60.2.6 2002/09/15 22:30:45 dd Exp $ - * $DragonFly: src/sys/dev/misc/syscons/syscons.h,v 1.3 2003/06/23 17:55:35 dillon Exp $ + * $DragonFly: src/sys/dev/misc/syscons/syscons.h,v 1.4 2003/11/10 06:12:06 dillon Exp $ */ #ifndef _DEV_SYSCONS_SYSCONS_H_ @@ -425,25 +425,23 @@ extern struct linker_set scrndr_set; DATA_SET(set, scrndr_##name##_##mode##) #define RENDERER_MODULE(name, set) \ + SET_DECLARE(set, sc_renderer_t); \ static int \ scrndr_##name##_event(module_t mod, int type, void *data) \ { \ sc_renderer_t **list; \ - sc_renderer_t *p; \ int error = 0; \ switch (type) { \ case MOD_LOAD: \ - list = (sc_renderer_t **)set.ls_items; \ - while ((p = *list++) != NULL) { \ - error = sc_render_add(p); \ + SET_FOREACH(list, set) { \ + error = sc_render_add(*list); \ if (error) \ break; \ } \ break; \ case MOD_UNLOAD: \ - list = (sc_renderer_t **)set.ls_items; \ - while ((p = *list++) != NULL) { \ - error = sc_render_remove(p); \ + SET_FOREACH(list, set) { \ + error = sc_render_remove(*list); \ if (error) \ break; \ } \ diff --git a/sys/dev/serial/ic_layer/ns16550.h b/sys/dev/serial/ic_layer/ns16550.h index 5d0fabe866..8951a6ecc3 100644 --- a/sys/dev/serial/ic_layer/ns16550.h +++ b/sys/dev/serial/ic_layer/ns16550.h @@ -31,21 +31,166 @@ * SUCH DAMAGE. * * from: @(#)ns16550.h 7.1 (Berkeley) 5/9/91 - * $FreeBSD: src/sys/dev/ic/ns16550.h,v 1.8.2.1 2002/02/03 14:52:02 nyan Exp $ - * $DragonFly: src/sys/dev/serial/ic_layer/ns16550.h,v 1.2 2003/06/17 04:28:27 dillon Exp $ + * $FreeBSD: src/sys/dev/ic/ns16550.h,v 1.14 2003/09/16 14:21:17 bde Exp $ + * $DragonFly: src/sys/dev/serial/ic_layer/ns16550.h,v 1.3 2003/11/10 06:12:07 dillon Exp $ */ /* - * NS16550 UART registers + * NS8250... UART registers. */ + +/* 8250 registers #[0-6]. */ + #define com_data 0 /* data register (R/W) */ -#define com_dlbl 0 /* divisor latch low (W) */ -#define com_dlbh 1 /* divisor latch high (W) */ -#define com_ier 1 /* interrupt enable (W) */ -#define com_iir 2 /* interrupt identification (R) */ -#define com_fifo 2 /* FIFO control (W) */ -#define com_lctl 3 /* line control register (R/W) */ -#define com_cfcr 3 /* line control register (R/W) */ +#define com_thr com_data /* transmitter holding register (W) */ +#define com_rhr com_data /* receiver holding register (R) */ + +#define com_ier 1 /* interrupt enable register (W) */ +#define IER_ERXRDY 0x1 +#define IER_ETXRDY 0x2 +#define IER_ERLS 0x4 +#define IER_EMSC 0x8 + +#define com_iir 2 /* interrupt identification register (R) */ +#define com_isr com_iir /* interrupt status register (R) */ +#define IIR_IMASK 0xf +#define IIR_RXTOUT 0xc +#define IIR_RLS 0x6 +#define IIR_RXRDY 0x4 +#define IIR_TXRDY 0x2 +#define IIR_NOPEND 0x1 +#define IIR_MLSC 0x0 +#define IIR_FIFO_MASK 0xc0 /* set if FIFOs are enabled */ + +#define com_lcr 3 /* line control register (R/W) */ +#define com_lctl com_lcr +#define com_cfcr com_lcr /* character format control register (R/W) */ +#define LCR_DLAB 0x80 +#define CFCR_DLAB LCR_DLAB +#define LCR_EFR_ENABLE 0xbf /* magic to enable EFR on 16650 up */ +#define CFCR_EFR_ENABLE LCR_EFR_ENABLE +#define CFCR_SBREAK 0x40 +#define CFCR_PZERO 0x30 +#define CFCR_PONE 0x20 +#define CFCR_PEVEN 0x10 +#define CFCR_PODD 0x00 +#define CFCR_PENAB 0x08 +#define CFCR_STOPB 0x04 +#define CFCR_8BITS 0x03 +#define CFCR_7BITS 0x02 +#define CFCR_6BITS 0x01 +#define CFCR_5BITS 0x00 + #define com_mcr 4 /* modem control register (R/W) */ +#define MCR_PRESCALE 0x80 /* only available on 16650 up */ +#define MCR_LOOPBACK 0x10 +#define MCR_IENABLE 0x08 +#define MCR_DRS 0x04 +#define MCR_RTS 0x02 +#define MCR_DTR 0x01 + #define com_lsr 5 /* line status register (R/W) */ +#define LSR_RCV_FIFO 0x80 +#define LSR_TSRE 0x40 +#define LSR_TXRDY 0x20 +#define LSR_BI 0x10 +#define LSR_FE 0x08 +#define LSR_PE 0x04 +#define LSR_OE 0x02 +#define LSR_RXRDY 0x01 +#define LSR_RCV_MASK 0x1f + #define com_msr 6 /* modem status register (R/W) */ +#define MSR_DCD 0x80 +#define MSR_RI 0x40 +#define MSR_DSR 0x20 +#define MSR_CTS 0x10 +#define MSR_DDCD 0x08 +#define MSR_TERI 0x04 +#define MSR_DDSR 0x02 +#define MSR_DCTS 0x01 + +/* 8250 multiplexed registers #[0-1]. Access enabled by LCR[7]. */ +#define com_dll 0 /* divisor latch low (R/W) */ +#define com_dlbl com_dll +#define com_dlm 1 /* divisor latch high (R/W) */ +#define com_dlbh com_dlm + +/* 16450 register #7. Not multiplexed. */ +#define com_scr 7 /* scratch register (R/W) */ + +/* 16550 register #2. Not multiplexed. */ +#define com_fcr 2 /* FIFO control register (W) */ +#define com_fifo com_fcr +#define FIFO_ENABLE 0x01 +#define FIFO_RCV_RST 0x02 +#define FIFO_XMT_RST 0x04 +#define FIFO_DMA_MODE 0x08 +#define FIFO_RX_LOW 0x00 +#define FIFO_RX_MEDL 0x40 +#define FIFO_RX_MEDH 0x80 +#define FIFO_RX_HIGH 0xc0 + +/* 16650 registers #2,[4-7]. Access enabled by LCR_EFR_ENABLE. */ + +#define com_efr 2 /* enhanced features register (R/W) */ +#define EFR_AUTOCTS 0x80 +#define EFR_AUTORTS 0x40 +#define EFR_EFE 0x10 /* enhanced functions enable */ + +#define com_xon1 4 /* XON 1 character (R/W) */ +#define com_xon2 5 /* XON 2 character (R/W) */ +#define com_xoff1 6 /* XOFF 1 character (R/W) */ +#define com_xoff2 7 /* XOFF 2 character (R/W) */ + +/* 16950 register #1. Access enabled by ACR[7]. Also requires !LCR[7]. */ +#define com_asr 1 /* additional status register (R[0-7]/W[0-1]) */ + +/* 16950 register #3. R/W access enabled by ACR[7]. */ +#define com_rfl 3 /* receiver fifo level (R) */ + +/* + * 16950 register #4. Access enabled by ACR[7]. Also requires + * !LCR_EFR_ENABLE. + */ +#define com_tfl 4 /* transmitter fifo level (R) */ + +/* + * 16950 register #5. Accessible if !LCR_EFR_ENABLE. Read access also + * requires ACR[6]. + */ +#define com_icr 5 /* index control register (R/W) */ + +/* + * 16950 register #7. It is the same as com_scr except it has a different + * abbreviation in the manufacturer's data sheet and it also serves as an + * index into the Indexed Control register set. + */ +#define com_spr com_scr /* scratch pad (and index) register (R/W) */ + +/* + * 16950 indexed control registers #[0-0x13]. Access is via index in SPR, + * data in ICR (if ICR is accessible). + */ + +#define com_acr 0 /* additional control register (R/W) */ +#define ACR_ASE 0x80 /* ASR/RFL/TFL enable */ +#define ACR_ICRE 0x40 /* ICR enable */ +#define ACR_TLE 0x20 /* TTL/RTL enable */ + +#define com_cpr 1 /* clock prescaler register (R/W) */ +#define com_tcr 2 /* times clock register (R/W) */ +#define com_ttl 4 /* transmitter trigger level (R/W) */ +#define com_rtl 5 /* receiver trigger level (R/W) */ +/* ... */ + +#ifdef PC98 +/* Hardware extension mode register for RSB-2000/3000. */ +#define com_emr com_msr +#define EMR_EXBUFF 0x04 +#define EMR_CTSFLW 0x08 +#define EMR_DSRFLW 0x10 +#define EMR_RTSFLW 0x20 +#define EMR_DTRFLW 0x40 +#define EMR_EFMODE 0x80 +#endif diff --git a/sys/dev/serial/sio/sioreg.h b/sys/dev/serial/sio/sioreg.h index 55268523bc..9559c37f12 100644 --- a/sys/dev/serial/sio/sioreg.h +++ b/sys/dev/serial/sio/sioreg.h @@ -32,7 +32,7 @@ * * from: @(#)comreg.h 7.2 (Berkeley) 5/9/91 * $FreeBSD: src/sys/isa/sioreg.h,v 1.15.2.3 2003/04/04 08:42:17 sobomax Exp $ - * $DragonFly: src/sys/dev/serial/sio/sioreg.h,v 1.2 2003/06/17 04:28:40 dillon Exp $ + * $DragonFly: src/sys/dev/serial/sio/sioreg.h,v 1.3 2003/11/10 06:12:08 dillon Exp $ */ /* Receiver clock frequency for "standard" pc serial ports. */ @@ -65,7 +65,6 @@ #define FIFO_RX_HIGH 0xc0 /* character format control register (aka line control register) */ -#define CFCR_DLAB 0x80 #define CFCR_SBREAK 0x40 #define CFCR_PZERO 0x30 #define CFCR_PONE 0x20 @@ -77,7 +76,6 @@ #define CFCR_7BITS 0x02 #define CFCR_6BITS 0x01 #define CFCR_5BITS 0x00 -#define CFCR_EFR_ENABLE 0xbf /* magic to enable EFR on 16650 up */ /* modem control register */ #define MCR_PRESCALE 0x80 /* only available on 16650 up */ @@ -109,7 +107,6 @@ #define MSR_DCTS 0x01 /* enhanced feature register (only available on 16650 up) */ -#define com_efr com_fifo #define EFR_EFE 0x10 /* enhanced functions enable */ #ifdef PC98 diff --git a/sys/dev/video/fb/fb.c b/sys/dev/video/fb/fb.c index 3aa5a7c334..d2cdd7c8fa 100644 --- a/sys/dev/video/fb/fb.c +++ b/sys/dev/video/fb/fb.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/fb/fb.c,v 1.11.2.2 2000/08/02 22:35:22 peter Exp $ - * $DragonFly: src/sys/dev/video/fb/fb.c,v 1.6 2003/08/07 21:17:15 dillon Exp $ + * $DragonFly: src/sys/dev/video/fb/fb.c,v 1.7 2003/11/10 06:12:09 dillon Exp $ */ #include "opt_fb.h" @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -46,6 +47,8 @@ #include "fbreg.h" +SET_DECLARE(videodriver_set, const video_driver_t); + /* local arrays */ /* @@ -162,8 +165,8 @@ vid_register(video_adapter_t *adp) adp->va_index = index; adp->va_token = NULL; - list = (const video_driver_t **)videodriver_set.ls_items; - while ((p = *list++) != NULL) { + SET_FOREACH(list, videodriver_set) { + p = *list; if (strcmp(p->name, adp->va_name) == 0) { adapter[index] = adp; vidsw[index] = p->vidsw; @@ -194,8 +197,8 @@ video_switch_t const video_driver_t **list; const video_driver_t *p; - list = (const video_driver_t **)videodriver_set.ls_items; - while ((p = *list++) != NULL) { + SET_FOREACH(list, videodriver_set) { + p = *list; if (strcmp(p->name, name) == 0) return p->vidsw; } @@ -283,8 +286,8 @@ vid_configure(int flags) const video_driver_t **list; const video_driver_t *p; - list = (const video_driver_t **)videodriver_set.ls_items; - while ((p = *list++) != NULL) { + SET_FOREACH(list, videodriver_set) { + p = *list; if (p->configure != NULL) (*p->configure)(flags); } diff --git a/sys/dev/video/fb/fbreg.h b/sys/dev/video/fb/fbreg.h index 7ea5294585..8eaa62a931 100644 --- a/sys/dev/video/fb/fbreg.h +++ b/sys/dev/video/fb/fbreg.h @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/dev/fb/fbreg.h,v 1.6 1999/12/29 04:35:36 peter Exp $ - * $DragonFly: src/sys/dev/video/fb/fbreg.h,v 1.4 2003/07/22 17:03:28 dillon Exp $ + * $DragonFly: src/sys/dev/video/fb/fbreg.h,v 1.5 2003/11/10 06:12:09 dillon Exp $ */ #ifndef _DEV_FB_FBREG_H_ @@ -149,7 +149,6 @@ typedef struct video_driver { /* global variables */ extern struct video_switch **vidsw; -extern struct linker_set videodriver_set; /* functions for the video card driver */ int vid_register(video_adapter_t *adp); diff --git a/sys/emulation/linux/i386/linux.h b/sys/emulation/linux/i386/linux.h index b8ed5a61a7..54c3fdcb7d 100644 --- a/sys/emulation/linux/i386/linux.h +++ b/sys/emulation/linux/i386/linux.h @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/linux/linux.h,v 1.41.2.4 2003/01/06 09:19:43 fjoe Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linux.h,v 1.5 2003/08/07 21:17:18 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linux.h,v 1.6 2003/11/10 06:12:11 dillon Exp $ */ #ifndef _I386_LINUX_LINUX_H_ @@ -453,7 +453,6 @@ extern struct sysentvec elf_linux_sysvec; /* * Pluggable ioctl handlers */ -struct linker_set; struct linux_ioctl_args; struct thread; @@ -465,9 +464,7 @@ struct linux_ioctl_handler { }; int linux_ioctl_register_handler(struct linux_ioctl_handler *h); -int linux_ioctl_register_handlers(struct linker_set *s); int linux_ioctl_unregister_handler(struct linux_ioctl_handler *h); -int linux_ioctl_unregister_handlers(struct linker_set *s); /* * open/fcntl flags diff --git a/sys/emulation/linux/i386/linux_sysvec.c b/sys/emulation/linux/i386/linux_sysvec.c index ba049b0b70..7bd5125b50 100644 --- a/sys/emulation/linux/i386/linux_sysvec.c +++ b/sys/emulation/linux/i386/linux_sysvec.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/i386/linux/linux_sysvec.c,v 1.55.2.9 2002/01/12 11:03:30 bde Exp $ - * $DragonFly: src/sys/emulation/linux/i386/linux_sysvec.c,v 1.9 2003/08/27 06:30:03 rob Exp $ + * $DragonFly: src/sys/emulation/linux/i386/linux_sysvec.c,v 1.10 2003/11/10 06:12:11 dillon Exp $ */ /* XXX we use functions that might not exist. */ @@ -84,7 +84,7 @@ extern int linux_szsigcode; extern struct sysent linux_sysent[LINUX_SYS_MAXSYSCALL]; -extern struct linker_set linux_ioctl_handler_set; +SET_DECLARE(linux_ioctl_handler_set, struct linux_ioctl_handler); static int linux_fixup (register_t **stack_base, struct image_params *iparams); @@ -837,6 +837,7 @@ linux_elf_modevent(module_t mod, int type, void *data) { Elf32_Brandinfo **brandinfo; int error; + struct linux_ioctl_handler **lihp; error = 0; @@ -847,8 +848,8 @@ linux_elf_modevent(module_t mod, int type, void *data) if (elf_insert_brand_entry(*brandinfo) < 0) error = EINVAL; if (error == 0) { - linux_ioctl_register_handlers( - &linux_ioctl_handler_set); + SET_FOREACH(lihp, linux_ioctl_handler_set) + linux_ioctl_register_handler(*lihp); if (bootverbose) printf("Linux ELF exec handler installed\n"); } else @@ -866,8 +867,8 @@ linux_elf_modevent(module_t mod, int type, void *data) error = EINVAL; } if (error == 0) { - linux_ioctl_unregister_handlers( - &linux_ioctl_handler_set); + SET_FOREACH(lihp, linux_ioctl_handler_set) + linux_ioctl_unregister_handler(*lihp); if (bootverbose) printf("Linux ELF exec handler removed\n"); } else diff --git a/sys/emulation/linux/linux_ioctl.c b/sys/emulation/linux/linux_ioctl.c index 1fe773a737..552261f066 100644 --- a/sys/emulation/linux/linux_ioctl.c +++ b/sys/emulation/linux/linux_ioctl.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/sys/compat/linux/linux_ioctl.c,v 1.55.2.11 2003/05/01 20:16:09 anholt Exp $ - * $DragonFly: src/sys/emulation/linux/linux_ioctl.c,v 1.9 2003/08/15 06:32:51 dillon Exp $ + * $DragonFly: src/sys/emulation/linux/linux_ioctl.c,v 1.10 2003/11/10 06:12:10 dillon Exp $ */ #include @@ -1895,40 +1895,6 @@ linux_ioctl(struct linux_ioctl_args *args) return (EINVAL); } -int -linux_ioctl_register_handlers(struct linker_set *s) -{ - int error, i; - - if (s == NULL) - return (EINVAL); - - for (i = 0; i < s->ls_length; i++) { - error = linux_ioctl_register_handler(s->ls_items[i]); - if (error) - return (error); - } - - return (0); -} - -int -linux_ioctl_unregister_handlers(struct linker_set *s) -{ - int error, i; - - if (s == NULL) - return (EINVAL); - - for (i = 0; i < s->ls_length; i++) { - error = linux_ioctl_unregister_handler(s->ls_items[i]); - if (error) - return (error); - } - - return (0); -} - int linux_ioctl_register_handler(struct linux_ioctl_handler *h) { diff --git a/sys/i386/include/bootinfo.h b/sys/i386/include/bootinfo.h index b168f71ddd..c1d5b332cc 100644 --- a/sys/i386/include/bootinfo.h +++ b/sys/i386/include/bootinfo.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/bootinfo.h,v 1.14 1999/12/29 04:32:57 peter Exp $ - * $DragonFly: src/sys/i386/include/Attic/bootinfo.h,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/bootinfo.h,v 1.3 2003/11/10 06:12:12 dillon Exp $ */ #ifndef _MACHINE_BOOTINFO_H_ @@ -72,4 +72,49 @@ struct bootinfo { extern struct bootinfo bootinfo; #endif +/* + * Constants for converting boot-style device number to type, + * adaptor (uba, mba, etc), unit number and partition number. + * Type (== major device number) is in the low byte + * for backward compatibility. Except for that of the "magic + * number", each mask applies to the shifted value. + * Format: + * (4) (4) (4) (4) (8) (8) + * -------------------------------- + * |MA | AD| CT| UN| PART | TYPE | + * -------------------------------- + */ +#define B_ADAPTORSHIFT 24 +#define B_ADAPTORMASK 0x0f +#define B_ADAPTOR(val) (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK) +#define B_CONTROLLERSHIFT 20 +#define B_CONTROLLERMASK 0xf +#define B_CONTROLLER(val) (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK) +#define B_SLICESHIFT 20 +#define B_SLICEMASK 0xff +#define B_SLICE(val) (((val)>>B_SLICESHIFT) & B_SLICEMASK) +#define B_UNITSHIFT 16 +#define B_UNITMASK 0xf +#define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK) +#define B_PARTITIONSHIFT 8 +#define B_PARTITIONMASK 0xff +#define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK) +#define B_TYPESHIFT 0 +#define B_TYPEMASK 0xff +#define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK) + +#define B_MAGICMASK 0xf0000000 +#define B_DEVMAGIC 0xa0000000 + +#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \ + (((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \ + ((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \ + ((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC) + +#define BASE_SLICE 2 +#define COMPATIBILITY_SLICE 0 +#define MAX_SLICES 32 +#define WHOLE_DISK_SLICE 1 + #endif /* !_MACHINE_BOOTINFO_H_ */ + diff --git a/sys/i386/include/elf.h b/sys/i386/include/elf.h index a422780911..a94fe93683 100644 --- a/sys/i386/include/elf.h +++ b/sys/i386/include/elf.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/elf.h,v 1.9.2.1 2001/11/03 01:41:08 ps Exp $ - * $DragonFly: src/sys/i386/include/Attic/elf.h,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/i386/include/Attic/elf.h,v 1.3 2003/11/10 06:12:12 dillon Exp $ */ #ifndef _MACHINE_ELF_H_ @@ -35,8 +35,12 @@ */ #include /* Definitions common to all 32 bit architectures. */ +#include /* Definitions common to all 32 bit architectures. */ +#ifndef __ELF_WORD_SIZE #define __ELF_WORD_SIZE 32 /* Used by */ +#endif + #include #define ELF_ARCH EM_386 @@ -59,6 +63,13 @@ typedef struct { /* Auxiliary vector entry on initial stack */ } a_un; } Elf32_Auxinfo; +#if __ELF_WORD_SIZE == 64 +/* Fake for amd64 loader support */ +typedef struct { + int fake; +} Elf64_Auxinfo; +#endif + __ElfType(Auxinfo); /* Values for a_type. */ diff --git a/sys/i386/include/metadata.h b/sys/i386/include/metadata.h new file mode 100644 index 0000000000..b02342a2ec --- /dev/null +++ b/sys/i386/include/metadata.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2003 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/i386/include/metadata.h,v 1.1 2003/05/01 03:31:17 peter Exp $ + * $DragonFly: src/sys/i386/include/Attic/metadata.h,v 1.1 2003/11/10 06:12:12 dillon Exp $ + */ + +#ifndef _MACHINE_METADATA_H_ +#define _MACHINE_METADATA_H_ + +#define MODINFOMD_SMAP 0x1001 + +#endif /* !_MACHINE_METADATA_H_ */ diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 784992a402..c01fea203e 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -40,7 +40,7 @@ * * @(#)init_main.c 8.9 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/init_main.c,v 1.134.2.8 2003/06/06 20:21:32 tegge Exp $ - * $DragonFly: src/sys/kern/init_main.c,v 1.25 2003/09/28 03:44:01 dillon Exp $ + * $DragonFly: src/sys/kern/init_main.c,v 1.26 2003/11/10 06:12:13 dillon Exp $ */ #include "opt_init_path.h" @@ -75,8 +75,6 @@ #include #include -extern struct linker_set sysinit_set; /* XXX */ - void mi_startup(void); /* Should be elsewhere */ /* Components of the first process -- never freed. */ @@ -109,46 +107,45 @@ SYSINIT(placeholder, SI_SUB_DUMMY, SI_ORDER_ANY, NULL, NULL) * The sysinit table itself. Items are checked off as the are run. * If we want to register new sysinit types, add them to newsysinit. */ -struct sysinit **sysinit = (struct sysinit **)sysinit_set.ls_items; -struct sysinit **newsysinit; +SET_DECLARE(sysinit_set, struct sysinit); +struct sysinit **sysinit, **sysinit_end; +struct sysinit **newsysinit, **newsysinit_end; + /* * Merge a new sysinit set into the current set, reallocating it if * necessary. This can only be called after malloc is running. */ void -sysinit_add(struct sysinit **set) +sysinit_add(struct sysinit **set, struct sysinit **set_end) { struct sysinit **newset; struct sysinit **sipp; struct sysinit **xipp; - int count = 0; + int count; + count = set_end - set; if (newsysinit) - for (sipp = newsysinit; *sipp; sipp++) - count++; + count += newsysinit_end - newsysinit; else - for (sipp = sysinit; *sipp; sipp++) - count++; - for (sipp = set; *sipp; sipp++) - count++; - count++; /* Trailing NULL */ + count += sysinit_end - sysinit; newset = malloc(count * sizeof(*sipp), M_TEMP, M_NOWAIT); if (newset == NULL) panic("cannot malloc for sysinit"); xipp = newset; - if (newsysinit) - for (sipp = newsysinit; *sipp; sipp++) + if (newsysinit) { + for (sipp = newsysinit; sipp < newsysinit_end; sipp++) *xipp++ = *sipp; - else - for (sipp = sysinit; *sipp; sipp++) + } else { + for (sipp = sysinit; sipp < sysinit_end; sipp++) *xipp++ = *sipp; - for (sipp = set; *sipp; sipp++) + } + for (sipp = set; sipp < set_end; sipp++) *xipp++ = *sipp; - *xipp = NULL; if (newsysinit) free(newsysinit, M_TEMP); newsysinit = newset; + newsysinit_end = newset + count; } /* @@ -170,13 +167,18 @@ mi_startup(void) struct sysinit **xipp; /* interior loop of sort*/ struct sysinit *save; /* bubble*/ + if (sysinit == NULL) { + sysinit = SET_BEGIN(sysinit_set); + sysinit_end = SET_LIMIT(sysinit_set); + } + restart: /* * Perform a bubble sort of the system initialization objects by * their subsystem (primary key) and order (secondary key). */ - for (sipp = sysinit; *sipp; sipp++) { - for (xipp = sipp + 1; *xipp; xipp++) { + for (sipp = sysinit; sipp < sysinit_end; sipp++) { + for (xipp = sipp + 1; xipp < sysinit_end; xipp++) { if ((*sipp)->subsystem < (*xipp)->subsystem || ((*sipp)->subsystem == (*xipp)->subsystem && (*sipp)->order <= (*xipp)->order)) @@ -194,7 +196,8 @@ restart: * The last item on the list is expected to be the scheduler, * which will not return. */ - for (sipp = sysinit; (sip = *sipp) != NULL; sipp++) { + for (sipp = sysinit; sipp < sysinit_end; sipp++) { + sip = *sipp; if (sip->subsystem == SI_SUB_DUMMY) continue; /* skip dummy task(s)*/ @@ -209,10 +212,12 @@ restart: /* Check if we've installed more sysinit items via KLD */ if (newsysinit != NULL) { - if (sysinit != (struct sysinit **)sysinit_set.ls_items) + if (sysinit != SET_BEGIN(sysinit_set)) free(sysinit, M_TEMP); sysinit = newsysinit; + sysinit_end = newsysinit_end; newsysinit = NULL; + newsysinit_end = NULL; goto restart; } } diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c index dd76992b08..c4e9e46363 100644 --- a/sys/kern/kern_linker.c +++ b/sys/kern/kern_linker.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/kern_linker.c,v 1.41.2.3 2001/11/21 17:50:35 luigi Exp $ - * $DragonFly: src/sys/kern/kern_linker.c,v 1.12 2003/10/13 04:16:51 hmp Exp $ + * $DragonFly: src/sys/kern/kern_linker.c,v 1.13 2003/11/10 06:12:13 dillon Exp $ */ #include "opt_ddb.h" @@ -92,7 +92,7 @@ linker_add_class(const char* desc, void* priv, static int linker_file_sysinit(linker_file_t lf) { - struct linker_set* sysinits; + struct sysinit** start, ** stop; struct sysinit** sipp; struct sysinit** xipp; struct sysinit* save; @@ -102,16 +102,11 @@ linker_file_sysinit(linker_file_t lf) KLD_DPF(FILE, ("linker_file_sysinit: calling SYSINITs for %s\n", lf->filename)); - if (linker_file_lookup_symbol(lf, "sysinit_set", 0, (caddr_t *)&sysinits)) { - KLD_DPF(FILE, ("linker_file_sysinit: SYSINITs not found\n")); - return 0; /* XXX is this correct ? No sysinit ? */ - } - KLD_DPF(FILE, ("linker_file_sysinit: SYSINITs %p\n", sysinits)); - if (sysinits == NULL) + if (linker_file_lookup_set(lf, "sysinit_set", &start, &stop, NULL) != 0) return 0; /* XXX is this correct ? No sysinit ? */ /* HACK ALERT! */ - for (sipp = (struct sysinit **)sysinits->ls_items; *sipp; sipp++) { + for (sipp = start; sipp < stop; sipp++) { if ((*sipp)->func == module_register_init) { moddata = (*sipp)->udata; error = module_register(moddata, lf); @@ -130,8 +125,8 @@ linker_file_sysinit(linker_file_t lf) * Since some things care about execution order, this is the * operation which ensures continued function. */ - for (sipp = (struct sysinit **)sysinits->ls_items; *sipp; sipp++) { - for (xipp = sipp + 1; *xipp; xipp++) { + for (sipp = start; sipp < stop; sipp++) { + for (xipp = sipp + 1; xipp < stop; xipp++) { if ((*sipp)->subsystem < (*xipp)->subsystem || ((*sipp)->subsystem == (*xipp)->subsystem && (*sipp)->order <= (*xipp)->order)) @@ -147,7 +142,7 @@ linker_file_sysinit(linker_file_t lf) * Traverse the (now) ordered list of system initialization tasks. * Perform each task, and continue on to the next task. */ - for (sipp = (struct sysinit **)sysinits->ls_items; *sipp; sipp++) { + for (sipp = start; sipp < stop; sipp++) { if ((*sipp)->subsystem == SI_SUB_DUMMY) continue; /* skip dummy task(s)*/ @@ -160,7 +155,7 @@ linker_file_sysinit(linker_file_t lf) static void linker_file_sysuninit(linker_file_t lf) { - struct linker_set* sysuninits; + struct sysinit** start, ** stop; struct sysinit** sipp; struct sysinit** xipp; struct sysinit* save; @@ -168,12 +163,7 @@ linker_file_sysuninit(linker_file_t lf) KLD_DPF(FILE, ("linker_file_sysuninit: calling SYSUNINITs for %s\n", lf->filename)); - if (linker_file_lookup_symbol(lf, "sysuninit_set", 0, (caddr_t *)&sysuninits)) { - KLD_DPF(FILE, ("linker_file_sysuninit: SYSUNINITs not found\n")); - return; - } - KLD_DPF(FILE, ("linker_file_sysuninit: SYSUNINITs %p\n", sysuninits)); - if (sysuninits == NULL) + if (linker_file_lookup_set(lf, "sysuninit_set", &start, &stop, NULL) != 0) return; /* @@ -183,8 +173,8 @@ linker_file_sysuninit(linker_file_t lf) * Since some things care about execution order, this is the * operation which ensures continued function. */ - for (sipp = (struct sysinit **)sysuninits->ls_items; *sipp; sipp++) { - for (xipp = sipp + 1; *xipp; xipp++) { + for (sipp = start; sipp < stop; sipp++) { + for (xipp = sipp + 1; xipp < stop; xipp++) { if ((*sipp)->subsystem > (*xipp)->subsystem || ((*sipp)->subsystem == (*xipp)->subsystem && (*sipp)->order >= (*xipp)->order)) @@ -200,7 +190,7 @@ linker_file_sysuninit(linker_file_t lf) * Traverse the (now) ordered list of system initialization tasks. * Perform each task, and continue on to the next task. */ - for (sipp = (struct sysinit **)sysuninits->ls_items; *sipp; sipp++) { + for (sipp = start; sipp < stop; sipp++) { if ((*sipp)->subsystem == SI_SUB_DUMMY) continue; /* skip dummy task(s)*/ @@ -212,39 +202,29 @@ linker_file_sysuninit(linker_file_t lf) static void linker_file_register_sysctls(linker_file_t lf) { - struct linker_set* sysctls; + struct sysctl_oid **start, **stop, **oidp; KLD_DPF(FILE, ("linker_file_register_sysctls: registering SYSCTLs for %s\n", lf->filename)); - if (linker_file_lookup_symbol(lf, "sysctl_set", 0, (caddr_t *)&sysctls)) { - KLD_DPF(FILE, ("linker_file_register_sysctls: SYSCTLs not found\n")); + if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0) return; - } - KLD_DPF(FILE, ("linker_file_register_sysctls: SYSCTLs %p\n", sysctls)); - if (sysctls == NULL) - return; - - sysctl_register_set(sysctls); + for (oidp = start; oidp < stop; oidp++) + sysctl_register_oid(*oidp); } static void linker_file_unregister_sysctls(linker_file_t lf) { - struct linker_set* sysctls; + struct sysctl_oid **start, **stop, **oidp; KLD_DPF(FILE, ("linker_file_unregister_sysctls: registering SYSCTLs for %s\n", lf->filename)); - if (linker_file_lookup_symbol(lf, "sysctl_set", 0, (caddr_t *)&sysctls)) { - KLD_DPF(FILE, ("linker_file_unregister_sysctls: SYSCTLs not found\n")); - return; - } - KLD_DPF(FILE, ("linker_file_unregister_sysctls: SYSCTLs %p\n", sysctls)); - if (sysctls == NULL) + if (linker_file_lookup_set(lf, "sysctl_set", &start, &stop, NULL) != 0) return; - - sysctl_unregister_set(sysctls); + for (oidp = start; oidp < stop; oidp++) + sysctl_unregister_oid(*oidp); } int @@ -491,6 +471,18 @@ linker_file_add_dependancy(linker_file_t file, linker_file_t dep) return 0; } +/* + * Locate a linker set and its contents. + * This is a helper function to avoid linker_if.h exposure elsewhere. + * Note: firstp and lastp are really void *** + */ +int +linker_file_lookup_set(linker_file_t file, const char *name, + void *firstp, void *lastp, int *countp) +{ + return file->ops->lookup_set(file, name, firstp, lastp, countp); +} + int linker_file_lookup_symbol(linker_file_t file, const char* name, int deps, caddr_t *raddr) { @@ -926,9 +918,9 @@ linker_preload(void* arg) linker_file_t lf; linker_class_t lc; int error; - struct linker_set *sysinits; struct sysinit **sipp; const moduledata_t *moddata; + struct sysinit **si_start, **si_stop; modptr = NULL; while ((modptr = preload_search_next_name(modptr)) != NULL) { @@ -959,13 +951,13 @@ linker_preload(void* arg) if (lf) { lf->userrefs++; - if (linker_file_lookup_symbol(lf, "sysinit_set", 0, (caddr_t *)&sysinits) == 0 && sysinits) { + if (linker_file_lookup_set(lf, "sysinit_set", &si_start, &si_stop, NULL) == 0) { /* HACK ALERT! * This is to set the sysinit moduledata so that the module * can attach itself to the correct containing file. * The sysinit could be run at *any* time. */ - for (sipp = (struct sysinit **)sysinits->ls_items; *sipp; sipp++) { + for (sipp = si_start; sipp < si_stop; sipp++) { if ((*sipp)->func == module_register_init) { moddata = (*sipp)->udata; error = module_register(moddata, lf); @@ -974,7 +966,7 @@ linker_preload(void* arg) modtype, modname, error); } } - sysinit_add((struct sysinit **)sysinits->ls_items); + sysinit_add(si_start, si_stop); } linker_file_register_sysctls(lf); } diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 826907ed87..ae81155ace 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -38,7 +38,7 @@ * * @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94 * $FreeBSD: src/sys/kern/kern_sysctl.c,v 1.92.2.9 2003/05/01 22:48:09 trhodes Exp $ - * $DragonFly: src/sys/kern/kern_sysctl.c,v 1.11 2003/07/30 00:19:14 dillon Exp $ + * $DragonFly: src/sys/kern/kern_sysctl.c,v 1.12 2003/11/10 06:12:13 dillon Exp $ */ #include "opt_compat.h" @@ -399,34 +399,17 @@ sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, return (oidp); } -/* - * Bulk-register all the oids in a linker_set. - */ -void sysctl_register_set(struct linker_set *lsp) -{ - int count = lsp->ls_length; - int i; - for (i = 0; i < count; i++) - sysctl_register_oid((struct sysctl_oid *) lsp->ls_items[i]); -} - -void sysctl_unregister_set(struct linker_set *lsp) -{ - int count = lsp->ls_length; - int i; - for (i = 0; i < count; i++) - sysctl_unregister_oid((struct sysctl_oid *) lsp->ls_items[i]); -} - /* * Register the kernel's oids on startup. */ -extern struct linker_set sysctl_set; +SET_DECLARE(sysctl_set, struct sysctl_oid); static void sysctl_register_all(void *arg) { + struct sysctl_oid **oidp; - sysctl_register_set(&sysctl_set); + SET_FOREACH(oidp, sysctl_set) + sysctl_register_oid(*oidp); } SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_ANY, sysctl_register_all, 0); diff --git a/sys/kern/link_aout.c b/sys/kern/link_aout.c index da040864c3..71c6ebaaec 100644 --- a/sys/kern/link_aout.c +++ b/sys/kern/link_aout.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/link_aout.c,v 1.26 1999/12/24 15:33:36 bde Exp $ - * $DragonFly: src/sys/kern/link_aout.c,v 1.7 2003/09/23 05:03:51 dillon Exp $ + * $DragonFly: src/sys/kern/link_aout.c,v 1.8 2003/11/10 06:12:13 dillon Exp $ */ #ifndef __alpha__ @@ -69,6 +69,8 @@ static int link_aout_search_symbol(linker_file_t lf, caddr_t value, c_linker_sym_t* sym, long* diffp); static void link_aout_unload_file(linker_file_t); static void link_aout_unload_module(linker_file_t); +static int link_aout_lookup_set(linker_file_t lf, const char *name, + void ***startp, void ***stopp, int *countp); static struct linker_class_ops link_aout_class_ops = { link_aout_load_module, @@ -79,12 +81,14 @@ static struct linker_file_ops link_aout_file_ops = { link_aout_symbol_values, link_aout_search_symbol, link_aout_unload_file, + link_aout_lookup_set }; static struct linker_file_ops link_aout_module_ops = { link_aout_lookup_symbol, link_aout_symbol_values, link_aout_search_symbol, link_aout_unload_module, + link_aout_lookup_set }; typedef struct aout_file { @@ -603,4 +607,43 @@ link_aout_search_symbol(linker_file_t lf, caddr_t value, return 0; } +/* + * Look up a linker set on an a.out + gnu LD system. + */ + +struct generic_linker_set { + int ls_length; + void *ls_items[1]; +}; + +static int +link_aout_lookup_set(linker_file_t lf, const char *name, + void ***startp, void ***stopp, int *countp) +{ + c_linker_sym_t sym; + linker_symval_t symval; + void **start, **stop; + int error, count; + struct generic_linker_set *setp; + + error = link_aout_lookup_symbol(lf, name, &sym); + if (error) + return error; + link_aout_symbol_values(lf, sym, &symval); + if (symval.value == 0) + return ESRCH; + setp = (struct generic_linker_set *)symval.value; + count = setp->ls_length; + start = &setp->ls_items[0]; + stop = &setp->ls_items[count]; + if (startp) + *startp = start; + if (stopp) + *stopp = stop; + if (countp) + *countp = count; + return 0; +} + #endif /* !__alpha__ */ + diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c index 94e1aada13..e95cb8f8fe 100644 --- a/sys/kern/link_elf.c +++ b/sys/kern/link_elf.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/kern/link_elf.c,v 1.24 1999/12/24 15:33:36 bde Exp $ - * $DragonFly: src/sys/kern/link_elf.c,v 1.7 2003/10/02 21:00:20 hmp Exp $ + * $DragonFly: src/sys/kern/link_elf.c,v 1.8 2003/11/10 06:12:13 dillon Exp $ */ #include @@ -60,6 +60,9 @@ static int link_elf_search_symbol(linker_file_t, caddr_t value, static void link_elf_unload_file(linker_file_t); static void link_elf_unload_module(linker_file_t); +static int link_elf_lookup_set(linker_file_t, const char *, + void ***, void ***, int *); + static struct linker_class_ops link_elf_class_ops = { link_elf_load_module, @@ -70,6 +73,7 @@ static struct linker_file_ops link_elf_file_ops = { link_elf_symbol_values, link_elf_search_symbol, link_elf_unload_file, + link_elf_lookup_set }; static struct linker_file_ops link_elf_module_ops = { @@ -77,6 +81,7 @@ static struct linker_file_ops link_elf_module_ops = { link_elf_symbol_values, link_elf_search_symbol, link_elf_unload_module, + link_elf_lookup_set }; typedef struct elf_file { caddr_t address; /* Relocation address */ @@ -987,3 +992,62 @@ link_elf_search_symbol(linker_file_t lf, caddr_t value, return 0; } + +/* + * Look up a linker set on an ELF system. + */ +static int +link_elf_lookup_set(linker_file_t lf, const char *name, + void ***startp, void ***stopp, int *countp) +{ + c_linker_sym_t sym; + linker_symval_t symval; + char *setsym; + void **start, **stop; + int len, error = 0, count; + + len = strlen(name) + sizeof("__start_set_"); /* sizeof includes \0 */ + setsym = malloc(len, M_LINKER, M_WAITOK); + if (setsym == NULL) + return ENOMEM; + + /* get address of first entry */ + snprintf(setsym, len, "%s%s", "__start_set_", name); + error = link_elf_lookup_symbol(lf, setsym, &sym); + if (error) + goto out; + link_elf_symbol_values(lf, sym, &symval); + if (symval.value == 0) { + error = ESRCH; + goto out; + } + start = (void **)symval.value; + + /* get address of last entry */ + snprintf(setsym, len, "%s%s", "__stop_set_", name); + error = link_elf_lookup_symbol(lf, setsym, &sym); + if (error) + goto out; + link_elf_symbol_values(lf, sym, &symval); + if (symval.value == 0) { + error = ESRCH; + goto out; + } + stop = (void **)symval.value; + + /* and the number of entries */ + count = stop - start; + + /* and copy out */ + if (startp) + *startp = start; + if (stopp) + *stopp = stop; + if (countp) + *countp = count; + + out: + free(setsym, M_LINKER); + return error; +} + diff --git a/sys/kern/subr_diskmbr.c b/sys/kern/subr_diskmbr.c index e43942d0a8..e5e99e6fbd 100644 --- a/sys/kern/subr_diskmbr.c +++ b/sys/kern/subr_diskmbr.c @@ -36,7 +36,7 @@ * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ * $FreeBSD: src/sys/kern/subr_diskmbr.c,v 1.45 2000/01/28 10:22:07 bde Exp $ - * $DragonFly: src/sys/kern/subr_diskmbr.c,v 1.4 2003/08/26 21:09:02 rob Exp $ + * $DragonFly: src/sys/kern/subr_diskmbr.c,v 1.5 2003/11/10 06:12:13 dillon Exp $ */ #include @@ -52,6 +52,7 @@ #define DOSPTYP_EXTENDEDX 15 #define DOSPTYP_ONTRACK 84 #include +#include #include #include #include diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c index 82430c2cb3..330732e535 100644 --- a/sys/kern/subr_diskslice.c +++ b/sys/kern/subr_diskslice.c @@ -44,7 +44,7 @@ * from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91 * from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $ * $FreeBSD: src/sys/kern/subr_diskslice.c,v 1.82.2.6 2001/07/24 09:49:41 dd Exp $ - * $DragonFly: src/sys/kern/subr_diskslice.c,v 1.6 2003/08/26 21:09:02 rob Exp $ + * $DragonFly: src/sys/kern/subr_diskslice.c,v 1.7 2003/11/10 06:12:13 dillon Exp $ */ #include @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index b26c67d8a5..e3e3ab9be5 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -37,7 +37,7 @@ * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 * $FreeBSD: src/sys/kern/tty_cons.c,v 1.81.2.4 2001/12/17 18:44:41 guido Exp $ - * $DragonFly: src/sys/kern/tty_cons.c,v 1.7 2003/07/26 19:42:11 rob Exp $ + * $DragonFly: src/sys/kern/tty_cons.c,v 1.8 2003/11/10 06:12:13 dillon Exp $ */ #include "opt_ddb.h" @@ -116,6 +116,7 @@ static struct lwkt_port cn_port; CONS_DRIVER(cons, NULL, NULL, NULL, NULL, NULL, NULL, NULL); +SET_DECLARE(cons_set, struct consdev); void cninit() @@ -132,8 +133,8 @@ cninit() * Find the first console with the highest priority. */ best_cp = NULL; - list = (struct consdev **)cons_set.ls_items; - while ((cp = *list++) != NULL) { + SET_FOREACH(list, cons_set) { + cp = *list; if (cp->cn_probe == NULL) continue; (*cp->cn_probe)(cp); diff --git a/sys/netproto/ncp/ncp_conn.c b/sys/netproto/ncp/ncp_conn.c index 35fb4ea488..6614e56c0e 100644 --- a/sys/netproto/ncp/ncp_conn.c +++ b/sys/netproto/ncp/ncp_conn.c @@ -29,7 +29,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * $FreeBSD: src/sys/netncp/ncp_conn.c,v 1.3.2.5 2001/02/22 08:54:11 bp Exp $ - * $DragonFly: src/sys/netproto/ncp/ncp_conn.c,v 1.5 2003/08/07 21:17:38 dillon Exp $ + * $DragonFly: src/sys/netproto/ncp/ncp_conn.c,v 1.6 2003/11/10 06:12:14 dillon Exp $ * * Connection tables */ @@ -62,8 +62,6 @@ static int ncp_sysctl_connstat(SYSCTL_HANDLER_ARGS); static int ncp_conn_lock_any(struct ncp_conn *conn, struct thread *td, struct ucred *cred); -extern struct linker_set sysctl_net_ncp; - SYSCTL_DECL(_net_ncp); SYSCTL_INT (_net_ncp, OID_AUTO, burst_enabled, CTLFLAG_RD, &ncp_burst_enabled, 0, ""); SYSCTL_INT (_net_ncp, OID_AUTO, conn_cnt, CTLFLAG_RD, &ncp_conn_cnt, 0, ""); diff --git a/sys/netproto/smb/smb_conn.c b/sys/netproto/smb/smb_conn.c index d88fc42695..ff1e81a862 100644 --- a/sys/netproto/smb/smb_conn.c +++ b/sys/netproto/smb/smb_conn.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/netsmb/smb_conn.c,v 1.1.2.1 2001/05/22 08:32:33 bp Exp $ - * $DragonFly: src/sys/netproto/smb/smb_conn.c,v 1.5 2003/08/07 21:17:38 dillon Exp $ + * $DragonFly: src/sys/netproto/smb/smb_conn.c,v 1.6 2003/11/10 06:12:16 dillon Exp $ */ /* @@ -57,8 +57,6 @@ static struct smb_connobj smb_vclist; static int smb_vcnext = 1; /* next unique id for VC */ -extern struct linker_set sysctl_net_smb; - SYSCTL_NODE(_net, OID_AUTO, smb, CTLFLAG_RW, NULL, "SMB protocol"); MALLOC_DEFINE(M_SMBCONN, "SMB conn", "SMB connection"); diff --git a/sys/platform/pc32/include/bootinfo.h b/sys/platform/pc32/include/bootinfo.h index 749c94948c..53090799a7 100644 --- a/sys/platform/pc32/include/bootinfo.h +++ b/sys/platform/pc32/include/bootinfo.h @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/i386/include/bootinfo.h,v 1.14 1999/12/29 04:32:57 peter Exp $ - * $DragonFly: src/sys/platform/pc32/include/bootinfo.h,v 1.2 2003/06/17 04:28:35 dillon Exp $ + * $DragonFly: src/sys/platform/pc32/include/bootinfo.h,v 1.3 2003/11/10 06:12:12 dillon Exp $ */ #ifndef _MACHINE_BOOTINFO_H_ @@ -72,4 +72,49 @@ struct bootinfo { extern struct bootinfo bootinfo; #endif +/* + * Constants for converting boot-style device number to type, + * adaptor (uba, mba, etc), unit number and partition number. + * Type (== major device number) is in the low byte + * for backward compatibility. Except for that of the "magic + * number", each mask applies to the shifted value. + * Format: + * (4) (4) (4) (4) (8) (8) + * -------------------------------- + * |MA | AD| CT| UN| PART | TYPE | + * -------------------------------- + */ +#define B_ADAPTORSHIFT 24 +#define B_ADAPTORMASK 0x0f +#define B_ADAPTOR(val) (((val) >> B_ADAPTORSHIFT) & B_ADAPTORMASK) +#define B_CONTROLLERSHIFT 20 +#define B_CONTROLLERMASK 0xf +#define B_CONTROLLER(val) (((val)>>B_CONTROLLERSHIFT) & B_CONTROLLERMASK) +#define B_SLICESHIFT 20 +#define B_SLICEMASK 0xff +#define B_SLICE(val) (((val)>>B_SLICESHIFT) & B_SLICEMASK) +#define B_UNITSHIFT 16 +#define B_UNITMASK 0xf +#define B_UNIT(val) (((val) >> B_UNITSHIFT) & B_UNITMASK) +#define B_PARTITIONSHIFT 8 +#define B_PARTITIONMASK 0xff +#define B_PARTITION(val) (((val) >> B_PARTITIONSHIFT) & B_PARTITIONMASK) +#define B_TYPESHIFT 0 +#define B_TYPEMASK 0xff +#define B_TYPE(val) (((val) >> B_TYPESHIFT) & B_TYPEMASK) + +#define B_MAGICMASK 0xf0000000 +#define B_DEVMAGIC 0xa0000000 + +#define MAKEBOOTDEV(type, adaptor, controller, unit, partition) \ + (((type) << B_TYPESHIFT) | ((adaptor) << B_ADAPTORSHIFT) | \ + ((controller) << B_CONTROLLERSHIFT) | ((unit) << B_UNITSHIFT) | \ + ((partition) << B_PARTITIONSHIFT) | B_DEVMAGIC) + +#define BASE_SLICE 2 +#define COMPATIBILITY_SLICE 0 +#define MAX_SLICES 32 +#define WHOLE_DISK_SLICE 1 + #endif /* !_MACHINE_BOOTINFO_H_ */ + diff --git a/sys/platform/pc32/include/metadata.h b/sys/platform/pc32/include/metadata.h new file mode 100644 index 0000000000..f54ddb7a46 --- /dev/null +++ b/sys/platform/pc32/include/metadata.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2003 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/sys/i386/include/metadata.h,v 1.1 2003/05/01 03:31:17 peter Exp $ + * $DragonFly: src/sys/platform/pc32/include/metadata.h,v 1.1 2003/11/10 06:12:12 dillon Exp $ + */ + +#ifndef _MACHINE_METADATA_H_ +#define _MACHINE_METADATA_H_ + +#define MODINFOMD_SMAP 0x1001 + +#endif /* !_MACHINE_METADATA_H_ */ diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index f12f30d023..3c55342829 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -35,7 +35,7 @@ * * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 * $FreeBSD: src/sys/sys/cdefs.h,v 1.28.2.8 2002/09/18 04:05:13 mikeh Exp $ - * $DragonFly: src/sys/sys/cdefs.h,v 1.5 2003/08/27 17:13:22 hmp Exp $ + * $DragonFly: src/sys/sys/cdefs.h,v 1.6 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_CDEFS_H_ @@ -49,6 +49,17 @@ #define __END_DECLS #endif +/* + * Macro to test if we are using a specific version of gcc or later. + */ +#ifdef __GNUC__ +#define __GNUC_PREREQ__(ma, mi) \ + (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) +#else +#define __GNUC_PREREQ__(ma, mi) \ + 0 +#endif + /* * The VM_CACHELINE_SIZE macro defines the common cache line alignment * size that can be found across most recent and somewhat latest Intel @@ -127,22 +138,59 @@ * properly (old versions of gcc-2 supported the dead and pure features * in a different (wrong) way). */ -#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 5 +#ifdef lint + +#define __dead2 +#define __pure2 +#define __unused +#define __packed +#define __aligned(x) +#define __section(x) +#define __always_inline +#define __nonnull(x) + +#else + +#if !__GNUC_PREREQ__(2, 5) #define __dead2 #define __pure2 #define __unused #endif + #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused #endif -#if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ == 3 + +#if __GNUC_PREREQ__(2, 7) #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused __attribute__((__unused__)) +#define __packed __attribute__((__packed__)) +#define __aligned(x) __attribute__((__aligned__(x))) +#define __section(x) __attribute__((__section__(x))) +#endif + +#if __GNUC_PREREQ__(3, 1) +#define __always_inline __attribute__((__always_inline__)) +#else +#define __always_inline +#endif + +#if __GNUC_PREREQ__(3, 3) +#define __nonnull(x) __attribute__((__nonnull__(x))) +#else +#define __nonnull(x) +#endif + +/* XXX: should use `#if __STDC_VERSION__ < 199901'. */ +#if !__GNUC_PREREQ__(2, 7) +#define __func__ NULL #endif +#endif /* LINT */ + /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ #if !(__GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3) #define __func__ NULL diff --git a/sys/sys/cons.h b/sys/sys/cons.h index f74fa410d5..cae1deb4c4 100644 --- a/sys/sys/cons.h +++ b/sys/sys/cons.h @@ -37,7 +37,7 @@ * * from: @(#)cons.h 7.2 (Berkeley) 5/9/91 * $FreeBSD: src/sys/sys/cons.h,v 1.24 2000/01/11 14:54:01 yokota Exp $ - * $DragonFly: src/sys/sys/cons.h,v 1.3 2003/08/20 07:31:21 rob Exp $ + * $DragonFly: src/sys/sys/cons.h,v 1.4 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _MACHINE_CONS_H_ @@ -79,7 +79,6 @@ struct consdev { #define CN_REMOTE 3 /* serial interface with remote bit set */ #ifdef _KERNEL -extern struct linker_set cons_set; extern int cons_unavail; extern struct consdev *cn_tab; diff --git a/sys/sys/disklabel.h b/sys/sys/disklabel.h index 3d02ae9985..9a08a9648e 100644 --- a/sys/sys/disklabel.h +++ b/sys/sys/disklabel.h @@ -32,7 +32,7 @@ * * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 * $FreeBSD: src/sys/sys/disklabel.h,v 1.49.2.7 2001/05/27 05:58:26 jkh Exp $ - * $DragonFly: src/sys/sys/disklabel.h,v 1.3 2003/08/20 07:31:21 rob Exp $ + * $DragonFly: src/sys/sys/disklabel.h,v 1.4 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_DISKLABEL_H_ @@ -343,61 +343,6 @@ struct partinfo { struct partition *part; }; -/* DOS partition table -- located in boot block */ - -#if defined(PC98) && !defined(PC98_ATCOMPAT) -#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ -#define DOSLABELSECTOR 1 /* 0: 256b/s, 1: 512b/s */ -#define DOSPARTOFF 0 -#define NDOSPART 16 -#define DOSPTYP_386BSD 0x94 /* 386BSD partition type */ -#define MBR_PTYPE_FreeBSD 0x94 /* FreeBSD partition type */ - -struct dos_partition { - unsigned char dp_mid; -#define DOSMID_386BSD (0x14|0x80) /* 386bsd|bootable */ - unsigned char dp_sid; -#define DOSSID_386BSD (0x44|0x80) /* 386bsd|active */ - unsigned char dp_dum1; - unsigned char dp_dum2; - unsigned char dp_ipl_sct; - unsigned char dp_ipl_head; - unsigned short dp_ipl_cyl; - unsigned char dp_ssect; /* starting sector */ - unsigned char dp_shd; /* starting head */ - unsigned short dp_scyl; /* starting cylinder */ - unsigned char dp_esect; /* end sector */ - unsigned char dp_ehd; /* end head */ - unsigned short dp_ecyl; /* end cylinder */ - unsigned char dp_name[16]; -}; - -#else /* IBMPC */ -#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ -#define DOSPARTOFF 446 -#define NDOSPART 4 -#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ -#define DOSPTYP_LINSWP 0x82 /* Linux swap partition */ -#define DOSPTYP_LINUX 0x83 /* Linux partition */ -#define DOSPTYP_EXT 5 /* DOS extended partition */ - -struct dos_partition { - unsigned char dp_flag; /* bootstrap flags */ - unsigned char dp_shd; /* starting head */ - unsigned char dp_ssect; /* starting sector */ - unsigned char dp_scyl; /* starting cylinder */ - unsigned char dp_typ; /* partition type */ - unsigned char dp_ehd; /* end head */ - unsigned char dp_esect; /* end sector */ - unsigned char dp_ecyl; /* end cylinder */ - u_int32_t dp_start; /* absolute starting sector number */ - u_int32_t dp_size; /* partition size in sectors */ -}; -#endif - -#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ -#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ - /* * Disk-specific ioctls. */ diff --git a/sys/sys/disklabel32.h b/sys/sys/disklabel32.h index 19c7229969..da6127b7a5 100644 --- a/sys/sys/disklabel32.h +++ b/sys/sys/disklabel32.h @@ -32,7 +32,7 @@ * * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 * $FreeBSD: src/sys/sys/disklabel.h,v 1.49.2.7 2001/05/27 05:58:26 jkh Exp $ - * $DragonFly: src/sys/sys/disklabel32.h,v 1.3 2003/08/20 07:31:21 rob Exp $ + * $DragonFly: src/sys/sys/disklabel32.h,v 1.4 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_DISKLABEL_H_ @@ -343,61 +343,6 @@ struct partinfo { struct partition *part; }; -/* DOS partition table -- located in boot block */ - -#if defined(PC98) && !defined(PC98_ATCOMPAT) -#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ -#define DOSLABELSECTOR 1 /* 0: 256b/s, 1: 512b/s */ -#define DOSPARTOFF 0 -#define NDOSPART 16 -#define DOSPTYP_386BSD 0x94 /* 386BSD partition type */ -#define MBR_PTYPE_FreeBSD 0x94 /* FreeBSD partition type */ - -struct dos_partition { - unsigned char dp_mid; -#define DOSMID_386BSD (0x14|0x80) /* 386bsd|bootable */ - unsigned char dp_sid; -#define DOSSID_386BSD (0x44|0x80) /* 386bsd|active */ - unsigned char dp_dum1; - unsigned char dp_dum2; - unsigned char dp_ipl_sct; - unsigned char dp_ipl_head; - unsigned short dp_ipl_cyl; - unsigned char dp_ssect; /* starting sector */ - unsigned char dp_shd; /* starting head */ - unsigned short dp_scyl; /* starting cylinder */ - unsigned char dp_esect; /* end sector */ - unsigned char dp_ehd; /* end head */ - unsigned short dp_ecyl; /* end cylinder */ - unsigned char dp_name[16]; -}; - -#else /* IBMPC */ -#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ -#define DOSPARTOFF 446 -#define NDOSPART 4 -#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ -#define DOSPTYP_LINSWP 0x82 /* Linux swap partition */ -#define DOSPTYP_LINUX 0x83 /* Linux partition */ -#define DOSPTYP_EXT 5 /* DOS extended partition */ - -struct dos_partition { - unsigned char dp_flag; /* bootstrap flags */ - unsigned char dp_shd; /* starting head */ - unsigned char dp_ssect; /* starting sector */ - unsigned char dp_scyl; /* starting cylinder */ - unsigned char dp_typ; /* partition type */ - unsigned char dp_ehd; /* end head */ - unsigned char dp_esect; /* end sector */ - unsigned char dp_ecyl; /* end cylinder */ - u_int32_t dp_start; /* absolute starting sector number */ - u_int32_t dp_size; /* partition size in sectors */ -}; -#endif - -#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ -#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ - /* * Disk-specific ioctls. */ diff --git a/sys/sys/diskmbr.h b/sys/sys/diskmbr.h new file mode 100644 index 0000000000..57204bf700 --- /dev/null +++ b/sys/sys/diskmbr.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 1987, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 + * $FreeBSD$ + * $DragonFly: src/sys/sys/diskmbr.h,v 1.1 2003/11/10 06:12:17 dillon Exp $ + */ + +#ifndef _SYS_DISKMBR_H_ +#define _SYS_DISKMBR_H_ + +#include + +#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ +#define DOSPARTOFF 446 +#define DOSPARTSIZE 16 +#define NDOSPART 4 +#define NEXTDOSPART 32 +#define DOSMAGICOFFSET 510 +#define DOSMAGIC 0xAA55 + +#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ +#define DOSPTYP_LINSWP 0x82 /* Linux swap partition */ +#define DOSPTYP_LINUX 0x83 /* Linux partition */ +#define DOSPTYP_PMBR 0xee /* GPT Protective MBR */ +#define DOSPTYP_EXT 5 /* DOS extended partition */ +#define DOSPTYP_EXTLBA 15 /* DOS extended partition */ + +struct dos_partition { + unsigned char dp_flag; /* bootstrap flags */ + unsigned char dp_shd; /* starting head */ + unsigned char dp_ssect; /* starting sector */ + unsigned char dp_scyl; /* starting cylinder */ + unsigned char dp_typ; /* partition type */ + unsigned char dp_ehd; /* end head */ + unsigned char dp_esect; /* end sector */ + unsigned char dp_ecyl; /* end cylinder */ + u_int32_t dp_start; /* absolute starting sector number */ + u_int32_t dp_size; /* partition size in sectors */ +}; +#ifdef CTASSERT +CTASSERT(sizeof (struct dos_partition) == DOSPARTSIZE); +#endif + +void dos_partition_dec(void const *pp, struct dos_partition *d); +void dos_partition_enc(void *pp, struct dos_partition *d); + +#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ +#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ + +#define DIOCSMBR _IOW('M', 129, u_char[512]) + +#endif /* !_SYS_DISKMBR_H_ */ diff --git a/sys/sys/elf32.h b/sys/sys/elf32.h index f0762c7e69..88000f9855 100644 --- a/sys/sys/elf32.h +++ b/sys/sys/elf32.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/sys/elf32.h,v 1.7 1999/08/28 00:51:41 peter Exp $ - * $DragonFly: src/sys/sys/elf32.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/elf32.h,v 1.3 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_ELF32_H_ @@ -42,6 +42,7 @@ typedef u_int32_t Elf32_Off; typedef int32_t Elf32_Sword; typedef u_int32_t Elf32_Word; typedef u_int32_t Elf32_Size; +typedef Elf32_Off Elf32_Hashelt; /* * ELF header. diff --git a/sys/sys/elf64.h b/sys/sys/elf64.h index 15c5f3afad..2f7be1d1e1 100644 --- a/sys/sys/elf64.h +++ b/sys/sys/elf64.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/sys/elf64.h,v 1.9 1999/08/28 00:51:42 peter Exp $ - * $DragonFly: src/sys/sys/elf64.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/elf64.h,v 1.3 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_ELF64_H_ @@ -43,6 +43,7 @@ typedef int64_t Elf64_Sword; typedef u_int64_t Elf64_Word; typedef u_int64_t Elf64_Size; typedef u_int16_t Elf64_Quarter; +typedef Elf64_Half Elf64_Hashelt; /* * ELF header. diff --git a/sys/sys/elf_generic.h b/sys/sys/elf_generic.h index 2640144fe4..495edb8580 100644 --- a/sys/sys/elf_generic.h +++ b/sys/sys/elf_generic.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/sys/elf_generic.h,v 1.4 1999/08/28 00:51:42 peter Exp $ - * $DragonFly: src/sys/sys/elf_generic.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/elf_generic.h,v 1.3 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_ELF_GENERIC_H_ @@ -51,6 +51,7 @@ #error "Unknown byte order" #endif +#define __elfN(x) __CONCAT(__CONCAT(__CONCAT(elf,__ELF_WORD_SIZE),_),x) #define __ElfN(x) __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x) #define __ELFN(x) __CONCAT(__CONCAT(__CONCAT(ELF,__ELF_WORD_SIZE),_),x) #define __ElfType(x) typedef __ElfN(x) __CONCAT(Elf_,x) @@ -61,6 +62,7 @@ __ElfType(Off); __ElfType(Sword); __ElfType(Word); __ElfType(Size); +__ElfType(Hashelt); __ElfType(Ehdr); __ElfType(Shdr); __ElfType(Phdr); diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index 7b9888a758..2b14b3a8ed 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -40,7 +40,7 @@ * * @(#)kernel.h 8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/sys/kernel.h,v 1.63.2.9 2002/07/02 23:00:30 archie Exp $ - * $DragonFly: src/sys/sys/kernel.h,v 1.5 2003/09/24 18:37:51 dillon Exp $ + * $DragonFly: src/sys/sys/kernel.h,v 1.6 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_KERNEL_H_ @@ -243,7 +243,7 @@ struct sysinit { C_SYSUNINIT(uniquifier, subsystem, order, \ (sysinit_cfunc_t)(sysinit_nfunc_t)func, (void *)ident) -void sysinit_add (struct sysinit **set); +void sysinit_add (struct sysinit **set, struct sysinit **set_end); /* * Infrastructure for tunable 'constants'. Value may be specified at compile diff --git a/sys/sys/linker.h b/sys/sys/linker.h index 719c4cf453..a09daf6199 100644 --- a/sys/sys/linker.h +++ b/sys/sys/linker.h @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/sys/linker.h,v 1.17.2.1 2002/03/11 01:13:53 dd Exp $ - * $DragonFly: src/sys/sys/linker.h,v 1.3 2003/07/18 05:12:41 dillon Exp $ + * $DragonFly: src/sys/sys/linker.h,v 1.4 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_LINKER_H_ @@ -77,6 +77,9 @@ struct linker_file_ops { * Unload a file, releasing dependancies and freeing storage. */ void (*unload)(linker_file_t); + + int (*lookup_set)(linker_file_t, const char *name, + void ***firstp, void ***lastp, int *countp); }; struct common_symbol { @@ -184,7 +187,16 @@ int linker_file_add_dependancy(linker_file_t _file, linker_file_t _dep); * caddr_t. An error is returned, 0 if no error occured. */ int linker_file_lookup_symbol(linker_file_t _file, const char* _name, - int _deps, caddr_t *); + int _deps, caddr_t *); + + +/* + * Lookup a linker set in a file. Return pointers to the first entry, + * last + 1, and count of entries. Use: for (p = start; p < stop; p++) {} + * void *start is really: "struct yoursetmember ***start;" + */ +int linker_file_lookup_set(linker_file_t _file, const char *_name, + void *_start, void *_stop, int *_count); /* * Search the linker path for the module. Return the full pathname in @@ -220,10 +232,23 @@ int linker_ddb_symbol_values(c_linker_sym_t _sym, linker_symval_t *_symval); #define MODINFOMD_SSYM 0x0003 /* start of symbols */ #define MODINFOMD_ESYM 0x0004 /* end of symbols */ #define MODINFOMD_DYNAMIC 0x0005 /* _DYNAMIC pointer */ +#define MODINFOMD_ENVP 0x0006 /* (from 5.x) envp[] */ +#define MODINFOMD_HOWTO 0x0007 /* (from 5.x) boothowto */ +#define MODINFOMD_KERNEND 0x0008 /* (from 5.x) kernend */ #define MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */ #define MODINFOMD_DEPLIST (0x4001 | MODINFOMD_NOCOPY) /* depends on */ +#ifdef _KERNEL +#define MD_FETCH(mdp, info, type) ({ \ + type *__p; \ + __p = (type *)preload_search_info((mdp), MODINFO_METADATA | (info)); \ + __p ? *__p : 0; \ +}) +#endif + +#define LINKER_HINTS_VERSION 1 /* linker.hints file version */ + #ifdef _KERNEL /* diff --git a/sys/sys/linker_set.h b/sys/sys/linker_set.h index 1dfc145147..3468b2192a 100644 --- a/sys/sys/linker_set.h +++ b/sys/sys/linker_set.h @@ -24,70 +24,76 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/sys/linker_set.h,v 1.4.2.1 2000/08/02 21:52:20 peter Exp $ - * $DragonFly: src/sys/sys/linker_set.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/linker_set.h,v 1.3 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_LINKER_SET_H_ #define _SYS_LINKER_SET_H_ +#ifndef _SYS_CDEFS_H_ +#include +#endif + /* * The following macros are used to declare global sets of objects, which * are collected by the linker into a `struct linker_set' as defined below. * For ELF, this is done by constructing a separate segment for each set. - * For a.out, it is done automatically by the linker. * - * In the MAKE_SET macros below, the lines: + * In the __MAKE_SET macros below, the lines: * * static void const * const __set_##set##_sym_##sym = &sym; * * are present only to prevent the compiler from producing bogus * warnings about unused symbols. */ -#ifdef __ELF__ +#ifndef __ELF__ +#error only ELF is supported +#endif -/* - * Alpha GAS needs an align before the section change. It seems to assume - * that after the .previous, it is aligned, so the following .align 3 is - * ignored. Since the previous instructions often contain strings, this is - * a problem. - */ +#if 0 -#ifdef __alpha__ -#define MAKE_SET(set, sym) \ - static void const * const __set_##set##_sym_##sym = &sym; \ - __asm(".align 3"); \ - __asm(".section .set." #set ",\"aw\""); \ - __asm(".quad " #sym); \ - __asm(".previous") -#else -#define MAKE_SET(set, sym) \ +#define __MAKE_SET(set, sym) \ static void const * const __set_##set##_sym_##sym = &sym; \ - __asm(".section .set." #set ",\"aw\""); \ + __asm(".section set_" #set ",\"aw\""); \ __asm(".long " #sym); \ __asm(".previous") + #endif -#define TEXT_SET(set, sym) MAKE_SET(set, sym) -#define DATA_SET(set, sym) MAKE_SET(set, sym) -#else +#define __MAKE_SET(set, sym) \ + static void const * const __set_##set##_sym_##sym \ + __section("set_" #set) __unused = &sym + +#define TEXT_SET(set, sym) __MAKE_SET(set, sym) +#define DATA_SET(set, sym) __MAKE_SET(set, sym) +#define BSS_SET(set, sym) __MAKE_SET(set, sym) +#define ABS_SET(set, sym) __MAKE_SET(set, sym) +#define SET_ENTRY(set, sym) __MAKE_SET(set, sym) + +#define SET_DECLARE(set, ptype) \ + extern ptype *__CONCAT(__start_set_,set); \ + extern ptype *__CONCAT(__stop_set_,set) + +#define SET_BEGIN(set) (&__CONCAT(__start_set_,set)) +#define SET_LIMIT(set) (&__CONCAT(__stop_set_,set)) /* - * NB: the constants defined below must match those defined in - * ld/ld.h. Since their calculation requires arithmetic, we - * can't name them symbolically (e.g., 23 is N_SETT | N_EXT). + * Iterate over all the elements of a set. + * + * Sets always contain addresses of things, and "pvar" points to words + * containing those addresses. Thus is must be declared as "type **pvar", + * and the address of each set item is obtained inside the loop by "*pvar". */ -#define MAKE_SET(set, sym, type) \ - static void const * const __set_##set##_sym_##sym = &sym; \ - __asm(".stabs \"_" #set "\", " #type ", 0, 0, _" #sym) -#define TEXT_SET(set, sym) MAKE_SET(set, sym, 23) -#define DATA_SET(set, sym) MAKE_SET(set, sym, 25) +#define SET_FOREACH(pvar, set) \ + for (pvar = SET_BEGIN(set); pvar < SET_LIMIT(set); pvar++) -#endif +#define SET_ITEM(set, i) \ + ((SET_BEGIN(set))[i]) -struct linker_set { - int ls_length; - void *ls_items[1]; /* really ls_length of them, - * trailing NULL */ -}; +/* + * Provide a count of the items in a set. + */ +#define SET_COUNT(set) \ + (SET_LIMIT(set) - SET_BEGIN(set)) #endif /* _SYS_LINKER_SET_H_ */ diff --git a/sys/sys/module.h b/sys/sys/module.h index 04f4cedaa4..3dcb75c15e 100644 --- a/sys/sys/module.h +++ b/sys/sys/module.h @@ -24,12 +24,22 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/sys/module.h,v 1.14.2.3 2002/03/17 11:07:45 alfred Exp $ - * $DragonFly: src/sys/sys/module.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/module.h,v 1.3 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_MODULE_H_ #define _SYS_MODULE_H_ +/* + * Module metadata types + */ +#define MDT_DEPEND 1 /* argument is a module name */ +#define MDT_MODULE 2 /* module declaration */ +#define MDT_VERSION 3 /* module version(s) */ + +#define MDT_STRUCT_VERSION 1 /* version of metadata structure */ +#define MDT_SETNAME "modmetadata_set" + typedef enum modeventtype { MOD_LOAD, MOD_UNLOAD, @@ -61,6 +71,29 @@ typedef union modspecific { u_long ulongval; } modspecific_t; +/* + * Module dependency declarartion + */ +struct mod_depend { + int md_ver_minimum; + int md_ver_preferred; + int md_ver_maximum; +}; + +/* + * Module version declaration + */ +struct mod_version { + int mv_version; +}; + +struct mod_metadata { + int md_version; /* structure version MDTV_* */ + int md_type; /* type of entry MDT_* */ + void *md_data; /* specific data */ + const char *md_cval; /* common string label */ +}; + #ifdef _KERNEL #define MODULE_METADATA(uniquifier, type, data, cval) diff --git a/sys/sys/odisklabel.h b/sys/sys/odisklabel.h index 3802fd0108..58bc5e0459 100644 --- a/sys/sys/odisklabel.h +++ b/sys/sys/odisklabel.h @@ -32,7 +32,7 @@ * * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 * $FreeBSD: src/sys/sys/disklabel.h,v 1.49.2.7 2001/05/27 05:58:26 jkh Exp $ - * $DragonFly: src/sys/sys/Attic/odisklabel.h,v 1.3 2003/08/20 07:31:21 rob Exp $ + * $DragonFly: src/sys/sys/Attic/odisklabel.h,v 1.4 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_DISKLABEL_H_ @@ -343,61 +343,6 @@ struct partinfo { struct partition *part; }; -/* DOS partition table -- located in boot block */ - -#if defined(PC98) && !defined(PC98_ATCOMPAT) -#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ -#define DOSLABELSECTOR 1 /* 0: 256b/s, 1: 512b/s */ -#define DOSPARTOFF 0 -#define NDOSPART 16 -#define DOSPTYP_386BSD 0x94 /* 386BSD partition type */ -#define MBR_PTYPE_FreeBSD 0x94 /* FreeBSD partition type */ - -struct dos_partition { - unsigned char dp_mid; -#define DOSMID_386BSD (0x14|0x80) /* 386bsd|bootable */ - unsigned char dp_sid; -#define DOSSID_386BSD (0x44|0x80) /* 386bsd|active */ - unsigned char dp_dum1; - unsigned char dp_dum2; - unsigned char dp_ipl_sct; - unsigned char dp_ipl_head; - unsigned short dp_ipl_cyl; - unsigned char dp_ssect; /* starting sector */ - unsigned char dp_shd; /* starting head */ - unsigned short dp_scyl; /* starting cylinder */ - unsigned char dp_esect; /* end sector */ - unsigned char dp_ehd; /* end head */ - unsigned short dp_ecyl; /* end cylinder */ - unsigned char dp_name[16]; -}; - -#else /* IBMPC */ -#define DOSBBSECTOR 0 /* DOS boot block relative sector number */ -#define DOSPARTOFF 446 -#define NDOSPART 4 -#define DOSPTYP_386BSD 0xa5 /* 386BSD partition type */ -#define DOSPTYP_LINSWP 0x82 /* Linux swap partition */ -#define DOSPTYP_LINUX 0x83 /* Linux partition */ -#define DOSPTYP_EXT 5 /* DOS extended partition */ - -struct dos_partition { - unsigned char dp_flag; /* bootstrap flags */ - unsigned char dp_shd; /* starting head */ - unsigned char dp_ssect; /* starting sector */ - unsigned char dp_scyl; /* starting cylinder */ - unsigned char dp_typ; /* partition type */ - unsigned char dp_ehd; /* end head */ - unsigned char dp_esect; /* end sector */ - unsigned char dp_ecyl; /* end cylinder */ - u_int32_t dp_start; /* absolute starting sector number */ - u_int32_t dp_size; /* partition size in sectors */ -}; -#endif - -#define DPSECT(s) ((s) & 0x3f) /* isolate relevant bits of sector */ -#define DPCYL(c, s) ((c) + (((s) & 0xc0)<<2)) /* and those that are cylinder */ - /* * Disk-specific ioctls. */ diff --git a/sys/sys/reboot.h b/sys/sys/reboot.h index 1379b83e02..3a4ecaa5a2 100644 --- a/sys/sys/reboot.h +++ b/sys/sys/reboot.h @@ -32,7 +32,7 @@ * * @(#)reboot.h 8.3 (Berkeley) 12/13/94 * $FreeBSD: src/sys/sys/reboot.h,v 1.18.2.1 2001/12/17 18:44:43 guido Exp $ - * $DragonFly: src/sys/sys/reboot.h,v 1.2 2003/06/17 04:28:58 dillon Exp $ + * $DragonFly: src/sys/sys/reboot.h,v 1.3 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_REBOOT_H_ @@ -64,6 +64,7 @@ #define RB_SELFTEST 0x20000 /* don't boot to normal operation, do selftest */ #define RB_PAUSE 0x40000 /* pause after each output line during probe */ +#define RB_MULTIPLE 0x20000000 /* use multiple consoles (5.x) */ #define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */ /* diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h index e92dbf28be..13fbf6d43d 100644 --- a/sys/sys/sysctl.h +++ b/sys/sys/sysctl.h @@ -35,7 +35,7 @@ * * @(#)sysctl.h 8.1 (Berkeley) 6/2/93 * $FreeBSD: src/sys/sys/sysctl.h,v 1.81.2.10 2003/05/01 22:48:09 trhodes Exp $ - * $DragonFly: src/sys/sys/sysctl.h,v 1.8 2003/10/24 17:19:13 dillon Exp $ + * $DragonFly: src/sys/sys/sysctl.h,v 1.9 2003/11/10 06:12:17 dillon Exp $ */ #ifndef _SYS_SYSCTL_H_ @@ -572,8 +572,6 @@ extern char osrelease[]; extern char ostype[]; extern char kern_ident[]; -struct linker_set; - /* Dynamic oid handling */ struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist, struct sysctl_oid_list *parent, int nbr, const char *name, @@ -590,10 +588,6 @@ struct sysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist, int sysctl_ctx_entry_del(struct sysctl_ctx_list *clist, struct sysctl_oid *oidp); -/* Linker set based oid handling */ -void sysctl_register_set(struct linker_set *lsp); -void sysctl_unregister_set(struct linker_set *lsp); - int kernel_sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen, size_t *retval); diff --git a/sys/vfs/nwfs/nwfs_io.c b/sys/vfs/nwfs/nwfs_io.c index 4dd2f4129e..4a4c185a3a 100644 --- a/sys/vfs/nwfs/nwfs_io.c +++ b/sys/vfs/nwfs/nwfs_io.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_io.c,v 1.6.2.1 2000/10/25 02:11:10 bp Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_io.c,v 1.8 2003/10/09 22:27:27 dillon Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_io.c,v 1.9 2003/11/10 06:12:17 dillon Exp $ * */ #include @@ -63,8 +63,6 @@ static int nwfs_fastlookup = 1; -extern struct linker_set sysctl_vfs_nwfs; - SYSCTL_DECL(_vfs_nwfs); SYSCTL_INT(_vfs_nwfs, OID_AUTO, fastlookup, CTLFLAG_RW, &nwfs_fastlookup, 0, ""); diff --git a/sys/vfs/nwfs/nwfs_node.c b/sys/vfs/nwfs/nwfs_node.c index 8eb00936e9..9ec0bcd19b 100644 --- a/sys/vfs/nwfs/nwfs_node.c +++ b/sys/vfs/nwfs/nwfs_node.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/nwfs/nwfs_node.c,v 1.3.2.8 2001/12/25 01:44:45 dillon Exp $ - * $DragonFly: src/sys/vfs/nwfs/nwfs_node.c,v 1.8 2003/08/07 21:54:35 dillon Exp $ + * $DragonFly: src/sys/vfs/nwfs/nwfs_node.c,v 1.9 2003/11/10 06:12:17 dillon Exp $ */ #include #include @@ -69,8 +69,6 @@ MALLOC_DEFINE(M_NWFSHASH, "NWFS hash", "NWFS has table"); static int nwfs_sysctl_vnprint(SYSCTL_HANDLER_ARGS); -extern struct linker_set sysctl_vfs_nwfs; - SYSCTL_DECL(_vfs_nwfs); SYSCTL_PROC(_vfs_nwfs, OID_AUTO, vnprint, CTLFLAG_WR|CTLTYPE_OPAQUE, diff --git a/sys/vfs/smbfs/smbfs_io.c b/sys/vfs/smbfs/smbfs_io.c index e372a53134..d9a47e8745 100644 --- a/sys/vfs/smbfs/smbfs_io.c +++ b/sys/vfs/smbfs/smbfs_io.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_io.c,v 1.3.2.3 2003/01/17 08:20:26 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_io.c,v 1.8 2003/10/09 22:27:27 dillon Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_io.c,v 1.9 2003/11/10 06:12:17 dillon Exp $ * */ #include @@ -71,8 +71,6 @@ extern int smbfs_pbuf_freecnt; static int smbfs_fastlookup = 1; -extern struct linker_set sysctl_vfs_smbfs; - SYSCTL_DECL(_vfs_smbfs); SYSCTL_INT(_vfs_smbfs, OID_AUTO, fastlookup, CTLFLAG_RW, &smbfs_fastlookup, 0, ""); diff --git a/sys/vfs/smbfs/smbfs_node.c b/sys/vfs/smbfs/smbfs_node.c index b148ee68aa..5e15ee1824 100644 --- a/sys/vfs/smbfs/smbfs_node.c +++ b/sys/vfs/smbfs/smbfs_node.c @@ -30,7 +30,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/fs/smbfs/smbfs_node.c,v 1.2.2.3 2003/01/17 08:20:26 tjr Exp $ - * $DragonFly: src/sys/vfs/smbfs/smbfs_node.c,v 1.7 2003/08/07 21:54:36 dillon Exp $ + * $DragonFly: src/sys/vfs/smbfs/smbfs_node.c,v 1.8 2003/11/10 06:12:17 dillon Exp $ */ #include #include @@ -68,7 +68,6 @@ static MALLOC_DEFINE(M_SMBNODENAME, "SMBFS nname", "SMBFS node name"); int smbfs_hashprint(struct mount *mp); #if 0 -extern struct linker_set sysctl_vfs_smbfs; #ifdef SYSCTL_DECL SYSCTL_DECL(_vfs_smbfs); #endif -- 2.41.0