1
0
mirror of https://github.com/0xAX/linux-insides.git synced 2024-12-23 07:08:11 +00:00

Merge pull request #495 from litao91/fix_typo

Typo fixes on booting part1
This commit is contained in:
0xAX 2017-07-17 23:57:21 +06:00 committed by GitHub
commit 3ed1bd1b70

View File

@ -331,8 +331,8 @@ state.cs = segment + 0x20;
This means that segment registers will have the following values after kernel setup starts: This means that segment registers will have the following values after kernel setup starts:
``` ```
gs = fs = es = ds = ss = 0x1000 gs = fs = es = ds = ss = 0x10000
cs = 0x1020 cs = 0x10200
``` ```
In my case, the kernel is loaded at `0x10000` address. In my case, the kernel is loaded at `0x10000` address.
@ -357,7 +357,7 @@ First of all, the kernel ensures that `ds` and `es` segment registers point to t
cld cld
``` ```
As I wrote earlier, `grub2` loads kernel setup code at address `0x10000` by default and `cs` at `0x1020` because execution doesn't start from the start of file, but from: As I wrote earlier, `grub2` loads kernel setup code at address `0x10000` by default and `cs` at `0x10200` because execution doesn't start from the start of file, but from:
```assembly ```assembly
_start: _start:
@ -365,7 +365,7 @@ _start:
.byte start_of_setup-1f .byte start_of_setup-1f
``` ```
jump, which is at a `512` byte offset from [4d 5a](https://github.com/torvalds/linux/blob/master/arch/x86/boot/header.S#L46). It also needs to align `cs` from `0x1020` to `0x1000`, as well as all other segment registers. After that, we set up the stack: jump, which is at a `512` byte offset from [4d 5a](https://github.com/torvalds/linux/blob/master/arch/x86/boot/header.S#L46). It also needs to align `cs` from `0x10200` to `0x10000`, as well as all other segment registers. After that, we set up the stack:
```assembly ```assembly
pushw %ds pushw %ds