Re: [Freedos-kernel] state of kernel 2038
2009/2/17 Eric Auer e.a...@jpberlin.de: /* clear the Init BSS area (what normally the RTL does */ memset(_ib_start, 0, _ib_end - _ib_start); Maybe this broke when Bart tuned the memory model recently? Remember for example JEMM386 int 19 fastboot compatible storage of original pointers of hooked BIOS intr here... As quite a few BIOSes also clear the RAM, it would be plausible that a bug in this area could stay undetected for quite a while? in both cases the variable ends up as 0 Not for RayeR, apparently: Some variables were nonzero in initdisk. if this makes any difference, either the memset() memset above doesn't work or the error relates to the actual placement of the variable in the DATA segment. usually an overwriting problem or similar. good luck hunting if it's the latter As RayeR was able to fix the symptom by using BSS_INIT(x) = x style for the macro, I hope that if it is the latter his fix would have broken something else, so I believe that the memset has a problem. I don't see it: even when tracing with DOSEMU's debugger dosdebug: t Trap 1, system state: emulated,stopped AX= BX=0206 CX=0e7c DX=0a04 SI= DI=0fdc SP=2240 BP=224c DS=9dd9 ES=9dd9 FS= GS= FL=3312 CS:IP=9062:9c5f SS:SP=9dd9:2240 9062:9c5f 88C4 mov ah,al t Trap 1, system state: emulated,stopped AX= BX=0206 CX=0e7c DX=0a04 SI= DI=0fdc SP=2240 BP=224c DS=9dd9 ES=9dd9 FS= GS= FL=3312 CS:IP=9062:9c61 SS:SP=9dd9:2240 9062:9c61 D1E9 shr cx,1 t Trap 1, system state: emulated,stopped AX= BX=0206 CX=073e DX=0a04 SI= DI=0fdc SP=2240 BP=224c DS=9dd9 ES=9dd9 FS= GS= FL=3312 CS:IP=9062:9c63 SS:SP=9dd9:2240 9062:9c63 F3AB repe stosw rep stosw is called for the correct values compared to kernel.map and the kernel boots fine. (OW 1.8, current SVN stable kernel source) So which initdisk variables do you refer too? Where are they in kernel.map? Bart -- Register Now Save for Velocity, the Web Performance Operations Conference from O'Reilly Media. Velocity features a full day of expert-led, hands-on workshops and two days of sessions from industry leaders in dedicated Performance Operations tracks. Use code vel09scf and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf ___ Freedos-kernel mailing list Freedos-kernel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-kernel
Re: [Freedos-kernel] state of kernel 2038
- int 21.1c should report invalid drives via AL (keep other regs?) News here: DR-DOS modifies BX/CX/DX but not DS for inv drives. /* Get Drive Data */ case 0x1c: { BYTE FAR *p; if (p = FatGetDrvData(lr.DL, lr.AL, lr.CX, lr.DX) != NULL) { lr.DS = FP_SEG(p); lr.BX = FP_OFF(p); } else lr.AL = 0xff; } break; should get the job done Unfortunately I do not know to what value DR DOS sets BX/CX/DX, only got the information that they looked kind of random... MS-DOS is the king, and it lets all registers unchanged. more a DR-DOS bug then anything else In any case AL has to be set to -1 to flag invalid drives :-) right. - CHS calculations are off by 1 and overflowing (thanks Rayer) If your BIOS has no LBA, this was probably a real pain for you. any details about this ? like the original email ('thanks Rayer' is not enough of a description) The discussion is spread over mail and chat, but this is certainly in the kernel mailing list, isn't it ? - the BSS_INIT macro is bogus (thanks Rayer) any details about this ? like the original email ('thanks Rayer' is not enough of a description) Here is the relevant part of RayeR's kernel: diff -bur freedos/kernel/init-mod.h rayer/kernel/init-mod.h --- freedos/kernel/init-mod.h 2007-09-07 14:32:05.0 +0200 +++ rayer/kernel/init-mod.h 2008-11-30 20:55:58.0 +0100 @@ -32,8 +32,9 @@ These guys are marked BSS_INIT to mark that they really should be BSS but can't be because of MS + Seems to be needed also for Watcom C 11.x */ -#ifdef _MSC_VER +#if ((defined _MSC_VER) || (defined __WATCOMC__)) #define BSS_INIT(x) = x #else #define BSS_INIT(x) I personally would suggest to always have BSS_INIT(x) = x and not only for certain compilers. After all, the kernel is not a normal program so compiler-specific BSS clearing code is usually not triggered... Thanks for commenting :-) some comment is necessary; introduction into the crazy memory model ;) it shouldn't matter if int SomeVariable; or int SomeVariable = 0; is declared. in the former case it is put into the BSS segment, and initialized by the runtime libray. As we don't have the normal runtime library, we do it in main.c /* clear the Init BSS area (what normally the RTL does */ memset(_ib_start, 0, _ib_end - _ib_start); (I verified that this at least seems to do something reasonable) in the latter case it is put into the DATA segment, and initialized with static data. in both cases the variable ends up as 0 if this makes any difference, either the memset() memset above doesn't work or the error relates to the actual placement of the variable in the DATA segment. usually an overwriting problem or similar. good luck hunting if it's the latter -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ Freedos-kernel mailing list Freedos-kernel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-kernel
Re: [Freedos-kernel] state of kernel 2038
Here is the IsShareInstalled patch which also does not seem to be commited to SVN yet?? The goal is to reduce the share install check call floods that FreeDOS would normally cause. The side effect is minimally later detection of share, should be fine. Thanks for commenting :-) Eric diff -bur freedos/kernel/dosfns.c rayer/kernel/dosfns.c --- freedos/kernel/dosfns.c 2007-07-28 18:40:25.0 +0200 +++ rayer/kernel/dosfns.c 2008-11-30 18:38:06.0 +0100 @@ -289,7 +289,7 @@ /* a block transfer */ /* /// Added for SHARE - Ron Cemer */ - if (IsShareInstalled() (s-sft_shroff = 0)) + if (IsShareInstalled(FALSE) (s-sft_shroff = 0)) { int rc = share_access_check(cu_psp, s-sft_shroff, s-sft_posit, (unsigned long)n, 1); @@ -581,7 +581,7 @@ } /* /// Added for SHARE. - Ron Cemer */ - if (IsShareInstalled()) + if (IsShareInstalled(TRUE)) { if ((sftp-sft_shroff = share_open_check(PriPathName, cu_psp, @@ -625,7 +625,7 @@ else { /* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */ -if (IsShareInstalled()) +if (IsShareInstalled(TRUE)) { share_close_file(sftp-sft_shroff); sftp-sft_shroff = -1; @@ -755,7 +755,7 @@ return dos_commit(sftp-sft_status); /* /// Added for SHARE *** CURLY BRACES ADDED ALSO!!! ***. - Ron Cemer */ - if (IsShareInstalled()) + if (IsShareInstalled(TRUE)) { if (sftp-sft_shroff = 0) share_close_file(sftp-sft_shroff); @@ -1354,7 +1354,7 @@ return remote_lock_unlock(s, pos, len, unlock); /* Invalid function unless SHARE is installed or remote. */ - if (!IsShareInstalled()) + if (!IsShareInstalled(FALSE)) return DE_INVLDFUNC; /* Lock violation if this SFT entry does not support locking. */ @@ -1444,10 +1444,13 @@ } /* /// Added for SHARE. - Ron Cemer */ +/* Eric 8/2008: only re-check (2f.1000) on open/close, not on each access */ -BOOL IsShareInstalled(void) +BOOL IsShareInstalled(BOOL recheck) { extern unsigned char ASMPASCAL share_check(void); + if (recheck == FALSE) +return share_installed; if (!share_installed share_check() == 0xff) share_installed = TRUE; return share_installed; diff -bur freedos/kernel/fatfs.c rayer/kernel/fatfs.c --- freedos/kernel/fatfs.c 2008-04-04 17:36:58.0 +0200 +++ rayer/kernel/fatfs.c2008-11-30 18:34:28.0 +0100 @@ -447,7 +447,7 @@ f_node_ptr fnp2; int i, fd; - if (!IsShareInstalled()) + if (!IsShareInstalled(FALSE)) return; fd = xlt_fnp(fnp); --- freedos/kernel/proto.h 2008-04-04 17:36:58.0 +0200 +++ rayer/kernel/proto.h2008-11-30 18:34:56.0 +0100 @@ -112,7 +112,7 @@ COUNT DosRenameTrue(BYTE * path1, BYTE * path2, int attrib); COUNT DosMkRmdir(const char FAR * dir, int action); struct dhdr FAR *IsDevice(const char FAR * FileName); -BOOL IsShareInstalled(void); +BOOL IsShareInstalled(BOOL recheck); COUNT DosLockUnlock(COUNT hndl, LONG pos, LONG len, COUNT unlock); int idx_to_sft_(int SftIndex); sft FAR *idx_to_sft(int SftIndex); -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ Freedos-kernel mailing list Freedos-kernel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-kernel
Re: [Freedos-kernel] state of kernel 2038
Hi Tom, here is one of two diffs for patches that I have not commited to SVN because I was waiting for review... Topic: Handle floppy type 6 and use DF_DISKCHANGE and DF_NOACCESS as well as InitializeAllBPBs in a way which should help disk tools to avoid confusion about FAT1x versus FAT32. Question: Are there any side effects? Thanks for commenting :-) Eric $ svn diff freedos/ Index: freedos/kernel/initdisk.c === --- freedos/kernel/initdisk.c (Revision 1365) +++ freedos/kernel/initdisk.c (Working Copy) @@ -318,7 +318,7 @@ type = regs.b.b.l - 1; if (regs.flags 1) type = 0; /* return 320-360 for XTs */ - else if (type 6) + else if (type = 6) type = 8; /* any odd ball drives get 87=0: the 320-360 table */ else if (type == 5) type = 4; /* 5 and 4 are both 2.88 MB */ @@ -577,7 +577,7 @@ if (nUnits = NDEV) { -printf(more Partitions detected then possible, max = %d\n, NDEV); +printf(more Partitions detected than possible, max = %d\n, NDEV); return; /* we are done */ } @@ -719,7 +719,7 @@ lba_bios_parameters.sectors 0x || lba_bios_parameters.totalSectHigh != 0) { -printf(Drive is too large to handle, using only 1st 8 GB\n +printf(LBA drive properties implausible, using only 1st 8 GB\n drive %02x heads %lu sectors %lu , total=0x%lx-%08lx\n, drive, (ULONG) lba_bios_parameters.heads, @@ -1269,7 +1269,7 @@ pddt-ddt_driveno = driveno; pddt-ddt_type = init_getdriveparm(driveno, pddt-ddt_defbpb); pddt-ddt_ncyl = (pddt-ddt_type 7) ? 80 : 40; - pddt-ddt_descflags = init_readdasd(driveno) | flags; + pddt-ddt_descflags = init_readdasd(driveno) | flags | DF_DISKCHANGE | DF_NOACCESS; pddt-ddt_offset = 0; pddt-ddt_serialno = 0x12345678l; Index: freedos/kernel/dsk.c === --- freedos/kernel/dsk.c(Revision 1365) +++ freedos/kernel/dsk.c(Working Copy) @@ -374,8 +374,8 @@ unsigned secs_per_cyl; WORD ret; - /* pddt-ddt_descflags |= DF_NOACCESS; - * disabled for now - problems with FORMAT ?? */ + pddt-ddt_descflags |= DF_NOACCESS; + /* was disabled - problems with FORMAT ?? */ /* set drive to not accessible and changed */ if (diskchange(pddt) != M_NOT_CHANGED) Index: freedos/kernel/main.c === --- freedos/kernel/main.c (Revision 1365) +++ freedos/kernel/main.c (Working Copy) @@ -126,14 +126,10 @@ } /* -InitializeAllBPBs() - -or MakeNortonDiskEditorHappy() - -it has been determined, that FDOS's BPB tables are initialized, -only when used (like DIR H:). -at least one known utility (norton DE) seems to access them directly. -ok, so we access for all drives, that the stuff gets build +InitializeAllBPBs() or MakeNortonDiskEditorHappy() - FreeDOS +does DPB setup on demand (eg DIR H:, via media_check, bpb_to_dpb) +so we touch all drives to make sure DPB are filled in. For some reason, +this was described as init BPB to make Norton Disk Edit happy...? */ void InitializeAllBPBs(VOID) { @@ -145,6 +141,14 @@ if ((fileno = open(filename, O_RDONLY)) = 0) close(fileno); } + /* chdir(A:\\) would need intr.asm/init-mod.h ext. but nicer than open() */ +#ifdef WITHFAT32 /* mark drive as not FAT32 to allow int25/26 access */ + /* floppy is DF_NOACCESS until 1st media_check or int 21.440d.0847 */ + LoL-DPBp-dpb_fatsize = 1; /* not 0, that would be FAT32 */ + LoL-DPBp-dpb_next-dpb_fatsize = 1; /* not 0, that would be FAT32 */ + /* bpb_to_dpb(ddt_defbpb...) would be perfect but is not accessible */ + /* media_check(get_dpb(0)); / int 21.32 etc would access phys drive */ +#endif } STATIC void PSPInit(void) -- Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H ___ Freedos-kernel mailing list Freedos-kernel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-kernel