Hi all kernel developers,

I have started watching kernel source files, and trying to understand its logic by reading sources.
In the study of the files (AT A FIRST GLANCE), I have come across some questions, and further I wonder about some things, and I would like to ask you if you could be so kind to give some hints, provided that Pat's bock is pretty outdated already.
Please note that when I ask questions like "why isn't this like that" or "why is this implemented this way and not another" my intention is not critisize current work, but I just ask if things could have been made other way, in order to check that I am understanding the concepts. Replies like "historical reasons" or "nobody has done it that way already", or "produces bigger or slower kernel" are all acceptable and welcome (and I could even consider trying that, to see if they work and produce smaller kernels).
Thanks in advance.


(1) why are there STRINGS.C and MISC.C, apparently with the same functionality and same routines in the same programming language?

(2) I observe that the standard block device and the standard clock$ device initialisation routines are not included as the initialisation call of the corresponding procedures, but that have been included as sepparate routines, called separatedly. I observe that they are called AFTER all the other devices have been initialised, a PSP is set to "current process" and LastDrive is stablished. I can understand that the later two stuff could be necessary (at a first glance) for the initialisation of the disks, but why for the clock?
Otherwise, couldn't the order be:
- set a PSP to current process
- set a lastdrive
- initialise all drivers (including disk, clock$) within their INIT routines
The only thing I can come up with is that they are C routines, and are called from inside a C routine.... is this right?
Along the same lines, Serial ports and printers are initialised in C routines inside MAIN.C (routines that seem to have straightforward assembly form), couldn't these be part of the init of COMx and LPTx (thus avoiding, for example, the loop)?


(3) I see that the BPBs are initialised (MAIN.C:InitializeAllBPBs) by opening and closing a file for each drive, any hint why this is so? (such as code in DSK.C where I could see: "if file opened for the first time, then initialise the BPB").

(4) I ignore if the boot loader will send any valuable value to kernel routine inside variables AX and BX. Nevertheless, the following code seems to show that the value of AX is lost (and I ignore if the value on BX is useful), so I'd suggest this small change. Correct?
========
realentry: ; execution continues here


- push ax
push bx
pushf mov ax, 0e31h ; '1' Tracecode - kernel entered
mov bx, 00f0h int 010h
popf
pop bx
- pop ax


               jmp    far kernel_start
beyond_entry:   resb    256-(beyond_entry-entry)
                                       ; scratch area for data (DOS_PSP)

segment INIT_TEXT

       extern    _FreeDOSmain

               ;
               ; kernel start-up
               ;
kernel_start:

push bx
pushf mov ax, 0e32h ; '2' Tracecode - kernel entered
mov bx, 00f0h int 010h
popf
pop bx
========


(5) By the way, strangely enough I don't happen to see "123 - Initdisk" anymore, due most probably to the \r before the kernel compatibility.
Now I was just wondering who prints "FreeDOS kernel version 1.1.35 (Build 2035) [May 30 2004 22:09:36]?


(6) A curiosity (not a question): FreeDOS config parsing does not care that options (apparently supposed to be unique) (such as FILES=) are duplicate. Neither does MS-DOS. (This was tested)

(7) A big questions: I have noticed the following two things:
- there is a stack for the IRQ interrupts (apparently independent from the rest)
- there is a kernel stack
I have noticed stack switching back and forth on the entry/exit points to FreeDOS (int 2x, for example)
However, I have often read about the "multiple kernel stacks", I don't know if this refers to these two, and second, I completely ignore the use of the STACKS= switch (should this be related), can someone clarify a bit on this please?


(8) At the end of PreConfig one can see the following comments about MCB initialisation, whereas it has obviously been moved to PreConfig2. I'd suggest this cosmetic change (or remove any comment at all), am I correct?:
=====
- /* Done. Now initialize the MCB structure */
- /* This next line is 8086 and 80x86 real mode specific */
+ /* MCB initialisation was once here, now moved to PreConfig2 */
#ifdef DEBUG
printf("Preliminary allocation completed: top at %p\n", lpTop);
#endif
}
=====


(9) Finally, after the comments and patches by Lucho, I sincerely expected to see some kind of LOOP in the MAIN.C:kernel() function, as I see none, I guess I am misunderstanding this, so how does this work whenever one exists the main SHELL?

As said above, many thanks in advance for your patience and replies.
Aitor


------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Freedos-kernel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to