fix bug# 98 (correct bad CONFIG value 19 with bad value 14, should be 6) and add support for additional CONFIG options Verbose and PartitionMode to sys CONFIG processing

This commit is contained in:
Kenneth J Davis 2023-12-19 19:50:22 -05:00
parent d027c797a0
commit 569337a7ef
No known key found for this signature in database
GPG Key ID: 59D5F216C38F11FD
3 changed files with 51 additions and 11 deletions

View File

@ -28,6 +28,22 @@
Revision: revision sequence, e.g. 42 for kernel 2042
Release: 0 if released version, >0 for svn builds (e.g. svn revision #)
CheckDebugger: during initialization enable/disable check to stop in debugger if one is active
0 = do not check (assume absent),
1 = do check by running breakpoint,
2 = assume present
Verbose: amount of messages to display during initialization
-1 = quiet
0 = normal
1 = verbose
PartitionMode: how to handle GPT and MBR partitions
bits 0-1: 01=GPT if found, 00=MBR if found, 11=Hybrid, GPT first then MBR, 10=Hybrid, MBR first then GPT
in hybrid mode, EE partitions ignored, drives assigned by GPT or MBR first based on hybrid type
bits 2-4: 001=mount ESP (usually FAT32) partition, 010=mount MS Basic partitions, 100=mount unknown partitions
111=attempt to mount all paritions, 110=attempt to mount all but ESP partitions
bits 5-7: reserved, 0 else undefined behavior
*/
typedef struct _KernelConfig {
char CONFIG[6]; /* "CONFIG" */
@ -46,10 +62,8 @@ typedef struct _KernelConfig {
unsigned short Version_Revision;
unsigned short Version_Release;
/* for version 2044 and higher only */
unsigned char CheckDebugger;
/* 0 = do not check (assume absent),
1 = do check by running breakpoint,
2 = assume present */
signed char Verbose; /* -1 = quiet, 0 = normal, 1 = verbose */
signed char Verbose;
unsigned char PartitionMode;
} KernelConfig;

View File

@ -79,6 +79,13 @@ Version_Release dw 1 ; 0=release build, >0=svn#
CheckDebugger: db 0 ; 0 = no check, 1 = check, 2 = assume present
Verbose db 0 ; -1 = quiet, 0 = normal, 1 = verbose
PartitionMode db 0x1f ; bits 0-1: 01=GPT if found, 00=MBR if found, 11=Hybrid, GPT first then MBR, 10=Hybrid, MBR first then GPT
; in hybrid mode, EE partitions ignored, drives assigned by GPT or MBR first based on hybrid type
; bits 2-4: 001=mount ESP (usually FAT32) partition, 010=mount MS Basic partitions, 100=mount unknown partitions
; 111=attempt to mount all paritions, 110=attempt to mount all but ESP partitions
; bits 5-7: reserved, 0 else undefined behavior
configend:
kernel_config_size: equ configend - config_signature
; must be below-or-equal the size of struct _KernelConfig

View File

@ -13,7 +13,7 @@
* merged into SYS by tom ehlert *
***************************************************************************/
char VERSION[] = "v1.04";
char VERSION[] = "v1.05";
char PROGRAM[] = "SYS CONFIG";
char KERNEL[] = "KERNEL.SYS";
@ -134,9 +134,21 @@ int readConfigSettings(int kfile, char *kfilename, KernelConfig * cfg)
exit(1);
}
/* check if config settings old UPX header and adjust */
if (cfg->ConfigSize == 19)
cfg->ConfigSize = 14; /* ignore 'nused87654321' */
/* check if config settings old UPX header and adjust
original UPX header incorrectly set size value to 19,
a while back this was fixed and if we ran across a kernel
with the wrong value we would update it to 14. Another bug,
the correct value is 6 (possibly 5 if kernel old enough, but
we can safely ignore the 'u' value for BootHarddiskSeconds
as it won't be used if the kernel doesn't support that option.
The "corrected size" incorrectly included the 8 bytes of the CONFIG
header ['C','O','N','F','I','G' + WORD ConfigSize ].
14 was never valid for a released kernel, so we can safely
assume 13 is valid, 15-18 is valid, and >= 20 valid but
that a value of 14 or 19 should really be 6.
*/
if ((cfg->ConfigSize == 19) || (cfg->ConfigSize == 14))
cfg->ConfigSize = 6; /* ignore 'nused87654321' */
return 1;
}
@ -169,7 +181,7 @@ void displayConfigSettings(KernelConfig * cfg)
printf
("%s kernel %s (build %d.%d OEM:%02X)\n",
(cfg->Version_OemID == 0xFD)?"FreeDOS":"DOS-C",
cfg->Version_Release?"SVN":"Release",
cfg->Version_Release?"Nightly":"Release",
cfg->Version_Major,
cfg->Version_Revision,
cfg->Version_OemID
@ -228,9 +240,16 @@ void displayConfigSettings(KernelConfig * cfg)
if (cfg->ConfigSize >= 14)
{
printf
("Verbose=%d : -1=quiet, *0=normal, 1=verbose\n",
("Verbose=%d : -1=quiet, *0=normal, 1=verbose\n",
cfg->Verbose);
}
if (cfg->ConfigSize >= 15)
{
printf
("PartitionMode=0x%02X How GPT or hybrid GPT/MBR partitions used\n",
cfg->PartitionMode);
}
#if 0 /* we assume that SYS is as current as the kernel */