MS-DOS 6.22 command.com: software or kernel?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
SIC88
Posts: 3
Joined: Sun May 09, 2021 11:30 pm
Libera.chat IRC: SIC88

MS-DOS 6.22 command.com: software or kernel?

Post by SIC88 »

From BIOS detecting the hard drive's MBR, and the MBR putting IO.SYS and MSDOS.sys into memory and initialing the IO.SYS. Would the command.com be user-mode application? I'll look at the command.com through a hex editor to see if I see an MZ. I only have seen the MZ in the first type bytes of Windows 3.11 win.exe and I believe setup.exe of Windows 3.11.

If I'm right about command.com being user-mode, IO.SYS and MSDOS.SYS would be in kernel mode. Correct? Kernel Mode and User Mode is somewhat blurry to me. I get that kernel mode is 0 ring and user mode is ring 3. Ring 0 would indicate most privledge and have access to everything on the hardware. Whereas, user-mode does not and has to ask permission from the kernel to get access or manipulate hardware such as reading from disk.

Currently, I'm following a tutorial that does UEFI in C++. So far, I really do like it. However, he hasn't uploaded a newer video. I just want to start off small like a command line interpreter.

The below workflow or so far what I have in my head:

Computer Boots -> UEFI -> My Kernel -> My Kernel Finds System.Bin (or something) -> Reads Config (System.Conf) -> Finished with all initialization -> Launch Terminal.exe (Command line Interpreter).

Am I going in the right direction with this idea?
rdos
Member
Member
Posts: 3297
Joined: Wed Oct 01, 2008 1:55 pm

Re: MS-DOS 6.22 command.com: software or kernel?

Post by rdos »

MS-DOS runs in real mode and real mode has no kernel / user mode concept. Rather, everything runs in kernel mode. OTOH, if you run MS-DOS under another OS, then the applications can run in user mode (in V86 mode) and the MS-DOS API can be virtualized by the host operating system so the system services actually run in kernel mode.

Still, if you plan to do something with UEFI, the operation of MS-DOS is not relevant.
SIC88
Posts: 3
Joined: Sun May 09, 2021 11:30 pm
Libera.chat IRC: SIC88

Re: MS-DOS 6.22 command.com: software or kernel?

Post by SIC88 »

rdos wrote:MS-DOS runs in real mode and real mode has no kernel / user mode concept. Rather, everything runs in kernel mode. OTOH, if you run MS-DOS under another OS, then the applications can run in user mode (in V86 mode) and the MS-DOS API can be virtualized by the host operating system so the system services actually run in kernel mode.

Still, if you plan to do something with UEFI, the operation of MS-DOS is not relevant.
Ah. Okay. Can I still go from kernel mode and make a C++ program with my own API to gain access or ask permission to my kernel's mechanics? If my kernel has a disk read function, and my custom API used by my future applications to ask permission for the kernel to read disk.

if kernel function is: _kReadDisk.
My Api function is: ReadDisk.
My future applications in user mode would include my API and use the ReadDisk function.
That's what I believe what I'm aiming for.
User avatar
iansjack
Member
Member
Posts: 4703
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: MS-DOS 6.22 command.com: software or kernel?

Post by iansjack »

That's what system calls are for - to allow a user application to call a kernel routine.
SIC88
Posts: 3
Joined: Sun May 09, 2021 11:30 pm
Libera.chat IRC: SIC88

Re: MS-DOS 6.22 command.com: software or kernel?

Post by SIC88 »

iansjack wrote:That's what system calls are for - to allow a user application to call a kernel routine.
Thank you. :)
nexos
Member
Member
Posts: 1081
Joined: Tue Feb 18, 2020 3:29 pm
Libera.chat IRC: nexos

Re: MS-DOS 6.22 command.com: software or kernel?

Post by nexos »

To answer your direct question, the kernel is still software. It just has higher privileges. Now in the MS-DOS case, all software has the same privileges, as @rdos pointed out. But, however, MS-DOS wise, IO.SYS and MSDOS.SYS (and to a lesser extent, the BIOS) are considered the "kernel" per se.
"How did you do this?"
"It's very simple — you read the protocol and write the code." - Bill Joy
Projects: NexNix | libnex | nnpkg
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: MS-DOS 6.22 command.com: software or kernel?

Post by jal »

SIC88 wrote:I'll look at the command.com through a hex editor to see if I see an MZ
That won't do you much good, as the MZ header is used for EXE files, not for COM files.


JAL
Post Reply