mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-23 01:14:52 +01:00
Sync with sys/i386/i386/userconfig.c revision up to 1.115.
This commit is contained in:
parent
c70606fd9f
commit
f3284683fb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40957
@ -46,7 +46,7 @@
|
|||||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
**
|
**
|
||||||
** $Id: userconfig.c,v 1.57 1998/10/13 09:43:09 kato Exp $
|
** $Id: userconfig.c,v 1.58 1998/10/22 11:29:58 kato Exp $
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -117,6 +117,7 @@
|
|||||||
#include <sys/kernel.h>
|
#include <sys/kernel.h>
|
||||||
#include <sys/malloc.h>
|
#include <sys/malloc.h>
|
||||||
#include <sys/reboot.h>
|
#include <sys/reboot.h>
|
||||||
|
#include <sys/linker.h>
|
||||||
|
|
||||||
#include <machine/cons.h>
|
#include <machine/cons.h>
|
||||||
#include <machine/md_var.h>
|
#include <machine/md_var.h>
|
||||||
@ -135,36 +136,102 @@ static MALLOC_DEFINE(M_DEVL, "isa_devlist", "isa_device lists in userconfig()");
|
|||||||
|
|
||||||
static struct isa_device *isa_devlist; /* list read by dset to extract changes */
|
static struct isa_device *isa_devlist; /* list read by dset to extract changes */
|
||||||
|
|
||||||
#ifdef USERCONFIG_BOOT
|
|
||||||
char userconfig_from_boot[512] = "";
|
|
||||||
static int userconfig_boot_parsing; /* set if we are reading from the boot instructions */
|
static int userconfig_boot_parsing; /* set if we are reading from the boot instructions */
|
||||||
|
|
||||||
|
#define putchar(x) cnputc(x)
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Obtain command input.
|
||||||
|
**
|
||||||
|
** Initially, input is read from a possibly-loaded script.
|
||||||
|
** At the end of the script, or if no script is supplied,
|
||||||
|
** behaviour is determined by the RB_CONFIG (-c) flag. If
|
||||||
|
** the flag is set, user input is read from the console; if
|
||||||
|
** unset, the 'quit' command is invoked and userconfig
|
||||||
|
** will exit.
|
||||||
|
**
|
||||||
|
** Note that quit commands encountered in the script will be
|
||||||
|
** ignored if the RB_CONFIG flag is supplied.
|
||||||
|
*/
|
||||||
static int
|
static int
|
||||||
getchar(void)
|
getchar(void)
|
||||||
{
|
{
|
||||||
static char *next = userconfig_from_boot;
|
static const char *asp;
|
||||||
|
static int assize; /* use of int for -ve magic value */
|
||||||
if (next == userconfig_from_boot) {
|
static int autocheck = 0, signon = 0;
|
||||||
if (strncmp(next, "USERCONFIG\n", 11)) {
|
caddr_t autoentry, autoattr;
|
||||||
next++;
|
int c;
|
||||||
strcpy(next, "intro\n");
|
static int intro = 0;
|
||||||
} else {
|
|
||||||
next += 11;
|
/* Look for loaded userconfig script */
|
||||||
|
if (autocheck == 0)
|
||||||
|
{
|
||||||
|
autocheck = 1;
|
||||||
|
autoentry = preload_search_by_type("userconfig_script");
|
||||||
|
if (autoentry != NULL)
|
||||||
|
{
|
||||||
|
/* We have one, get size and data */
|
||||||
|
assize = 0;
|
||||||
|
if ((autoattr = preload_search_info(autoentry, MODINFO_SIZE)) != NULL)
|
||||||
|
assize = (size_t)*(u_int32_t *)autoattr;
|
||||||
|
asp = NULL;
|
||||||
|
if ((autoattr = preload_search_info(autoentry, MODINFO_ADDR)) != NULL)
|
||||||
|
asp = *(const char **)autoattr;
|
||||||
|
/* sanity check */
|
||||||
|
if ((assize == 0) || (asp == NULL)) {
|
||||||
|
assize = 0;
|
||||||
|
asp = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (*next) {
|
|
||||||
userconfig_boot_parsing = 1;
|
|
||||||
return (*next++);
|
|
||||||
} else {
|
|
||||||
userconfig_boot_parsing = 0;
|
|
||||||
return cngetc();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#else /* !USERCONFIG_BOOT */
|
|
||||||
#define getchar() cngetc()
|
|
||||||
#endif /* USERCONFIG_BOOT */
|
|
||||||
|
|
||||||
#define putchar(x) cnputc(x)
|
if (assize > 0)
|
||||||
|
{
|
||||||
|
/* Consume character from loaded userconfig script, display */
|
||||||
|
userconfig_boot_parsing = 1;
|
||||||
|
c = *asp;
|
||||||
|
asp++;
|
||||||
|
assize--;
|
||||||
|
|
||||||
|
} else if (assize == 0) {
|
||||||
|
|
||||||
|
/* Finished parsing script/no script */
|
||||||
|
userconfig_boot_parsing = 0;
|
||||||
|
#ifdef INTRO_USERCONFIG
|
||||||
|
if (intro == 0)
|
||||||
|
{
|
||||||
|
intro = 1;
|
||||||
|
c = 'i';
|
||||||
|
asp = "ntro\n";
|
||||||
|
assize = strlen(asp);
|
||||||
|
#else
|
||||||
|
if (!(boothowto & RB_CONFIG))
|
||||||
|
{
|
||||||
|
/* don't want to drop to interpreter */
|
||||||
|
c = 'q';
|
||||||
|
asp = "uit\n";
|
||||||
|
assize = strlen(asp);
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
/* Only display signon banner if we are about to go interactive */
|
||||||
|
if (!intro)
|
||||||
|
printf("\nFreeBSD Kernel Configuration Utility - Version 1.2\n"
|
||||||
|
" Type \"help\" for help"
|
||||||
|
#ifdef VISUAL_USERCONFIG
|
||||||
|
" or \"visual\" to go to the visual\n"
|
||||||
|
" configuration interface (requires MGA/VGA display or\n"
|
||||||
|
" serial terminal capable of displaying ANSI graphics)"
|
||||||
|
#endif
|
||||||
|
".\n");
|
||||||
|
assize = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (assize < 0) {
|
||||||
|
/* No script, read from the keyboard */
|
||||||
|
c = cngetc();
|
||||||
|
}
|
||||||
|
return(c);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef FALSE
|
#ifndef FALSE
|
||||||
#define FALSE (0)
|
#define FALSE (0)
|
||||||
@ -2402,7 +2469,7 @@ visuserconfig(void)
|
|||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* $Id: userconfig.c,v 1.57 1998/10/13 09:43:09 kato Exp $
|
* $Id: userconfig.c,v 1.58 1998/10/22 11:29:58 kato Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "scbus.h"
|
#include "scbus.h"
|
||||||
@ -2455,7 +2522,7 @@ static int set_device_enable(CmdParm *);
|
|||||||
static int set_device_disable(CmdParm *);
|
static int set_device_disable(CmdParm *);
|
||||||
static int quitfunc(CmdParm *);
|
static int quitfunc(CmdParm *);
|
||||||
static int helpfunc(CmdParm *);
|
static int helpfunc(CmdParm *);
|
||||||
#if defined(USERCONFIG_BOOT)
|
#if defined(INTRO_USERCONFIG)
|
||||||
static int introfunc(CmdParm *);
|
static int introfunc(CmdParm *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2516,7 +2583,7 @@ static Cmd CmdList[] = {
|
|||||||
{ "ex", quitfunc, NULL }, /* exit (quit) */
|
{ "ex", quitfunc, NULL }, /* exit (quit) */
|
||||||
{ "f", set_device_flags, int_parms }, /* flags dev mask */
|
{ "f", set_device_flags, int_parms }, /* flags dev mask */
|
||||||
{ "h", helpfunc, NULL }, /* help */
|
{ "h", helpfunc, NULL }, /* help */
|
||||||
#if defined(USERCONFIG_BOOT)
|
#if defined(INTRO_USERCONFIG)
|
||||||
{ "intro", introfunc, NULL }, /* intro screen */
|
{ "intro", introfunc, NULL }, /* intro screen */
|
||||||
#endif
|
#endif
|
||||||
{ "iom", set_device_mem, addr_parms }, /* iomem dev addr */
|
{ "iom", set_device_mem, addr_parms }, /* iomem dev addr */
|
||||||
@ -2545,16 +2612,6 @@ userconfig(void)
|
|||||||
int rval;
|
int rval;
|
||||||
Cmd *cmd;
|
Cmd *cmd;
|
||||||
|
|
||||||
printf("\nFreeBSD Kernel Configuration Utility - Version 1.1\n"
|
|
||||||
" Type \"help\" for help"
|
|
||||||
#ifdef VISUAL_USERCONFIG
|
|
||||||
" or \"visual\" to go to the visual\n"
|
|
||||||
" configuration interface (requires MGA/VGA display or\n"
|
|
||||||
" serial terminal capable of displaying ANSI graphics)"
|
|
||||||
#endif
|
|
||||||
".\n");
|
|
||||||
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
printf("config> ");
|
printf("config> ");
|
||||||
cngets(input, 80);
|
cngets(input, 80);
|
||||||
@ -2868,7 +2925,6 @@ set_num_eisa_slots(CmdParm *parms)
|
|||||||
static int
|
static int
|
||||||
quitfunc(CmdParm *parms)
|
quitfunc(CmdParm *parms)
|
||||||
{
|
{
|
||||||
#ifdef USERCONFIG_BOOT
|
|
||||||
/*
|
/*
|
||||||
* If kernel config supplied, and we are parsing it, and -c also supplied,
|
* If kernel config supplied, and we are parsing it, and -c also supplied,
|
||||||
* ignore a quit command, This provides a safety mechanism to allow
|
* ignore a quit command, This provides a safety mechanism to allow
|
||||||
@ -2876,7 +2932,6 @@ quitfunc(CmdParm *parms)
|
|||||||
*/
|
*/
|
||||||
if ((boothowto & RB_CONFIG) && userconfig_boot_parsing)
|
if ((boothowto & RB_CONFIG) && userconfig_boot_parsing)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2919,7 +2974,7 @@ helpfunc(CmdParm *parms)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USERCONFIG_BOOT)
|
#if defined(INTRO_USERCONFIG)
|
||||||
|
|
||||||
#if defined (VISUAL_USERCONFIG)
|
#if defined (VISUAL_USERCONFIG)
|
||||||
static void
|
static void
|
||||||
@ -3054,6 +3109,7 @@ introfunc(CmdParm *parms)
|
|||||||
else {
|
else {
|
||||||
putxy(0, 1, "Type \"help\" for help or \"quit\" to exit.");
|
putxy(0, 1, "Type \"help\" for help or \"quit\" to exit.");
|
||||||
move (0, 3);
|
move (0, 3);
|
||||||
|
boothowto |= RB_CONFIG; /* force -c */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3082,12 +3138,14 @@ lspnp ()
|
|||||||
"mem 0x%x 0x%x 0x%x 0x%x";
|
"mem 0x%x 0x%x 0x%x 0x%x";
|
||||||
char buf[256];
|
char buf[256];
|
||||||
if (lineno >= 23) {
|
if (lineno >= 23) {
|
||||||
printf("<More> ");
|
if (!userconfig_boot_parsing) {
|
||||||
if (getchar() == 'q') {
|
printf("<More> ");
|
||||||
printf("quit\n");
|
if (getchar() == 'q') {
|
||||||
return (1);
|
printf("quit\n");
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("\n");
|
|
||||||
lineno = 0;
|
lineno = 0;
|
||||||
}
|
}
|
||||||
if (lineno == 0 || first)
|
if (lineno == 0 || first)
|
||||||
@ -3133,11 +3191,13 @@ lsdevtab(struct isa_device *dt)
|
|||||||
|
|
||||||
if (lineno >= 23) {
|
if (lineno >= 23) {
|
||||||
printf("<More> ");
|
printf("<More> ");
|
||||||
if (getchar() == 'q') {
|
if (!userconfig_boot_parsing) {
|
||||||
printf("quit\n");
|
if (getchar() == 'q') {
|
||||||
return (1);
|
printf("quit\n");
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("\n");
|
|
||||||
lineno = 0;
|
lineno = 0;
|
||||||
}
|
}
|
||||||
if (lineno == 0) {
|
if (lineno == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user