Hi Bret & list,

I found the problem. Both TESTPASS and TESTFAIL failed in my test  
environment, but that doesn't matter. The kernel does not correctly  
allocate MCBs for its configuration and initialization program code. The  
code that an application loaded by INSTALL= returns to via termination  
(pointed to by Int22) is in free memory. Your TSR relocates its  
installation code to the top of the low memory area as allocatable with  
Int21.58 and .48 calls. Thus, it overwrites some of the kernel's  
config/init code.

For application developers (ie Bret):
You can probably work around that by allocating 64 KiB (or something like  
that) too much for the relocated installation code. (I recommend to retry  
with the usual required size if the size+1000h 21.48 call fails.) If you  
don't modify this part (but free it as usual) that should do it for now.  
Please test.

A check for affected FreeDOS builds could be done by checking whether  
Int22 points into unallocated memory.

For kernel developers (I guess cross-posting this to -kernel is not  
necessary):
The interrupt 22h handler is at address 8F8Eh:AB67h (at least with the  
supplied kernel binary, build 2038, from 2009-05-16, WATCOMC, FAT32, and  
in my test environment) for the application loaded with INSTALL=. This  
segmented address is at the linear address 9A447h (= segmented  
9A44h:0007h). The only visible allocation of the kernel (owner = 60h)  
during this time is at segment 9DD8h (MCB at 9DD7h), and its size is 227h  
paragraphs. (The next MCB is the one at 9FFFh.)

The affected functions are DoInstall, InstallExec, and init_DosExec, which  
call down in that order. init_DosExec is in intr.asm, the others are in  
config.c. init_DosExec calls Int21.4B, ie Int22 points to its code. All of  
these functions execute in unallocated memory, though most others in  
config.c probably do too. In my tests, Bret's application didn't overwrite  
InstallExec and init_DosExec but that depends entirely on how much memory  
the application uses. (DoInstall had been overwritten.)

I tested this again with build 2039, from 2010-08-01, WATCOMC, FAT32,  
which is the latest kernel binary on the FreeDOS mirrors. In this case,  
Int22 is at 9016h:A098h (linear 9A1F8h) and the kernel allocation is at  
9DC9h. The SVN repo does not appear to contain changes that might affect  
this problem.

Please release a stable build as soon as you have fixed that bug!

Regards,
Christian

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to