mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-29 00:34:10 +02:00
if user left accidentally floppy or CD in drive, give him a chance to continue to boot from HD.
disabled by default, enablable by SYS CONFIG (Tom Ehlert) git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@591 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
5210965831
commit
05df4d89f4
@ -1,4 +1,32 @@
|
|||||||
2002 Mar 14 - Build 2029
|
2003 Jun xx - Build 2030
|
||||||
|
-------- Bart Oldeman (bart@dosemu.org)
|
||||||
|
+ Changes Tom
|
||||||
|
if user left accidentally floppy or CD in drive,
|
||||||
|
give him a chance to continue to boot from HD.
|
||||||
|
disabled by default, enablable by SYS CONFIG
|
||||||
|
|
||||||
|
+ Changes Bart
|
||||||
|
* flip some slashes in drivers/*.asm
|
||||||
|
(enables cross-assembly on Linux)
|
||||||
|
* remove superfluous printf("\n") in patchobj.c
|
||||||
|
* combine the INIT class with the CODE class (classes can span
|
||||||
|
multiple physical segments)
|
||||||
|
* re-add _TEXT to LGROUP to be able to simplify the patchobj magic
|
||||||
|
* don't specify -zPI_GROUP for the init code in Borland compilers
|
||||||
|
(unnecessary, it will be put there because of segs.inc)
|
||||||
|
* remove STDPATCH; it is no longer necessary
|
||||||
|
* add FILESHIGH, LASTDRIVEHIGH, and STACKSHIGH and DOSDATA=UMB
|
||||||
|
to load these structures into UMBs
|
||||||
|
* make DOS sub-MCBs visible (seen by MEM)
|
||||||
|
* preliminary allocation of FILES etc. now takes place at the
|
||||||
|
top of conventional memory, and device drivers are loaded before
|
||||||
|
the final allocation takes place.
|
||||||
|
* handle multiple UMBs more correctly (but config.sys can use
|
||||||
|
only one UMB for devicehigh -- /Ln,xxxx is not yet implemented)
|
||||||
|
* minor size optimizations in chario.c, dosfns.c;
|
||||||
|
asmsupt.asm: correct fmemchr (all n's) and *memset/*memcpy (n==0)
|
||||||
|
185 relocs, 54 not shown
|
||||||
|
2003 Mar 14 - Build 2029
|
||||||
-------- Bart Oldeman (bart@dosemu.org)
|
-------- Bart Oldeman (bart@dosemu.org)
|
||||||
+ Changes Tom
|
+ Changes Tom
|
||||||
* fattab.c, fat.h removed the wrong ELSE_ISFAT32()
|
* fattab.c, fat.h removed the wrong ELSE_ISFAT32()
|
||||||
|
@ -12,7 +12,16 @@
|
|||||||
SkipConfigSeconds:
|
SkipConfigSeconds:
|
||||||
< 0 : not possible to skip config.sys
|
< 0 : not possible to skip config.sys
|
||||||
= 0 : only possible if already pressed before, no message
|
= 0 : only possible if already pressed before, no message
|
||||||
> 0 : wait so long for F5/F8
|
> 0 : wait so long for F5/F8
|
||||||
|
|
||||||
|
BootHarddiskSeconds: boots by default - and without user interaction - from HD
|
||||||
|
<= 0: normal
|
||||||
|
> 0:
|
||||||
|
display message
|
||||||
|
' hit any key to continue to boot from 'diskette or CD'
|
||||||
|
wait ## seconds
|
||||||
|
if no key hit, boot from HD
|
||||||
|
|
||||||
*/
|
*/
|
||||||
typedef struct _KernelConfig {
|
typedef struct _KernelConfig {
|
||||||
char CONFIG[6]; /* "CONFIG" */
|
char CONFIG[6]; /* "CONFIG" */
|
||||||
@ -23,4 +32,5 @@ typedef struct _KernelConfig {
|
|||||||
signed char SkipConfigSeconds;
|
signed char SkipConfigSeconds;
|
||||||
unsigned char ForceLBA;
|
unsigned char ForceLBA;
|
||||||
unsigned char GlobalEnableLBAsupport; /* = 0 --> disable LBA support */
|
unsigned char GlobalEnableLBAsupport; /* = 0 --> disable LBA support */
|
||||||
|
signed char BootHarddiskSeconds;
|
||||||
} KernelConfig;
|
} KernelConfig;
|
||||||
|
@ -695,7 +695,7 @@ STATIC ULONG GetBiosTime(VOID)
|
|||||||
return *(ULONG FAR *) (MK_FP(0x40, 0x6c));
|
return *(ULONG FAR *) (MK_FP(0x40, 0x6c));
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC UWORD GetBiosKey(int timeout)
|
UWORD GetBiosKey(int timeout)
|
||||||
{
|
{
|
||||||
iregs r;
|
iregs r;
|
||||||
|
|
||||||
@ -2421,3 +2421,4 @@ VOID DoInstall(void)
|
|||||||
InstallPrintf(("Done with installing commands\n"));
|
InstallPrintf(("Done with installing commands\n"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
101
kernel/main.c
101
kernel/main.c
@ -74,7 +74,7 @@ static BYTE *mainRcsId =
|
|||||||
"$Id$";
|
"$Id$";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct _KernelConfig InitKernelConfig = { "", 0, 0, 0, 0, 0, 0 };
|
struct _KernelConfig InitKernelConfig = { "", 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
extern WORD days[2][13];
|
extern WORD days[2][13];
|
||||||
extern BYTE FAR *lpOldTop;
|
extern BYTE FAR *lpOldTop;
|
||||||
@ -90,6 +90,7 @@ STATIC VOID signon(VOID);
|
|||||||
STATIC VOID kernel(VOID);
|
STATIC VOID kernel(VOID);
|
||||||
STATIC VOID FsConfig(VOID);
|
STATIC VOID FsConfig(VOID);
|
||||||
STATIC VOID InitPrinters(VOID);
|
STATIC VOID InitPrinters(VOID);
|
||||||
|
void CheckContinueBootFromHarddisk();
|
||||||
|
|
||||||
extern void Init_clk_driver(void);
|
extern void Init_clk_driver(void);
|
||||||
|
|
||||||
@ -132,6 +133,8 @@ void fmemcpy(void far *dest, const void far *src, unsigned n)
|
|||||||
while(n--) *d++ = *s++;
|
while(n--) *d++ = *s++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CheckContinueBootFromHarddisk(void);
|
||||||
|
|
||||||
VOID ASMCFUNC FreeDOSmain(void)
|
VOID ASMCFUNC FreeDOSmain(void)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
@ -164,11 +167,20 @@ VOID ASMCFUNC FreeDOSmain(void)
|
|||||||
fmemcpy(&InitKernelConfig, &LowKernelConfig, sizeof(InitKernelConfig));
|
fmemcpy(&InitKernelConfig, &LowKernelConfig, sizeof(InitKernelConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
setvec(0, int0_handler); /* zero divide */
|
setvec(0, int0_handler); /* zero divide */
|
||||||
setvec(1, empty_handler); /* single step */
|
setvec(1, empty_handler); /* single step */
|
||||||
setvec(3, empty_handler); /* debug breakpoint */
|
setvec(3, empty_handler); /* debug breakpoint */
|
||||||
setvec(6, int6_handler); /* invalid opcode */
|
setvec(6, int6_handler); /* invalid opcode */
|
||||||
|
|
||||||
|
|
||||||
|
CheckContinueBootFromHarddisk();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* clear the Init BSS area (what normally the RTL does */
|
/* clear the Init BSS area (what normally the RTL does */
|
||||||
memset(_ib_start, 0, _ib_end - _ib_start);
|
memset(_ib_start, 0, _ib_end - _ib_start);
|
||||||
|
|
||||||
@ -630,3 +642,90 @@ STATIC VOID InitPrinters(VOID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*****************************************************************
|
||||||
|
if kernel.config.BootHarddiskSeconds is set,
|
||||||
|
the default is to boot from harddisk, because
|
||||||
|
the user is assumed to just have forgotten to
|
||||||
|
remove the floppy/bootable CD from the drive.
|
||||||
|
|
||||||
|
user has some seconds to hit ANY key to continue
|
||||||
|
to boot from floppy/cd, else the system is
|
||||||
|
booted from HD
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern UWORD GetBiosKey(int timeout);
|
||||||
|
|
||||||
|
EmulatedDriveStatus(int drive,char statusOnly)
|
||||||
|
{
|
||||||
|
iregs r;
|
||||||
|
char buffer[13];
|
||||||
|
buffer[0] = 0x13;
|
||||||
|
|
||||||
|
r.a.b.h = 0x4b; /* bootable CDROM - get status */
|
||||||
|
r.a.b.l = statusOnly;
|
||||||
|
r.d.b.l = (char)drive;
|
||||||
|
r.si = (int)buffer;
|
||||||
|
init_call_intr(0x13, &r);
|
||||||
|
|
||||||
|
if (r.flags & 1)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckContinueBootFromHarddisk(void)
|
||||||
|
{
|
||||||
|
char *bootedFrom = "CD";
|
||||||
|
iregs r;
|
||||||
|
|
||||||
|
if (InitKernelConfig.BootHarddiskSeconds == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (BootDrive >= 3)
|
||||||
|
{
|
||||||
|
if (!EmulatedDriveStatus(0x80,1))
|
||||||
|
{
|
||||||
|
/* already booted from HD */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!EmulatedDriveStatus(0x00,1))
|
||||||
|
bootedFrom = "Floppy";
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n"
|
||||||
|
"\n"
|
||||||
|
"\n"
|
||||||
|
" Hit any key within %d seconds to continue booot from %s\n"
|
||||||
|
" else continue to boot from Harddisk\n",
|
||||||
|
InitKernelConfig.BootHarddiskSeconds,
|
||||||
|
bootedFrom
|
||||||
|
);
|
||||||
|
|
||||||
|
if (GetBiosKey(InitKernelConfig.BootHarddiskSeconds) != -1)
|
||||||
|
{
|
||||||
|
/* user has hit a key, continue to boot from floppy/CD */
|
||||||
|
printf("\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* reboot from harddisk */
|
||||||
|
EmulatedDriveStatus(0x00,0);
|
||||||
|
EmulatedDriveStatus(0x80,0);
|
||||||
|
|
||||||
|
/* now jump and run */
|
||||||
|
r.a.x = 0x0201;
|
||||||
|
r.c.x = 0x0001;
|
||||||
|
r.d.x = 0x0080;
|
||||||
|
r.b.x = 0x7c00;
|
||||||
|
r.es = 0;
|
||||||
|
|
||||||
|
init_call_intr(0x13, &r);
|
||||||
|
|
||||||
|
{
|
||||||
|
void (far *reboot)() = (void (far*)()) MK_FP(0x0,0x7c00);
|
||||||
|
|
||||||
|
(*reboot)();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
libm.lib: $(CLIB)
|
libm.lib: $(CLIB)
|
||||||
-$(RM) libm.lib
|
-$(RM) libm.lib
|
||||||
$(LIBUTIL) $(CLIB) $(MATH_EXTRACT) $(LIBTERM)
|
$(LIBUTIL) $(CLIB) $(MATH_EXTRACT) $(LIBTERM)
|
||||||
for %i in (*.obj) do ..\utils\patchobj CODE=LCODE TEXT=_LOWTEXT %i
|
for %i in (*.obj) do ..\utils\patchobj CODE=LCODE %i
|
||||||
$(LIBUTIL) libm $(MATH_INSERT) $(LIBTERM)
|
$(LIBUTIL) libm $(MATH_INSERT) $(LIBTERM)
|
||||||
-$(RM) *.OBJ
|
-$(RM) *.OBJ
|
||||||
|
|
||||||
|
@ -182,6 +182,13 @@ void displayConfigSettings(KernelConfig * cfg)
|
|||||||
cfg->GlobalEnableLBAsupport);
|
cfg->GlobalEnableLBAsupport);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cfg->ConfigSize >= 6)
|
||||||
|
{
|
||||||
|
printf
|
||||||
|
("BootHarddiskSeconds=%d : *0=no else seconds to wait for key\n",
|
||||||
|
cfg->BootHarddiskSeconds);
|
||||||
|
}
|
||||||
|
|
||||||
#if 0 /* we assume that SYS is as current as the kernel */
|
#if 0 /* we assume that SYS is as current as the kernel */
|
||||||
|
|
||||||
/* Print value any options added that are unknown as hex dump */
|
/* Print value any options added that are unknown as hex dump */
|
||||||
@ -432,6 +439,11 @@ int FDKrnConfigMain(int argc, char **argv)
|
|||||||
setByteOption(&(cfg.GlobalEnableLBAsupport),
|
setByteOption(&(cfg.GlobalEnableLBAsupport),
|
||||||
cptr, 1, &updates, "GLOBALENABLELBASUPPORT");
|
cptr, 1, &updates, "GLOBALENABLELBASUPPORT");
|
||||||
}
|
}
|
||||||
|
else if (memicmp(argptr, "BootHarddiskSeconds", 3) == 0)
|
||||||
|
{
|
||||||
|
setSByteOption(&(cfg.BootHarddiskSeconds),
|
||||||
|
cptr, 0, 127, &updates, "BootHarddiskSeconds");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
illegal_arg:
|
illegal_arg:
|
||||||
|
@ -241,7 +241,9 @@ int main(int argc, char **argv)
|
|||||||
2, /* SkipConfigSeconds db 2 */
|
2, /* SkipConfigSeconds db 2 */
|
||||||
0, /* ForceLBA db 0 */
|
0, /* ForceLBA db 0 */
|
||||||
1, /* GlobalEnableLBAsupport db 1 */
|
1, /* GlobalEnableLBAsupport db 1 */
|
||||||
'u', 'n', 'u', 's', 'e', 'd', /* unused filler bytes */
|
0, /* BootHarddiskSeconds */
|
||||||
|
|
||||||
|
'n', 'u', 's', 'e', 'd', /* unused filler bytes */
|
||||||
8, 7, 6, 5, 4, 3, 2, 1,
|
8, 7, 6, 5, 4, 3, 2, 1,
|
||||||
/* real-entry: jump over the 'real' image do the trailer */
|
/* real-entry: jump over the 'real' image do the trailer */
|
||||||
0xe9, 0, 0 /* 100: jmp 103 */
|
0xe9, 0, 0 /* 100: jmp 103 */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user