HOw does the boot sequence work, and how does the OS communicate with the hardware?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Hero Doug
    New Member
    • Nov 2006
    • 16

    HOw does the boot sequence work, and how does the OS communicate with the hardware?

    A friennd and I were talking about OS development last night and a few questions were raised that need some clarification. I did the usual search and it turned up the usual garbage, so I'm hoping someone here has an answer, or the link to an answer.

    Issue One: How does the operating system communicate with the hardware in protected mode?

    My friend said it was through the BIOS, however I've read numerous texts stating that BIOS interrupts are not available when the CPU is in protected mode (on x86 machines), so the OS must use another way (which I conceded,I didn't know), but theorized that the OS used the bus system to accomplish the task.

    So I'm wondering, if you want to disable an ethernet card, or write files to/from a disc, or do any other task that involves telling the hardware to do a task, how does the OS make this request?

    Issue Two: The boot devices

    Somewhere there is a piece of software that can communicate with the CD-ROM or floopy and get the bootloader and load it for execution. WIthout this software we wouldn't be able to do an initial install of an OS on a new computer.

    I said it was the BIOS that performed this task (using a standarizided method of communication), while my friend said it wasn't the BIOS (I forget the exact reason it wasn't) and it has to reside somewhere else.

    So the question is, where does this software reside, and how does it load information from a device and begin the boot sequence?

    Thanks for the help.
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #2
    Some very good questions. I'm no expert on this myself, but I can give a (part) answer to the first one, after reading on Wikipedia and some other pages. Here's what Wikipedia says:
    Originally posted by Wikipedia
    ...Windows 3.0, when switching to protected mode, decided to preserve the single privilege level model that was used in real mode, which is why Windows applications and DLLs can hook interrupts and do direct hardware access. That lasted through the Windows 9x series...
    More information on how OSes cope with protected mode can be found on this page under the section "Memory management in protected mode".

    Here's another nice page about protected mode.

    I hope those pages can help you.

    Greetings,
    Nepomuk

    Comment

    • Hero Doug
      New Member
      • Nov 2006
      • 16

      #3
      Nepomuk, thanks for the reply, but the question remains unanswered. The wikipedia article linked to states that windows preserved the "single privilege level model that was used in real mode"; in the second link under "Virtual V86 extension" it states

      The only difference to pure Real Mode is that these programs are only allowed to use the instructions available in Privilege Level 3. The simulated Real Mode memory can be mapped everywhere inside the Protected Mode address space, including memory swapping. All accesses to the hardware interfering with other applications have to be handled by the OS.
      This suggests that the OS has to emulate the hardware access, but it doesn't state how it emulates it, and none of the links state how the CPU actually requests a device to perform a task (such as ejecting the CD tray or playing sound).

      I picked up Modern Operating Systems 3rd so hopefully the answer will be in there, although I'd love to have it sooner rather than later.

      Comment

      • Hero Doug
        New Member
        • Nov 2006
        • 16

        #4
        Ok I believe I found some confirmation for issue one. My initial thought seems to be right. The information is placed in memory, and a signal is sent to the device's port, and the device does it's work, no BIOS is needed at all.

        http://joelgompert.com/OS/lesson7.htm

        If anyone has links to more in depth explinations I'd love to see them.

        Comment

        • AmberJain
          Recognized Expert Contributor
          • Jan 2008
          • 922

          #5
          HELLO,


          Let me answer (or atleast try to answer) the second question:
          Originally posted by Hero Doug
          Issue Two: The boot devices

          Somewhere there is a piece of software that can communicate with the CD-ROM or floopy and get the bootloader and load it for execution. WIthout this software we wouldn't be able to do an initial install of an OS on a new computer.

          I said it was the BIOS that performed this task (using a standarizided method of communication), while my friend said it wasn't the BIOS (I forget the exact reason it wasn't) and it has to reside somewhere else.

          So the question is, where does this software reside, and how does it load information from a device and begin the boot sequence?
          There certainly is "a piece of software" (as you call it) which is called bootstrap loader.

          Bootstrap loader is burned on to ROM (Read Only Memory) i.e. it resides in ROM. This type of memory lets you stored the data needed to start up the computer. Indeed, this information cannot be stored on the hard disk since the disk parameters (vital for its initialisation) are part of these data which are essential for booting.

          A bootstrap loader is a program for loading Operating system into (random access) memory and launching it. This generally seeks the operating system on the floppy drive then on the hard disk, which allows the operating system to be launched from a system floppy disk in the event of malfunction of the system installed on the hard disk (depending on your boot order settings in CMOS setup*).

          Originally posted by Hero Doug
          I said it was the BIOS that performed this task (using a standarizided method of communication), while my friend said it wasn't the BIOS
          Your friend was right. Although BIOS is also burned onto ROM (I'm not sure about this), still BIOS plays no role in loading OS. Instead BIOS is a program for controlling the system's main input-output interfaces.


          P.S.-The *CMOS Setup is the screen displayed when the computer starts up and which is used to amend the system parameters (which is often wrongly referred to as BIOS).

          @Experts: If I am wrong somewhere in this reply, correct me.


          HOPE THIS HELPS.......
          AmbrNewlearner
          Last edited by AmberJain; Sep 18 '08, 05:16 PM. Reason: forgot to add something....

          Comment

          Working...