Re: [Freedos-kernel] mscl8.mak: bug?
On Sat, 24 Apr 2004, Arkady V.Belousov wrote: > > __O\_/_\_/O__ > /* MSC places uninitialized data into COMDEF records, >that end up in DATA segment. this can't be tolerated in INIT code. > _ > O/~\ /~\O > > INITPATCH=..\utils\patchobj _DATA=IDATA DATA=ID BSS=ID DGROUP=I_GROUP CONST=IC > ^^^-^^ > > May be, trouble with MSC in these namings? No. These changes affect "static" BSS variables and are correct. That's why static variables don't have to be explicitly zeroed for MSC. Global BSS variables in MSC are like Fortran COMMON blocks. See also the NASM documentation for COMMON. The linker gets to decide where they go and patchobj can't do much about it (unless it would be a lot more sophisticated and convert COMDEF records to the same kind of records that Watcom and Borland C produce). Bart --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
[Freedos-kernel] FreeDOS Version 1.0 (LINK)
Hi, I forgot the link. There's a direct link from freedos.org on top (directly from http://www.freedos.org/news/version1/), although files are being posted to TODOS: http://fdos.org/ripcord/fdos_1_0/official/todos.htm POST-1.0: http://fdos.org/ripcord/fdos_1_0/official/post.htm Aitor --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
[Freedos-kernel] FreeDOS Version 1.0 reviewed
Hi all, I have commited some changes to the list (some more to go, read below), and I am submitting a message to met you know. In addition, comments are welcome: if you consider that such or such option should be left for post (if any), or which tasks should be there. NOTES: - remember the golden rule: not as many wishes so as never to reach version 1.0, but not as few as creating a FreeDOS that could let potential users down - to commit: re-check MIRROR status, leave APPEND and HIMEM/HMAMIM= to post-1.0, some minor misprints, etc. - last time we discussed about the meaning of ROM= and RAM= in EMM386, still to be evaluated if pre/post? (I'd say that RAM= is trivial to implement, and with latest changes perhaps ROM= is not too hard) - for a change, I'd prefer simple majority. Please break one-against-one/even cases by giving opinion :) One year ago I would never thought that we could be so close as we are .) Aitor --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
Re: [Freedos-kernel] Re: [Freedos-cvs] kernel/kernel fattab.c,1.21,1.22
Hi! 24-Апр-2004 17:01 [EMAIL PROTECTED] (Bart Oldeman) wrote to [EMAIL PROTECTED]: BO> if you want to check things quickly, simply do BO> wcc -i..\hdr -os -r -s -j -d1 -DWITHFAT32 foo.c BTW, this is for non-init files only, for init-files should be applied segments renaming (from INITCFLAGS) - this may change code (if you access variables from non-default segments). --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
[Freedos-kernel] Problem with FreeDOS ke2034_32 + PXELINUX + memdisk
I am using FreeDOS kernel 2.0.34 with FAT32 support (ke2034_32), together with PXELINUX and memdisk from SYSLINUX 2.0.9-pre15. I am experiencing this problem on multiple test systems (Dell Precision 450 and IBM T22 so far). My pxelinux.cfg/default has these lines: label test kernel memdisk append initrd=test.img keeppxe ...which let me boot my 1.44M "test.img" floppy image with FreeDOS. My problem is that config.sys is not being read at all. I am certain it is not being read because: 1) I receive no "press F5/F8" prompt 2) I see no messages from the items in my config.sys (e.g., himem64.exe). 3) When autoexec.bat attempts to start the network, it fails saying that the ifshlp.sys driver has not been loaded. If I downgrade the FreeDOS kernel to 2.0.33 (ke2033_32), keeping everything else identical, the problem vanishes; my config.sys is read properly. If I remove "keeppxe" from the PXELINUX configuration file, the problem also vanishes. I am open to suggestions for how to proceed. Thanks! - Pat --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
Re: [Freedos-kernel] Re: [Freedos-cvs] kernel/kernel fattab.c,1.21,1.22
Hi! 24-Апр-2004 17:01 [EMAIL PROTECTED] (Bart Oldeman) wrote to [EMAIL PROTECTED]: >> recompilation, up to 20 with OW). Probably, I should force my efforts in >> optimization of makefile (collect names of changed files in one file, then >> pass this list at once for compilation). BO> if you want to check things quickly, simply do BO> wcc -i..\hdr -os -r -s -j -d1 -DWITHFAT32 foo.c BO> (perhaps via some batch file) I do so for BC (with -S option). :) Ask again: how you get listings for inthndlr.c? When I dsiasm it, then second half of listing was not contain sources (desyncronization?). BO> wcc (wpp neither) can't compile multiple files at the sametime. You can __O\_/_\_/O__ fc= (C++ only) specify file of command lines to be batch processed (see fc=) _ O/~\ /~\O BO> only try to decrease the load time of wcc.exe Maybe compressing it or BO> binding with a dos extender helps. Maybe not. Hm. May be try the 32lite exepacker? Though, don't sure if this help (much) - WCC already runs from Stacker volume. BO> wpp is not good -- the kernel is written in C, not C++, and some small BO> differences like sizeof('a') (1 in C++, sizeof(int) in C) maybe BO> responsible for what you see. ? I not use WPP with kernel (yet). Also, should be unimportant by which compiler compiled compiler, if its sources are valid. BO> It's also bigger so just slows things down. Yes, WPP is 50% longer. :( --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
Re: [Freedos-kernel] cvs refresh
Hi! 24-Апр-2004 17:05 [EMAIL PROTECTED] (Bart Oldeman) wrote to [EMAIL PROTECTED]: BO> Date: Sat, 24 Apr 2004 17:05:18 +0100 (BST) >> When latest patches will be reflected in CVS snapshot on site >> (kernel.tgz?)? I wish to check how they are applied "in complete". BO> every day at 10am GMT How GMT relates to UTC (which TZ)? I mean, how GMT relates to my MSK TZ (which is currently +4 to UTC)? --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
Re: [Freedos-kernel] cvs refresh
On Sat, 24 Apr 2004, Arkady V.Belousov wrote: > When latest patches will be reflected in CVS snapshot on site > (kernel.tgz?)? I wish to check how they are applied "in complete". every day at 10am GMT Bart --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
Re: [Freedos-kernel] Re: [Freedos-cvs] kernel/kernel fattab.c,1.21,1.22
On Sat, 24 Apr 2004, Arkady V.Belousov wrote: > 24-áÐÒ-2004 16:37 [EMAIL PROTECTED] (Bart Oldeman) wrote to > [EMAIL PROTECTED]: > > BO> fbp by bp->buffer[foo] really doesn't produce better code for Watcom. > BO> There is a good reason why I didn't apply these blockio.c patches either. > > :) For OW I don't review listings yet, only for BC. I plan do this for > OW today-tomorrow, though, this is much longer (up to 10 minutes with BC for > recompilation, up to 20 with OW). Probably, I should force my efforts in > optimization of makefile (collect names of changed files in one file, then > pass this list at once for compilation). if you want to check things quickly, simply do wcc -i..\hdr -os -r -s -j -d1 -DWITHFAT32 foo.c (perhaps via some batch file) wcc (wpp neither) can't compile multiple files at the sametime. You can only try to decrease the load time of wcc.exe Maybe compressing it or binding with a dos extender helps. Maybe not. wpp is not good -- the kernel is written in C, not C++, and some small differences like sizeof('a') (1 in C++, sizeof(int) in C) maybe responsible for what you see. It's also bigger so just slows things down. Bart --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
Re: [Freedos-kernel] Re: [Freedos-cvs] kernel/kernel fattab.c,1.21,1.22
Hi! 24-Апр-2004 16:37 [EMAIL PROTECTED] (Bart Oldeman) wrote to [EMAIL PROTECTED]: BO> fbp by bp->buffer[foo] really doesn't produce better code for Watcom. BO> There is a good reason why I didn't apply these blockio.c patches either. :) For OW I don't review listings yet, only for BC. I plan do this for OW today-tomorrow, though, this is much longer (up to 10 minutes with BC for recompilation, up to 20 with OW). Probably, I should force my efforts in optimization of makefile (collect names of changed files in one file, then pass this list at once for compilation). --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
Re: [Freedos-kernel] Re: [Freedos-cvs] kernel/kernel fattab.c,1.21,1.22
On Sat, 24 Apr 2004, Arkady V.Belousov wrote: > 24-áÐÒ-2004 15:53 [EMAIL PROTECTED] (Bart Oldeman) wrote to > [EMAIL PROTECTED]: > > > +++ fattab.c 24 Apr 2004 15:53:21 - 1.22 > > -idx = (unsigned) unsigned)Cluster1 << 1) + (unsigned)Cluster1) >> 1) > > - % dpbp->dpb_secsize; > > - > > +idx = (((unsigned)Cluster1 << 1) + (unsigned)Cluster1) % > dpbp->>dpb_secsize; > > Bug: in my patch was "Cluster1 >> 1" - difference is that code above > computes 3*Cluster1 instead 3*Cluster1/2. Sure I already found that and corrected. But please note that replacing fbp by bp->buffer[foo] really doesn't produce better code for Watcom. There is a good reason why I didn't apply these blockio.c patches either. Bart --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
[Freedos-kernel] cvs refresh
Hi! When latest patches will be reflected in CVS snapshot on site (kernel.tgz?)? I wish to check how they are applied "in complete". --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
[Freedos-kernel] Re: [Freedos-cvs] kernel/kernel fattab.c,1.21,1.22
Hi! 24-Апр-2004 15:53 [EMAIL PROTECTED] (Bart Oldeman) wrote to [EMAIL PROTECTED]: > +++ fattab.c 24 Apr 2004 15:53:21 - 1.22 > -idx = (unsigned) unsigned)Cluster1 << 1) + (unsigned)Cluster1) >> 1) > - % dpbp->dpb_secsize; > - > +idx = (((unsigned)Cluster1 << 1) + (unsigned)Cluster1) % dpbp->>dpb_secsize; Bug: in my patch was "Cluster1 >> 1" - difference is that code above computes 3*Cluster1 instead 3*Cluster1/2. --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel
[Freedos-kernel] patch: mix
--- Begin Message --- diff -ruNp old/kernel/blockio.c new/kernel/blockio.c --- old/kernel/blockio.c2004-04-13 13:11:08.0 + +++ new/kernel/blockio.c2004-04-24 03:19:32.0 + @@ -469,35 +469,45 @@ UWORD dskxfer(COUNT dsk, ULONG blkno, VO } -/* - this removes any (additionally allocated) buffers - from the HMA buffer chain, because they get allocated to the 'user' -*/ - -void AllocateHMASpace (size_t lowbuffer, size_t highbuffer) +/* this removes any (additionally allocated) buffers from the + HMA buffer chain, because they get allocated to the 'user'. + There assumed that: + LoL_nbuffers > 0 + not all buffers inside [start..last] area +*/ + +#define b_(ofs) ((struct buffer FAR*)MK_FP(/*HMASEG*/0x, ofs)) + +void freeHMAbuffers (ofs_t startarea, ofs_t nextarea) { - REG struct buffer FAR *bp = firstbuf; - int n; + ofs_t buf; - if (FP_SEG(bp) != 0x) + if (FP_SEG (firstbuf) != /*HMASEG*/0x) return; - n = LoL_nbuffers; - do + buf = b_(FP_OFF (firstbuf))->b_next; + for (;;) { -/* check if buffer intersects with requested area */ -if (FP_OFF(bp) < highbuffer && FP_OFF(bp+1) > lowbuffer) +ofs_t next = b_(buf)->b_next; + +/* check if buffer intersects with requested area */ +if (buf < nextarea && buf + sizeof(struct buffer) > startarea) { - flush1(bp); - /* unlink bp from buffer chain */ + flush1 (b_(buf)); - b_prev(bp)->b_next = bp->b_next; - b_next(bp)->b_prev = bp->b_prev; - if (FP_OFF(bp) == FP_OFF(firstbuf)) -firstbuf = b_next(bp); + /* unlink buffer from chain */ LoL_nbuffers--; + b_(b_(next)->b_prev = b_(buf)->b_prev)->b_next = next; + + if (buf == FP_OFF (firstbuf)) + { + *(UWORD*)&firstbuf = next; + break; + } } -bp = b_next(bp); + +if (buf == FP_OFF (firstbuf)) + break; +buf = next; } - while (--n); } diff -ruNp old/kernel/config.c new/kernel/config.c --- old/kernel/config.c 2004-04-14 16:04:04.0 + +++ new/kernel/config.c 2004-04-24 12:35:40.0 + @@ -43,6 +43,18 @@ static BYTE *RcsId = #endif #define para2far(seg) ((mcb FAR *)MK_FP((seg), 0)) +typedef UWORD ofs_t; +typedef UWORD seg_t; + +#if __TURBOC__ > 0x202 +# define FP_PTR(type,seg,ofs) ((type FAR*) MK_FP (seg, ofs)) +# define FP_SEG_PTR(type,seg) ((type _seg*) (seg)) +#else +# define _seg FAR +# define FP_PTR(type,seg,ofs) ((type FAR*) MK_FP (seg, ofs)) +# define FP_SEG_PTR(type,seg) ((type FAR*) MK_FP (seg, 0)) +#endif + /** Menu selection bar struct: x pos, ypos, string @@ -125,6 +137,9 @@ static UBYTE ErrorAlreadyPrinted[128] BS char master_env[128] BSS_INIT({0}); static char *envp = master_env; +static char init[NAMEMAX] = "command.com"; +static char inittail[NAMEMAX] = " /P /E:256\r\n"; + struct config Config = { 0, NUMBUFF, @@ -132,8 +147,8 @@ struct config Config = { 0, NFCBS, 0, - "command.com", - " /P /E:256\r\n", + init, + inittail, NLAST, 0, NSTACKS, @@ -267,7 +282,6 @@ STATIC struct table commands[] = { {"BREAK", 1, CfgBreak}, {"BUFFERS", 1, Config_Buffers}, - {"COMMAND", 1, InitPgm}, {"COUNTRY", 1, Country}, {"DOS", 1, Dosmem}, {"DOSDATA", 1, DosData}, @@ -480,16 +494,13 @@ void PostConfig(void) VOID configDone(VOID) { if (UmbState == 1) -para2far(base_seg)->m_type = MCB_LAST; +FP_SEG_PTR(mcb, base_seg)->m_type = MCB_LAST; if (HMAState != HMA_DONE) { -mcb FAR *p; -unsigned short kernel_seg; -unsigned short hma_paras = (HMAFree+0xf)/16; - -allocmem(hma_paras, &kernel_seg); -p = para2far(kernel_seg - 1); +unsigned short hma_paras = (HMAFree + 15) / 16; +unsigned short kernel_seg = allocmem(hma_paras); +mcb _seg *p = FP_SEG_PTR(mcb, kernel_seg - 1); p->m_name[0] = 'S'; p->m_name[1] = 'C'; @@ -498,9 +509,7 @@ VOID configDone(VOID) DebugPrintf(("HMA not available, moving text to %x\n", kernel_seg)); MoveKernel(kernel_seg); -kernel_seg += hma_paras + 1; - -DebugPrintf(("kernel is low, start alloc at %x", kernel_seg)); +DebugPrintf(("kernel is low, start alloc at %x", kernel_seg + hma_paras + 1)); } /* The standard handles should be reopened here, because @@ -1237,12 +1246,6 @@ STATIC VOID InitPgmHigh(BYTE * pLine) STATIC VOID InitPgm(BYTE * pLine) { - static char init[NAMEMAX]; - static char inittail[NAMEMAX]; - - Config.cfgInit = init; - Config.cfgInitTail = inittail; - /* Get the string argument that represents the new init pgm */ pLine = GetStringArg(pLine, Config.cfgInit); @@ -1684,47 +1687,44 @@ STATIC void config_init_buffers(int want struct buffer FAR *pbuffer; unsigned buffers = 0; - /* fill HMA with buffers if BUFFERS count >=0 and DOS in HMA*/ + /* fill HMA with buffers if BUFFERS count >=0 and DOS in H
[Freedos-kernel] patch: some optimizations
--- Begin Message --- diff -ruNp old/kernel/break.c new/kernel/break.c --- old/kernel/break.c 2004-04-14 17:40:50.0 + +++ new/kernel/break.c 2004-04-24 11:55:44.0 + @@ -53,13 +53,13 @@ unsigned char ctrl_break_pressed(void) unsigned char check_handle_break(struct dhdr FAR **pdev) { - unsigned char c = CTL_C; - if (!ctrl_break_pressed()) -c = (unsigned char)ndread(&syscon); - if (c != CTL_C && *pdev != syscon) -c = (unsigned char)ndread(pdev); - if (c == CTL_C) + unsigned char c; + if (ctrl_break_pressed() || + (c = (unsigned char)ndread(&syscon)) == CTL_C || + *pdev != syscon && (c = (unsigned char)ndread(pdev))== CTL_C) + { handle_break(pdev, -1); + } return c; } @@ -90,4 +90,3 @@ void handle_break(struct dhdr FAR **pdev spawn_int23();/* invoke user INT-23 and never come back */ } - diff -ruNp old/kernel/dsk.c new/kernel/dsk.c --- old/kernel/dsk.c2004-04-13 12:54:32.0 + +++ new/kernel/dsk.c2004-04-24 06:17:54.0 + @@ -363,9 +363,7 @@ STATIC WORD blk_Media(rqptr rp, ddt * pd STATIC WORD getbpb(ddt * pddt) { - ULONG count; bpb *pbpbarray = &pddt->ddt_bpb; - unsigned secs_per_cyl; WORD ret; /* pddt->ddt_descflags |= DF_NOACCESS; @@ -430,19 +428,20 @@ STATIC WORD getbpb(ddt * pddt) printf("BPB_NFSECT= %04x\n", pbpbarray->bpb_nfsect); #endif - count = - pbpbarray->bpb_nsize == 0 ? - pbpbarray->bpb_huge : pbpbarray->bpb_nsize; - secs_per_cyl = pbpbarray->bpb_nheads * pbpbarray->bpb_nsecs; - - if (secs_per_cyl == 0) { -tmark(pddt); -return failure(E_FAILURE); +unsigned secs_per_cyl = pbpbarray->bpb_nheads * pbpbarray->bpb_nsecs; + +if (secs_per_cyl == 0) +{ + tmark(pddt); + return failure(E_FAILURE); +} +/* this field is problematic for partitions > 65535 cylinders, + in general > 512 GiB. However: we are not using it ourselves. */ +pddt->ddt_ncyl = (UWORD)(((pbpbarray->bpb_nsize == 0 ? + pbpbarray->bpb_huge : pbpbarray->bpb_nsize) + - 1) / secs_per_cyl) + 1; } - /* this field is problematic for partitions > 65535 cylinders, - in general > 512 GiB. However: we are not using it ourselves. */ - pddt->ddt_ncyl = (UWORD)((count + (secs_per_cyl - 1)) / secs_per_cyl); tmark(pddt); @@ -1065,15 +1064,8 @@ STATIC int LBA_Transfer(ddt * pddt, UWOR LBA_address += count; totaltodo -= count; -buffer = adjust_far((char FAR *)buffer + count * 512); +buffer = adjust_far((char FAR *)buffer + count * 512u); } - return (error_code); + return error_code; } - -/* - * Revision 1.17 2001/05/13 tomehlert - * Added full support for LBA hard drives - * initcode moved (mostly) to initdisk.c - * lower interface partly redesigned - */ diff -ruNp old/kernel/fattab.c new/kernel/fattab.c --- old/kernel/fattab.c 2004-02-07 19:04:48.0 + +++ new/kernel/fattab.c 2004-04-24 07:32:48.0 + @@ -145,9 +145,9 @@ void write_fsinfo(struct dpb FAR * dpbp) /* */ /* The FAT file system is difficult to trace through FAT table. */ /* There are two kinds of FAT's, 12 bit and 16 bit. The 16 bit */ -/* FAT is the easiest, since it is noting more than a series of */ -/* UWORD's. The 12 bit FAT is difficult, because it packs 3 FAT */ -/* entries into two BYTE's. The are packed as follows: */ +/* FAT is the easiest, since it is nothing more than a series */ +/* of UWORD's. The 12 bit FAT is difficult, because it packs 3 */ +/* FAT entries into two BYTE's. The are packed as follows: */ /* */ /* 0x0003 0x0004 0x0005 0x0006 0x0007 0x0008 0x0009 ...*/ /* */ @@ -171,71 +171,65 @@ unsigned link_fat(struct dpb FAR * dpbp, if (ISFAT12(dpbp)) { -unsigned idx; -REG UBYTE FAR *fbp0, FAR * fbp1; -struct buffer FAR * bp1; +struct buffer FAR * bp2; +unsigned b1, b2; -/* form an index so that we can read the block as a */ -/* byte array */ -idx = (unsigned) unsigned)Cluster1 << 1) + (unsigned)Cluster1) >> 1) - % dpbp->dpb_secsize; - -/* Test to see if the cluster straddles the block. If */ -/* it does, get the next block and use both to form the */ -/* the FAT word. Otherwise, just point to the next */ -/* block. */ -fbp0 = &bp->b_buffer[idx]; -fbp1 = fbp0 + 1; +/* form an index so that we can read the block as a byte array.*/ +b1 = (((unsigned)Cluster1 >> 1) + (unsigned)Cluster1) + % dpbp->dpb_secsize; + +/* Test to see if the cluster straddles the block. If it does, get */ +/* the next block and use b
[Freedos-kernel] patch: bugfixes and some optimizations
--- Begin Message --- diff -ruNp old/kernel/initdisk.c new/kernel/initdisk.c --- old/kernel/initdisk.c 2004-04-14 01:46:24.0 + +++ new/kernel/initdisk.c 2004-04-24 10:02:44.0 + @@ -647,17 +647,12 @@ void DosDefinePartition(struct DrivePara } /* Get the parameters of the hard disk */ -int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam) +STATIC int LBA_Get_Drive_Parameters(int drive, struct DriveParamS *driveParam) { iregs regs; - struct _bios_LBA_disk_parameterS lba_bios_parameters; - if (driveParam->driveno) -return driveParam->driveno; - - driveParam->descflags = 0; - + memset(driveParam, 0, sizeof *driveParam); drive |= 0x80; /* for tests - disable LBA support, @@ -814,11 +809,18 @@ BOOL ConvPartTableEntryToIntern(struct P BOOL is_suspect(struct CHS *chs, struct CHS *pEntry_chs) { - return !((chs->Cylinder & 0x3ff) == pEntry_chs->Cylinder || - 1023 == pEntry_chs->Cylinder || - (chs->Cylinder == pEntry_chs->Cylinder && -chs->Head == pEntry_chs->Head && -chs->Sector == pEntry_chs->Sector)); + /* Valid entry: + entry == chs || // partition entry equal to computed values + (chs->Cylinder > 1023 && // or LBA partition + (entry->Cylinder == 1023 || + entry->Cylinder == (0x3FF & chs->Cylinder))) + */ + return !((pEntry_chs->Cylinder == chs->Cylinder && + pEntry_chs->Head == chs->Head && + pEntry_chs->Sector == chs->Sector)|| + chs->Cylinder > 1023u && + (pEntry_chs->Cylinder == 1023 || + pEntry_chs->Cylinder == (0x3ff & chs->Cylinder))); } void print_warning_suspect(char *partitionName, UBYTE fs, struct CHS *chs, @@ -894,9 +896,8 @@ BOOL ScanForPrimaryPartitions(struct Dri &pEntry->End); } -if (chs.Cylinder > 1023 || end.Cylinder > 1023) +if ((chs.Cylinder | end.Cylinder) > 1023) { - if (!(driveParam->descflags & DF_LBA)) { printf @@ -1042,8 +1043,6 @@ int ProcessDisk(int scanType, unsigned d /* Get the hard drive parameters and ensure that the drive exists. */ /* If there was an error accessing the drive, skip that drive. */ - memset(&driveParam, 0, sizeof(driveParam)); - if (!LBA_Get_Drive_Parameters(drive, &driveParam)) { printf("can't get drive parameters for drive %02x\n", drive); @@ -1247,19 +1246,31 @@ I don't know, if I did it right, but I t ***/ +STATIC void make_ddt (ddt *pddt, int Unit, int driveno, int flags) +{ + pddt->ddt_next = MK_FP(0, 0x); + pddt->ddt_logdriveno = Unit; + 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_offset = 0; + pddt->ddt_serialno = 0x12345678l; + memcpy(&pddt->ddt_bpb, &pddt->ddt_defbpb, sizeof(bpb)); + push_ddt(pddt); +} + void ReadAllPartitionTables(void) { UBYTE foundPartitions[MAX_HARD_DRIVE]; - int HardDrive; - int nHardDisk = BIOS_nrdrives(); - int Unit; + int nHardDisk; ddt nddt; - ddt *pddt = &nddt; static iregs regs; /* quick adjustment of diskette parameter table */ - fmemcpy(int1e_table, *(char FAR * FAR *)MK_FP(0, 0x1e*4), sizeof(int1e_table)); + fmemcpy(int1e_table, *(const char FAR* const FAR*)MK_FP(0, 0x1e*4), sizeof int1e_table); /* enforce min. 9 sectors per track */ if (int1e_table[4] < 9) int1e_table[4] = 9; @@ -1267,59 +1278,44 @@ void ReadAllPartitionTables(void) setvec(0x1e, (intvec)int1e_table); /* Setup media info and BPBs arrays for floppies */ - for (Unit = 0; Unit < 2; Unit++) - { -pddt->ddt_next = MK_FP(0, 0x); -pddt->ddt_driveno = 0; -pddt->ddt_logdriveno = Unit; -pddt->ddt_type = init_getdriveparm(0, &pddt->ddt_defbpb); -pddt->ddt_ncyl = (pddt->ddt_type & 7) ? 80 : 40; -pddt->ddt_descflags = init_readdasd(0); - -pddt->ddt_offset = 0l; -pddt->ddt_serialno = 0x12345678l; -memcpy(&pddt->ddt_bpb, &pddt->ddt_defbpb, sizeof(bpb)); - -if (Unit == 0) - push_ddt(pddt); - } - - /* Initial number of disk units */ - nUnits = 2; + make_ddt(&nddt, 0, 0, 0); /* this is a quick patch - see if B: exists test for A: also, need not exist */ init_call_intr(0x11, ®s); /* get equipment list */ - if ((regs.a.x & 1) && (regs.a.x & 0xc0)) +/*if ((regs.AL & 1)==0)*//* no floppy drives installed */ + if ((regs.AL & 1) && (regs.AL & 0xc0)) { -pddt->ddt_driveno = 1; -pddt->ddt_type = init_getdriveparm(1, &pddt->ddt_defbpb); -pddt->ddt_descflags = init_readdasd(1); -pddt->ddt_ncyl = (pddt->ddt_type & 7) ? 80 : 40; /* floppy drives installed and a B: drive */ -/*if ((r.a.x & 1)==0) *//* no floppy drives installed */ +
[Freedos-kernel] bug?
Hi! This happens only once, with kernel in low memory: config.sys contain "dos=high,umb/lastdrive=z", but no himem or something similar. When I run VC (Volcov Commander), change config.sys, save, reboot - diskette hangs. After rebooting from HD I check diskette and found, that config.sys was unchanged, but kernel.sys was broken. Unfortunately, following tryings to reproduce bug was unsuccessful. :( --- This SF.net email is sponsored by: The Robotic Monkeys at ThinkGeek For a limited time only, get FREE Ground shipping on all orders of $35 or more. Hurry up and shop folks, this offer expires April 30th! http://www.thinkgeek.com/freeshipping/?cpg=12297 ___ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel