Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrected all errors in text of Chapters 1 to 6 #164

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Chapter-1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

> The term x86 denotes a family of backward compatible instruction set architectures based on the Intel 8086 CPU.

The x86 architecture is the most common instruction set architecture since its introduction in 1981 for the IBM PC. A large amount of software, including operating systems (OS's) such as DOS, Windows, Linux, BSD, Solaris and Mac OS X, function with x86-based hardware.
The x86 architecture is the most common instruction set architecture. It was introduced in 1981 for the IBM PC. A large amount of software, including operating systems (OS's) such as DOS, Windows, Linux, BSD, Solaris and Mac OS X, function with x86-based hardware.

In this course we are not going to design an operating system for the x86-64 architecture but for x86-32, thanks to backward compatibility, our OS will be compatible with our newer PCs (but take caution if you want to test it on your real machine).
In this course we are not going to design an operating system for the x86-64 architecture but for x86-32, thanks to backward compatibility, our OS will be compatible with our newer PCs (but be cautious if you test it on your real machine).

### Our Operating System

The goal is to build a very simple UNIX-based operating system in C++, but the goal is not to just build a "proof-of-concept". The OS should be able to boot, start a userland shell and be extensible.
The goal is to build a very simple UNIX-based operating system in C++. The goal is not to just build a "proof-of-concept", the OS should also be able to boot, start a userland shell and be extensible.

The OS will be built for the x86 architecture, running on 32 bits, and compatible with IBM PCs.

Expand Down
2 changes: 1 addition & 1 deletion Chapter-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The first step is to download and install Vagrant for your system at http://www.

> Oracle VM VirtualBox is a virtualization software package for x86 and AMD64/Intel64-based computers.

Vagrant needs Virtualbox to work, Download and install for your system at https://www.virtualbox.org/wiki/Downloads.
Vagrant needs Virtualbox to work, download and install for your system. Available at https://www.virtualbox.org/wiki/Downloads.

### Start and test your development environment

Expand Down
6 changes: 3 additions & 3 deletions Chapter-3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### How the boot works?

When an x86-based computer is turned on, it begins a complex path to get to the stage where control is transferred to our kernel's "main" routine (`kmain()`). For this course, we are only going to consider the BIOS boot method and not it's successor (UEFI).
When an x86-based computer is turned on, it begins a complex path to get to the stage where control is transferred to our kernel's "main" routine (`kmain()`). For this course, we are only going to consider the BIOS boot method and not its successor (UEFI).

The BIOS boot sequence is: RAM detection -> Hardware detection/Initialization -> Boot sequence.

Expand Down Expand Up @@ -80,7 +80,7 @@ The first step is to create a hard-disk image (c.img) using qemu-img:
qemu-img create c.img 2M
```

We need now to partition the disk using fdisk:
We now need to partition the disk using fdisk:

```bash
fdisk ./c.img
Expand Down Expand Up @@ -128,7 +128,7 @@ fdisk ./c.img
> w
```

We need now to attach the created partition to the loop-device using losetup. This allows a file to be access like a block device. The offset of the partition is passed as an argument and calculated using: **offset= start_sector * bytes_by_sector**.
We now need to attach the created partition to the loop-device using losetup. This allows a file to be accessed like a block device. The offset of the partition is passed as an argument and calculated using: **offset= start_sector * bytes_by_sector**.

Using ```fdisk -l -u c.img```, you get: 63 * 512 = 32256.

Expand Down
4 changes: 2 additions & 2 deletions Chapter-4/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#### C++ kernel run-time

A kernel can be written in C++ just as it can be in C, with the exception of a few pitfalls that come with using C++ (runtime support, constructors, etc).
A kernel can be written in C++ just as it can be in C, with the exception of a few pitfalls that come with the use of C++ (runtime support, constructors, etc).

The compiler will assume that all the necessary C++ runtime support is available by default, but as we are not linking libsupc++ into your C++ kernel, we need to add some basic functions that can be found in the [cxx.cc](https://github.com/SamyPesse/How-to-Make-a-Computer-Operating-System/blob/master/src/kernel/runtime/cxx.cc) file.

Expand Down Expand Up @@ -30,7 +30,7 @@ These functions are defined in [string.cc](https://github.com/SamyPesse/How-to-M

#### C types

In the next step, we're going to define different types we're going to use in our code. Most of our variable types are going to be unsigned. This means that all the bits are used to store the integer. Signed variables use their first bit to indicate their sign.
In the next step, we're going to define different 'types' that we will be using in our code. Most of our variable 'types' are going to be unsigned. This means that all the bits are used to store the value and will be positive. Signed variables use their first bit to indicate their sign.

```cpp
typedef unsigned char u8;
Expand Down
6 changes: 3 additions & 3 deletions Chapter-5/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## Chapter 5: Base classes for managing x86 architecture

Now that we know how to compile our C++ kernel and boot the binary using GRUB, we can start to do some cool things in C/C++.
Now that we know how to compile our C++ kernel and boot the binary using GRUB, we can start to do some cool things using C/C++.

#### Printing to the screen console

We are going to use VGA default mode (03h) to display some text to the user. The screen can be directly accessed using the video memory at 0xB8000. The screen resolution is 80x25 and each character on the screen is defined by 2 bytes: one for the character code, and one for the style flag. This means that the total size of the video memory is 4000B (80B*25B*2B).
We are going to use VGA default mode (03h) to display some text to the user. The screen can directly be accessed using the video memory at 0xB8000. The screen resolution is 80x25 and each character on the screen is defined by 2 bytes: one for the character code, and one for the style flag. This means that the total size of the video memory is 4000B (80B*25B*2B).

In the IO class ([io.cc](https://github.com/SamyPesse/How-to-Make-a-Computer-Operating-System/blob/master/src/kernel/arch/x86/io.cc)),:
* **x,y**: define the cursor position on the screen
Expand Down Expand Up @@ -155,7 +155,7 @@ void Io::print(const char *s, ...){

#### Assembly interface

A large number of instructions are available in Assembly but there is not equivalent in C (like cli, sti, in and out), so we need an interface to these instructions.
A large number of instructions are available in Assembly but there is no equivalent in C (like cli, sti, in and out), so we need an interface these instructions.

In C, we can include Assembly using the directive "asm()", gcc use gas to compile the assembly.

Expand Down
8 changes: 4 additions & 4 deletions Chapter-6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ The [GDT](http://en.wikipedia.org/wiki/Global_Descriptor_Table) ("Global Descrip

We are going to use the GDT to define different memory segments:

* *"code"*: kernel code, used to stored the executable binary code
* *"code"*: kernel code, used to store the executable binary code
* *"data"*: kernel data
* *"stack"*: kernel stack, used to stored the call stack during kernel execution
* *"ucode"*: user code, used to stored the executable binary code for user program
* *"stack"*: kernel stack, used to store the call stack during kernel execution
* *"ucode"*: user code, used to store the executable binary code for user program
* *"udata"*: user program data
* *"ustack"*: user stack, used to stored the call stack during execution in userland
* *"ustack"*: user stack, use to stored the call stack during execution in userland

#### How to load our GDT?

Expand Down