www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/08/22/09:34:21

From: Mathias Grimmberger <mathias AT eas DOT iis DOT fhg DOT de>
Date: Mon, 22 Aug 94 10:34:43 +0200
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Problems with go32 1.12 swapping


Hi folks,

I have to report a problem with go32 1.12. Sorry if it is already known,
I haven't subscribed to the mailing list (yet).

The problem prevents cc1plus (and may be other tools) from running
correctly. It causes an endless loop so I can't compile C++. I found the
problem trying to compile a small program (probably you know it ;-)):

#include <iostream.h>

int main( void )
{
  cout << "Hello World!" << endl;
  return 0;
}

Some info about the system used:

486 40MHz, 8 Mbytes RAM, AMI HiFlex BIOS, SVGA
CPU in Real Mode (*no* EMM386, QEMM or so thus no DPMI nor VCPI)
HIMEM.SYS installed - XMS available
(problem has been confirmed on an old 386SX 16)

Using this configuration the program above can't be compiled. With env
var GO32 set to 'topline' you see that on running cc1plus there seems to
be a problem with swapping/paging. At the right side there are 3 numbers
about memory usage (I guess, no time to figure this out correctly). The
leftmost of this three (the red one) goes up to above 300k and is
changing all the time, the next stucks at 316k and the last at 16k.
IMPORTANT: If I install EMM386, QEMM or use gcc from a Windows DOS box
all will run fine, thus the problem is only there if *no* VCPI/DPMI
available.

If I try it without any drivers it will run until cc1plus writes the
assembler source, then it fails with a segmentation violation. Error
message (probably not very interesting):

Segmentation violation in pointer 0x00000000 at d8:10b82
eax=00000300 ebx=00000021 ecx=00000000 edx=00000000 esi=00000000 edi=00000001
ebp=7ffff890 esp=7ffff874 cs=d8 ds=48 es=48 fs=48 gs=48 ss=48 cr2=00000000
Call frame traceback EIPs:
  0x00010b82

I spent some time to find out some more info and may be a workaround -
there are possibilities to fix:
- simply use go32 1.11maint5 (stubediting all executables of 1.12)
  or hack up sources of go32 1.11maint5 to identify as 1.12
- use file 'paging.c' of 1.11maint5 and the others from 1.12 to build
  go32
- change line 1101 in file paging.c of 1.12 to read
  kept_on_exec = 0;         instead  of
  kept_on_exec = (valloc_used()*4096 <= stub_info.max_keep_on_spawn);
  This hack seems to be the best temporary solution.

I understand that all this changes disable 'keep_on_exec' feature.  This
hacked go32 seems to work with all configurations. The problem seems to
be related to the 'keep_on_exec' feature, wich is disabled in 1.11maint5
'paging.c'. Enabling it (by #defining KEEP_ON_EXEC) lets 1.11maint5 fail
the same way as 1.12.

I hope this info is of some use to fix the problem. If there already is
a solution I would be happy to hear about it.

By playing around with this hacked go32 I found another bug. In file
'control.c' in function 'set_command_line' the local var 'argc' is used
before it is initialized (BCC 3.1 gives a warning about that). This bug
caused some programs to abort by issuing 'Fatal! no memory to copy
arguments (max 1000, wanted <negative number here>)'. For some magic
reason the original go32 1.12 doesn't have the problem, seems as if argc
is accidentally initialized to some small number with TCC (I used BCC
3.1, TASM 3.1 and TLINK 5.1).

And another thing: may be it should be mentioned in some README that the
TMPDIR and GO32TMP env vars must not be set to the root dir of a disk
(e.g. d:/) because that fools at least 'patch.exe' on creating it's
temp files (it already has a slash prepended, thus giving something like
'd://patcho000034' as file name).

Diffs for changed sources (diff -C 2 <orgfile> <hackedfile>):

GO32/CONTROL.C

-------------------------snip snap--------------------------------------
*** go32.org\control.c	Sun Jul 31 01:20:38 1994
--- go32\control.c	Sun Aug 21 20:49:54 1994
***************
*** 1090,1093 ****
--- 1090,1096 ----
  
    a = (word32 *)transfer_buffer;
+ /* *MGri* change */
+   for (argc=0; argv[argc]; argc++);
+ /* end *MGri* change */
    if (argc > 1000)
    {
-------------------------snip snap--------------------------------------


GO32/PAGING.C

-------------------------snip snap--------------------------------------
*** go32.org\paging.c	Sun Jul 31 00:44:08 1994
--- go32\paging.c	Sun Aug 21 20:50:40 1994
***************
*** 1099,1103 ****
    fInPageOutEverything = 1;
  
!   kept_on_exec = (valloc_used()*4096 <= stub_info.max_keep_on_spawn);
    if (!kept_on_exec)
      while (page_out(-1) != 0xffff)
--- 1099,1106 ----
    fInPageOutEverything = 1;
  
! /* *MGri* change */
! /*  kept_on_exec = (valloc_used()*4096 <= stub_info.max_keep_on_spawn); */
!   kept_on_exec = 0; /* force swapping out everything */
! /* end *MGri* change */
    if (!kept_on_exec)
      while (page_out(-1) != 0xffff)
-------------------------snip snap--------------------------------------


Last but not least: Many thanks to all people working on DJGPP - it's
great stuff!

---
Best regards, Mathias Grimmberger

mathias AT eas DOT iis DOT fhg DOT de

PS: My EMail address is only valid until end of September this year :-(.

-------------------------------------------------------------------------------
Mathias Grimmberger (Student)       |                If this was in bad english
FhG IIS EAS Dresden                 |                    sorry - I'm too stupid
Germany                             |                       to do a better job.
-------------------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019