diff --git a/sys/include/exec.h b/sys/include/exec.h index 3d1011a..0dfe247 100644 --- a/sys/include/exec.h +++ b/sys/include/exec.h @@ -8,19 +8,11 @@ #define _SYS_EXEC_H_ #ifdef KERNEL -#ifdef EXEC_SCRIPT #define SHSIZE 64 #define SHPATHLEN 64 -#endif -#ifdef EXEC_ELF #define STRLEN 32 -#endif -#ifdef EXEC_AOUT #include "exec_aout.h" -#endif -#ifdef EXEC_ELF #include "exec_elf.h" -#endif #define NO_ADDR ((caddr_t)(~0U)) /* Indicates addr. not yet filled in */ @@ -34,29 +26,20 @@ struct exec_params { char **userargp; char **userenvp; union { -#ifdef EXEC_SCRIPT char sh[SHSIZE]; -#endif -#ifdef EXEC_AOUT struct exec aout; -#endif -#ifdef EXEC_ELF struct elf_ehdr elf; -#endif } hdr; /* head of file to exec */ int hdr_len; /* number of bytes valid in image_header */ char **argp, **envp; u_short argc, envc; /* count of argument and environment strings */ u_short argbc, envbc; /* total number of chars in argc and envc string pool */ union { -#ifdef EXEC_SCRIPT struct { char interpname[20]; /* real name of the script interpreter */ char interparg[SHPATHLEN]; /* interpreter arg */ char interpreted; /* flag - this executable is interpreted */ } sh; -#endif -#ifdef EXEC_ELF struct { struct buf *stbp; /* String table buffer pointer */ int stbpos; /* String table pos in buffer */ @@ -64,11 +47,8 @@ struct exec_params { int stoffset; /* String table file pos */ char str[STRLEN]; } elf; -#endif -#ifdef EXEC_AOUT struct { } aout; -#endif }; gid_t gid; diff --git a/sys/include/exec_elf.h b/sys/include/exec_elf.h index 6663299..be95611 100644 --- a/sys/include/exec_elf.h +++ b/sys/include/exec_elf.h @@ -476,13 +476,11 @@ struct elf_args { #include "opt_execfmt.h" #endif -#ifdef EXEC_ELF int exec_elf_makecmds __P((struct proc *, struct exec_package *)); int elf_read_from __P((struct proc *, struct vnode *, u_long, caddr_t, int)); void *elf_copyargs __P((struct exec_package *, struct ps_strings *, void *, void *)); -#endif /* common */ int exec_elf_setup_stack __P((struct proc *, struct exec_package *)); diff --git a/sys/include/vmsystm.h b/sys/include/vmsystm.h index 6f68a56..c3ddc81 100644 --- a/sys/include/vmsystm.h +++ b/sys/include/vmsystm.h @@ -1,4 +1,6 @@ /* + * Miscellaneous virtual memory subsystem variables and structures. + * * Copyright (c) 1982, 1986 Regents of the University of California. * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. @@ -6,20 +8,6 @@ * @(#)vmsystm.h 7.2.1 (2.11BSD GTE) 1/15/95 */ -/* - * Miscellaneous virtual memory subsystem variables and structures. - */ - -#if defined(KERNEL) && defined(UCB_METER) && !defined(SUPERVISOR) -size_t freemem; /* remaining clicks of free memory */ - -u_short avefree; /* moving average of remaining free clicks */ -u_short avefree30; /* 30 sec (avefree is 5 sec) moving average */ - -/* writable copies of tunables */ -int maxslp; /* max sleep time before very swappable */ -#endif - /* * Fork/vfork accounting. */ @@ -31,6 +19,16 @@ struct forkstat long sizvfork; }; -#if defined(KERNEL) && defined(UCB_METER) && !defined(SUPERVISOR) +#if defined(KERNEL) && defined(UCB_METER) +size_t freemem; /* remaining clicks of free memory */ + +u_short avefree; /* moving average of remaining free clicks */ +u_short avefree30; /* 30 sec (avefree is 5 sec) moving average */ + +/* + * writable copies of tunables + */ +int maxslp; /* max sleep time before very swappable */ + struct forkstat forkstat; #endif diff --git a/sys/kernel/exec_conf.c b/sys/kernel/exec_conf.c index 01c7ff4..60ac3eb 100644 --- a/sys/kernel/exec_conf.c +++ b/sys/kernel/exec_conf.c @@ -31,26 +31,14 @@ #include #include -#ifdef EXEC_SCRIPT int exec_script_check(struct exec_params *epp); -#endif -#ifdef EXEC_AOUT int exec_aout_check(struct exec_params *epp); -#endif -#ifdef EXEC_ELF int exec_elf_check(struct exec_params *epp); -#endif const struct execsw execsw[] = { -#ifdef EXEC_AOUT { exec_aout_check, "a.out" }, /* a.out binaries */ -#endif -#ifdef EXEC_ELF { exec_elf_check, "elf" }, /* 32bit ELF bins */ -#endif -#ifdef EXEC_SCRIPT { exec_script_check, "script" }, /* shell scripts */ -#endif }; int nexecs = (sizeof(execsw) / sizeof(*execsw)); int exec_maxhdrsz; diff --git a/sys/kernel/exec_subr.c b/sys/kernel/exec_subr.c index 3a5de8b..998e755 100644 --- a/sys/kernel/exec_subr.c +++ b/sys/kernel/exec_subr.c @@ -260,13 +260,11 @@ void exec_save_args(struct exec_params *epp) if ((argp = epp->userargp) != NULL) while (argp[argc]) argc++; -#ifdef EXEC_SCRIPT if (epp->sh.interpreted) { argc++; if (epp->sh.interparg[0]) argc++; } -#endif if (argc != 0) { if ((epp->argp = (char **)exec_alloc(argc * sizeof(char *), NBPW, epp)) == NULL) return; @@ -283,7 +281,7 @@ void exec_save_args(struct exec_params *epp) ap = *argp++; else ap = NULL; -#ifdef EXEC_SCRIPT + if (epp->sh.interpreted) { if (epp->argc == 0) ap = epp->sh.interpname; @@ -295,7 +293,6 @@ void exec_save_args(struct exec_params *epp) --argp; } } -#endif if (ap == 0) break; l = strlen(ap)+1; diff --git a/sys/kernel/kern_exec.c b/sys/kernel/kern_exec.c index 6e25e5c..95530f5 100644 --- a/sys/kernel/kern_exec.c +++ b/sys/kernel/kern_exec.c @@ -66,9 +66,7 @@ int exec_check(struct exec_params *epp) * Read the first 'SHSIZE' bytes from the file to execute */ DEBUG("Read header %d bytes from %d\n", sizeof(epp->hdr), 0); -#ifdef EXEC_SCRIPT epp->hdr.sh[0] = '\0'; /* for zero length files */ -#endif error = rdwri (UIO_READ, epp->ip, (caddr_t) &epp->hdr, sizeof(epp->hdr), (off_t)0, IO_UNIT, &r); diff --git a/sys/pic32/machparam.h b/sys/pic32/machparam.h index c35fc2a..9ccca1f 100644 --- a/sys/pic32/machparam.h +++ b/sys/pic32/machparam.h @@ -118,6 +118,13 @@ extern void _keram_start(), _keram_end(); #define USIZE 3072 #define SSIZE 2048 /* initial stack size (bytes) */ +/* + * Collect kernel statistics by default. + */ +#if !defined(UCB_METER) && !defined(NO_UCB_METER) +#define UCB_METER +#endif + #ifdef KERNEL #include "machine/io.h" diff --git a/sys/pic32/max32/Config b/sys/pic32/max32/Config index 70b6b07..f9c4096 100644 --- a/sys/pic32/max32/Config +++ b/sys/pic32/max32/Config @@ -10,27 +10,19 @@ # # For details, see http://retrobsd.org/wiki/doku.php/doc/kconfig # -machine "pic32" +architecture "pic32" cpu "PIC32MX7" -ident CHIPKIT_MAX +board "CHIPKIT_MAX32" # Linker script ldscript "cfg/bootloader-max32.ld" -# Need to set locally -timezone 8 dst -maxusers 1 - # Standard system options +hz 100 # Rate of clock interrupt options "CPU_KHZ=80000" # Oscillator frequency of CPU core options "BUS_KHZ=80000" # Frequency of peripheral bus -options "HZ=100" # Rate of clock interrupt options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 -options "EXEC_AOUT" # Run a.out binaries -options "EXEC_ELF" # Run ELF binaries -options "EXEC_SCRIPT" # Run shell scripts -options "UCB_METER" # Collect kernel statistics # LED options "LED_KERNEL_PORT=TRISA" # for kernel activity LED... diff --git a/sys/pic32/max32/Makefile b/sys/pic32/max32/Makefile index 0aefc2d..b848dc5 100644 --- a/sys/pic32/max32/Makefile +++ b/sys/pic32/max32/Makefile @@ -1,4 +1,4 @@ -PARAM = -DCHIPKIT_MAX +PARAM = -DCHIPKIT_MAX32 PARAM += -DPIC32MX7 PARAM += -DPWM_ENABLED PARAM += -DADC_ENABLED @@ -15,17 +15,10 @@ PARAM += -DUART2_ENABLED PARAM += -DUART1_ENABLED PARAM += -DLED_KERNEL_PIN=3 PARAM += -DLED_KERNEL_PORT=TRISA -PARAM += -DUCB_METER -PARAM += -DEXEC_SCRIPT -PARAM += -DEXEC_ELF -PARAM += -DEXEC_AOUT PARAM += -DBUS_DIV=1 -PARAM += -DHZ=100 PARAM += -DBUS_KHZ=80000 PARAM += -DCPU_KHZ=80000 -PARAM += -DTIMEZONE=480 -PARAM += -DDST=1 -PARAM += -DMAXUSERS=1 +PARAM += -DHZ=100 LDSCRIPT = "cfg/bootloader-max32.ld" # # Makefile for RetroBSD, pic32 target diff --git a/sys/pic32/wf32/Config b/sys/pic32/wf32/Config index 26e7a33..83d8c2a 100644 --- a/sys/pic32/wf32/Config +++ b/sys/pic32/wf32/Config @@ -7,27 +7,19 @@ # make clean # make # -machine "pic32" +architecture "pic32" cpu "PIC32MX7" -ident CHIPKIT_WF +board "CHIPKIT_WF32" # Linker script ldscript "cfg/bootloader-max32.ld" -# Need to set locally -timezone 8 dst -maxusers 1 - # Standard system options +hz 100 # Rate of clock interrupt options "CPU_KHZ=80000" # Oscillator frequency of CPU core options "BUS_KHZ=80000" # Frequency of peripheral bus -options "HZ=100" # Rate of clock interrupt options "BUS_DIV=1" # Bus clock divisor 1/2/4/8 -options "EXEC_AOUT" # Run a.out binaries -options "EXEC_ELF" # Run ELF binaries -options "EXEC_SCRIPT" # Run shell scripts -options "UCB_METER" # Collect kernel statistics # LED options "LED_KERNEL_PORT=TRISA" # for kernel activity LED... diff --git a/sys/pic32/wf32/Makefile b/sys/pic32/wf32/Makefile index ec15410..563bdd1 100644 --- a/sys/pic32/wf32/Makefile +++ b/sys/pic32/wf32/Makefile @@ -1,6 +1,26 @@ -IDENT=-DCHIPKIT_WF -DPIC32MX7 -DPWM_ENABLED -DADC_ENABLED -DGPIO_ENABLED -DSD0_CS_PIN=4 -DSD0_CS_PORT=TRISD -DSD0_PORT=2 -DSD0_MHZ=10 -DSPI_ENABLED -DCONSOLE_DEVICE=tty0 -DUART1_ENABLED -DLED_TTY_PIN=1 -DLED_TTY_PORT=TRISA -DLED_DISK_PIN=0 -DLED_DISK_PORT=TRISF -DLED_KERNEL_PIN=0 -DLED_KERNEL_PORT=TRISA -DUCB_METER -DEXEC_SCRIPT -DEXEC_ELF -DEXEC_AOUT -DBUS_DIV=1 -DHZ=100 -DBUS_KHZ=80000 -DCPU_KHZ=80000 -LDSCRIPT="cfg/bootloader-max32.ld" -PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=1 +PARAM = -DCHIPKIT_WF32 +PARAM += -DPIC32MX7 +PARAM += -DPWM_ENABLED +PARAM += -DADC_ENABLED +PARAM += -DGPIO_ENABLED +PARAM += -DSD0_CS_PIN=4 +PARAM += -DSD0_CS_PORT=TRISD +PARAM += -DSD0_PORT=2 +PARAM += -DSD0_MHZ=10 +PARAM += -DSPI_ENABLED +PARAM += -DCONSOLE_DEVICE=tty0 +PARAM += -DUART1_ENABLED +PARAM += -DLED_TTY_PIN=1 +PARAM += -DLED_TTY_PORT=TRISA +PARAM += -DLED_DISK_PIN=0 +PARAM += -DLED_DISK_PORT=TRISF +PARAM += -DLED_KERNEL_PIN=0 +PARAM += -DLED_KERNEL_PORT=TRISA +PARAM += -DBUS_DIV=1 +PARAM += -DBUS_KHZ=80000 +PARAM += -DCPU_KHZ=80000 +PARAM += -DHZ=100 +LDSCRIPT = "cfg/bootloader-max32.ld" # # Makefile for RetroBSD, pic32 target # @@ -24,14 +44,14 @@ endif # sources are located via $S relative to the compilation directory S = ../.. -COPTS = -I. ${IDENT} -DKERNEL -CFLAGS = -O ${COPTS} ${PARAM} +DEFS = -I. ${PARAM} -DKERNEL +CFLAGS = -O ${DEFS} # compile rules: rules are named COMPILE_${SUFFIX} # SUFFIX is the file suffix, capitalized (e.g. C for a .c file). COMPILE_C = ${CC} -c ${CFLAGS} $< -COMPILE_S = ${CC} -c ${COPTS} $< +COMPILE_S = ${CC} -c ${DEFS} $< OBJS = exec_aout.o exec_conf.o exec_elf.o exec_script.o exec_subr.o \ init_main.o init_sysent.o kern_clock.o kern_descrip.o \ @@ -114,24 +134,17 @@ reconfig ioconf.c swapunix.c: Config ../../../tools/kconfig/kconfig load: unix.elf pic32prog unix.hex -startup.o: ../startup.S - ${COMPILE_S} - -# the following are necessary because the files depend on the types of -# cpu's included in the system configuration -clock.o machdep.o conf.o: Makefile - machine: ln -s .. $@ sys: ln -s ../../include $@ -depend: machine - mkdep ${COPTS} ${CFILES} ioconf.c +startup.o: ../startup.S + ${COMPILE_S} ioconf.o: ioconf.c - ${CC} -c ${CFLAGS} ioconf.c + ${COMPILE_C} exec_aout.o: $S/kernel/exec_aout.c ${COMPILE_C} diff --git a/tools/kconfig/config.h b/tools/kconfig/config.h index e1d4cc6..4192271 100644 --- a/tools/kconfig/config.h +++ b/tools/kconfig/config.h @@ -122,15 +122,14 @@ struct config { }; /* - * Config has a global notion of which machine type is - * being used. + * Config has a global notion of which architecture is being used. */ -int machine; -char *machinename; -#define MACHINE_PIC32 1 +int arch; +char *archname; +#define ARCH_PIC32 1 /* - * For each machine, a set of CPU's may be specified as supported. + * For each architecture, a set of CPU's may be specified as supported. * These and the options (below) are put in the C flags in the makefile. */ struct cputype { @@ -149,7 +148,7 @@ struct opt { struct opt *op_next; } *opt, *mkopt; -char *ident; +char *board; char *ldscript; int do_trace; @@ -163,6 +162,7 @@ struct file_list *ftab, *conf_list, **confp, *comp_list, **compp; int zone, hadtz; int dst; +int hz; int debugging; int maxusers; diff --git a/tools/kconfig/config.y b/tools/kconfig/config.y index e72f9c2..c97f995 100644 --- a/tools/kconfig/config.y +++ b/tools/kconfig/config.y @@ -7,7 +7,9 @@ %token AND %token ANY +%token ARCHITECTURE %token AT +%token BOARD %token COMMA %token CONFIG %token CONTROLLER @@ -21,9 +23,7 @@ %token EQUALS %token FLAGS %token HZ -%token IDENT %token LDSCRIPT -%token MACHINE %token MAJOR %token MASTER %token MAXUSERS @@ -139,13 +139,13 @@ Spec: ; Config_spec: - MACHINE Save_id + ARCHITECTURE Save_id = { if (strcmp($2, "pic32") == 0) { - machine = MACHINE_PIC32; - machinename = "pic32"; + arch = ARCH_PIC32; + archname = "pic32"; } else - yyerror("Unknown machine type"); + yyerror("Unknown architecture"); } | CPU Save_id @@ -162,8 +162,8 @@ Config_spec: | MAKEOPTIONS Mkopt_list | - IDENT ID - = { ident = strdup($2); } + BOARD ID + = { board = strdup($2); } | LDSCRIPT ID = { ldscript = strdup($2); } @@ -758,9 +758,9 @@ void check_nexus(dev, num) register struct device *dev; int num; { - switch (machine) { + switch (arch) { - case MACHINE_PIC32: + case ARCH_PIC32: break; } } diff --git a/tools/kconfig/kconfig.8 b/tools/kconfig/kconfig.8 index 87000ab..9475324 100644 --- a/tools/kconfig/kconfig.8 +++ b/tools/kconfig/kconfig.8 @@ -18,7 +18,7 @@ A second file tells .Nm kconfig what files are needed to generate a kernel and can be augmented by configuration specific set of files -that give alternate files for a specific machine. +that give alternate files for a specific architecture. (see the .Sx FILES section below) @@ -39,7 +39,7 @@ and other system parameters for one kernel configuration. .El .Pp .Nm Kconfig -should be run from the machine and board specific +should be run from the architecture and board specific subdirectory of the system source (like .Pa sys/pic32/max32 ) . .Nm Kconfig diff --git a/tools/kconfig/lang.l b/tools/kconfig/lang.l index 08e5bd2..ac76848 100644 --- a/tools/kconfig/lang.l +++ b/tools/kconfig/lang.l @@ -64,9 +64,9 @@ static struct kt key_words[] = { { "dumps", DUMPS }, { "flags", FLAGS }, { "hz", HZ }, - { "ident", IDENT }, + { "board", BOARD }, { "ldscript", LDSCRIPT }, - { "machine", MACHINE }, + { "architecture", ARCHITECTURE }, { "major", MAJOR }, { "makeoptions", MAKEOPTIONS }, { "master", MASTER }, diff --git a/tools/kconfig/main.c b/tools/kconfig/main.c index 1adc326..ab3f6f0 100644 --- a/tools/kconfig/main.c +++ b/tools/kconfig/main.c @@ -76,14 +76,14 @@ usage: fputs("usage: kconfig [-gp] sysname\n", stderr); if (yyparse()) exit(3); - switch (machine) { + switch (arch) { - case MACHINE_PIC32: + case ARCH_PIC32: pic32_ioconf(); break; default: - printf("Specify machine type, e.g. ``machine pic32''\n"); + printf("Specify architecture, e.g. ``architecture pic32''\n"); exit(1); } makefile(); /* build Makefile */ diff --git a/tools/kconfig/mkioconf.c b/tools/kconfig/mkioconf.c index c01ec62..9071230 100644 --- a/tools/kconfig/mkioconf.c +++ b/tools/kconfig/mkioconf.c @@ -65,7 +65,7 @@ wnum(num) return (errbuf); } -#if MACHINE_PIC32 +#if ARCH_PIC32 void pic32_ioconf() { register struct device *dp, *mp; diff --git a/tools/kconfig/mkmakefile.c b/tools/kconfig/mkmakefile.c index f8212b6..0b52bab 100644 --- a/tools/kconfig/mkmakefile.c +++ b/tools/kconfig/mkmakefile.c @@ -34,7 +34,7 @@ /* * Build the makefile for the system, from * the information in the files files and the - * additional files for the machine being compiled to. + * additional files for the architecture being compiled to. */ #include #include "y.tab.h" @@ -108,15 +108,6 @@ new_fent() return (fp); } -static struct users { - int u_default; - int u_min; - int u_max; -} users[] = { - { 2, 1, 16 }, /* MACHINE_PIC32 */ -}; -#define NUSERS (sizeof (users) / sizeof (users[0])) - int opteq(cp, dp) char *cp, *dp; { @@ -164,7 +155,7 @@ next: if (wd == (char *)EOF) { (void) fclose(fp); if (first == 1) { - (void) sprintf(fname, "files.%s", raise(ident)); + (void) sprintf(fname, "files.%s", raise(board)); first++; fp = fopen(fname, "r"); if (fp != 0) @@ -348,7 +339,7 @@ void do_cfiles(fp) } if (eq(fl->f_fn, "generic")) fprintf(fp, "$A/%s/%s ", - machinename, swapname); + archname, swapname); else fprintf(fp, "%s ", swapname); lpos += len + 1; @@ -418,12 +409,11 @@ void makefile() FILE *ifp, *ofp; char line[BUFSIZ]; struct opt *op; - struct users *up; struct cputype *cp; read_files(); strcpy(line, "../Makefile.kconf"); - //(void) strcat(line, machinename); + //strcat(line, archname); ifp = fopen(line, "r"); if (ifp == 0) { perror(line); @@ -434,7 +424,7 @@ void makefile() perror("Makefile"); exit(1); } - fprintf(ofp, "PARAM = -D%s\n", raise(ident)); + fprintf(ofp, "PARAM = -D%s\n", raise(board)); if (cputype == 0) { printf("cpu type must be specified\n"); exit(1); @@ -448,25 +438,14 @@ void makefile() else fprintf(ofp, "PARAM += -D%s\n", op->op_name); } - - if (hadtz == 0) - printf("timezone not specified; gmt assumed\n"); - if ((unsigned)machine > NUSERS) { - printf("maxusers config info isn't present, using pic32\n"); - up = &users[MACHINE_PIC32-1]; - } else - up = &users[machine-1]; - if (maxusers == 0) { - printf("maxusers not specified; %d assumed\n", up->u_default); - maxusers = up->u_default; - } else if (maxusers < up->u_min) { - printf("minimum of %d maxusers assumed\n", up->u_min); - maxusers = up->u_min; - } else if (maxusers > up->u_max) - printf("warning: maxusers > %d (%d)\n", up->u_max, maxusers); - fprintf(ofp, "PARAM += -DTIMEZONE=%d\n", zone); - fprintf(ofp, "PARAM += -DDST=%d\n", dst); - fprintf(ofp, "PARAM += -DMAXUSERS=%d\n", maxusers); + if (hadtz) { + fprintf(ofp, "PARAM += -DTIMEZONE=%d\n", zone); + fprintf(ofp, "PARAM += -DDST=%d\n", dst); + } + if (maxusers > 0) + fprintf(ofp, "PARAM += -DMAXUSERS=%d\n", maxusers); + if (hz > 0) + fprintf(ofp, "PARAM += -DHZ=%d\n", hz); if (ldscript) fprintf(ofp, "LDSCRIPT = \"%s\"\n", ldscript); @@ -519,8 +498,7 @@ void do_swapspec(f, name) if (!eq(name, "generic")) fprintf(f, "swap%s.o: swap%s.c\n", name, name); else - fprintf(f, "swapgeneric.o: $A/%s/swapgeneric.c\n", - machinename); + fprintf(f, "swapgeneric.o: $A/%s/swapgeneric.c\n", archname); fprintf(f, "\t${COMPILE_C}\n\n"); }