Hello all,

I've found what seems an odd bug in the kernel (version 2035) while
testing a first alpha version of nlsfunc and it is driving me mad:

In nls.c:muxLoadPkg(), the value of cp becomes 0 right after the first
call to muxGo() (the one that does the installation check).

It seems as if the stack is trashed somewhere, but I'm not able to see
where or how. I have observed the same results with OpenWatcom 1.2 and
Turbo C++ 1.01. I've also tested with two different versions of nasm
(precompiled 16bit binaries of versions 0.98.38 and 0.98.36) with no
luck.

Adding traces affects the bug itself (trashes a different variable), so
I've made a simple TSR (nlsfoo.com) that implements a couple of nlsfunc
calls (installation check and set code page) The first one prints the
value of the BP register and, the second, the contents of BX.

With an unmodified kernel, install nlsfoo.com and execute testchcp.exe
(link below, does the same that CHCP 850, but chcp was broken in freecom
until very recently) and you'll see:
0000
0000

The first 0000 is correct (the kernel passes 0 in BP), but the second is
wrong (BX should contain the codepage, i.e. 0352h). Apply the patch
below to the kernel (nls.c), which passes the codepage in BP to the
nlsfunc installation check and the result is
0352
0352

As you see, in this case the correct value is shown in both cases :-O 


My setup:

Kernel 2035, compiled with any combination of OpenWatcom 1.2, Turbo C++
1.01 and NASM versions 0.98.36 and 0.98.38. Tested in dosemu 1.2.1. 

Links to test programs:

http://perso.wanadoo.es/samelborp/testchcp.exe
http://perso.wanadoo.es/samelborp/testchcp.c
http://perso.wanadoo.es/samelborp/nlsfoo.com
http://perso.wanadoo.es/samelborp/nlsfoo.asm

Kernel patch (for testing purposes):

-- ke2035.orig/kernel/nls.c 2004-06-24 13:41:18.000000000 +0200
+++ ke2035/kernel/nls.c 2004-07-22 10:37:37.000000000 +0200
@@ -122,7 +122,7 @@ COUNT muxLoadPkg(UWORD cp, UWORD cntry)
   /* make sure the NLSFUNC ID is updated */
#error "NLS_FREEDOS_NLSFUNC_VERSION == NLS_FREEDOS_NLSFUNC_ID"
#endif
-  if (muxGo(0, 0, NLS_FREEDOS_NLSFUNC_VERSION, 0,
NLS_FREEDOS_NLSFUNC_ID, 0,
+  if (muxGo(0, cp, NLS_FREEDOS_NLSFUNC_VERSION, 0,
NLS_FREEDOS_NLSFUNC_ID, 0,
             (UWORD *)&id) != 0x14ff)
     return DE_FILENOTFND;       /* No NLSFUNC --> no load */
   if (id != NLS_FREEDOS_NLSFUNC_ID)   /* FreeDOS NLSFUNC will return */


TIA and sorry for the long post.
Eduardo.





-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to