config: bugfix, make struct array configcommands static (fixes #73)

A crash was introduced by the prior commit, ee255d2. I
tested that the kernel still did build with gcc, but I
failed to test whether it also still runs. Turns out that
apparently changing the pointers to static made it so gcc
put the structure into the init data segment and
implicitly called memcpy to put it on the stack. That's
wrong, however. We depend on #define to convert all calls
in init to the init text copies of memcpy etc. The
implicit call by gcc however attempts to call the HMA text
copy of memcpy which happens to be at another offset.

The fix is to make the entire array of structs static so
that memory for it is allocated only in the init data
segment, not on the stack. This seems to work for both
gcc and OpenWatcom (no warnings, it builds, it runs).
This commit is contained in:
C. Masloch 2022-05-22 11:10:44 +02:00 committed by Kenneth J Davis
parent ee255d2355
commit 8e6fc98a94
1 changed files with 1 additions and 1 deletions

View File

@ -869,7 +869,7 @@ VOID DoConfig(int nPass)
static char * configfile = "";
static char * altconfigfile = "fdconfig.sys";
static char * oldconfigfile = "config.sys";
struct { char ** pointer; char const * command; }
static struct { char ** pointer; char const * command; }
configcommands[] = {
{ &configfile, "CONFIG" },
{ &altconfigfile, "ALTCONFIG" },