Writing a Simple Operating System — from Scratch

(Jeff_L) #1

  • 1 Introduction Contents ii

  • 2 Computer Architecture and the Boot Process

    • 2.1 The Boot Process

    • 2.2 BIOS, Boot Blocks, and the Magic Number

    • 2.3 CPU Emulation

      • 2.3.1 Bochs: A x86 CPU Emulator

      • 2.3.2 QEmu



    • 2.4 The Usefulness of Hexadecimal Notation



  • 3 Boot Sector Programming (in 16-bit Real Mode)

    • 3.1 Boot Sector Re-visited

    • 3.2 16-bit Real Mode

    • 3.3 Erm, Hello?

      • 3.3.1 Interrupts

      • 3.3.2 CPU Registers

      • 3.3.3 Putting it all Together



    • 3.4 Hello, World!

      • 3.4.1 Memory, Addresses, and Labels

      • 3.4.2 ’X’ Marks the Spot

        • Question



      • 3.4.3 Defining Strings

      • 3.4.4 Using the Stack

        • Question



      • 3.4.5 Control Structures

        • Question



      • 3.4.6 Calling Functions

      • 3.4.7 Include Files

      • 3.4.8 Putting it all Together

        • Question



      • 3.4.9 Summary



    • 3.5 Nurse, Fetch me my Steth-o-scope CONTENTS iii

      • 3.5.1 Question 5 (Advanced)



    • 3.6 Reading the Disk

      • 3.6.1 Extended Memory Access Using Segments

      • 3.6.2 How Disk Drives Work

      • 3.6.3 Using BIOS to Read the Disk

      • 3.6.4 Putting it all Together





  • 4 Entering 32-bit Protected Mode

    • 4.1 Adapting to Life Without BIOS

    • 4.2 Understanding the Global Descriptor Table

    • 4.3 Defining the GDT in Assembly

    • 4.4 Making the Switch

    • 4.5 Putting it all Together



  • 5 Writing, Building, and Loading Your Kernel

    • 5.1 Understanding C Compilation

      • 5.1.1 Generating Raw Machine Code

      • 5.1.2 Local Variables

      • 5.1.3 Calling Functions

      • 5.1.4 Pointers, Addresses, and Data



    • 5.2 Executing our Kernel Code

      • 5.2.1 Writing our Kernel

      • 5.2.2 Creating a Boot Sector to Bootstrap our Kernel

      • 5.2.3 Finding Our Way into the Kernel



    • 5.3 Automating Builds with Make

      • 5.3.1 Organising Our Operating System’s Code Base



    • 5.4 C Primer

      • 5.4.1 The Pre-processor and Directives

      • 5.4.2 Function Declarations and Header Files





  • 6 Developing Essential Device Drivers and a Filesystem

    • 6.1 Hardware Input/Output

      • 6.1.1 I/O Buses

      • 6.1.2 I/O Programming

      • 6.1.3 Direct Memory Access



    • 6.2 Screen Driver

      • 6.2.1 Understanding the Display Device

      • 6.2.2 Basic Screen Driver Implementation

      • 6.2.3 Scrolling the Screen



    • 6.3 Handling Interrupts

    • 6.4 Keyboard Driver

    • 6.5 Hard-disk Driver

    • 6.6 File System



  • 7 Implementing Processes

    • 7.1 Single Processing

    • 7.2 Multi-processing



Free download pdf