Update linux-bootstrap-3.md

pull/761/head
Z 4 years ago committed by GitHub
parent e68a4c316e
commit a5534ce6c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -515,7 +515,25 @@ It takes two parameters:
Let's look inside `protected_mode_jump`. As I wrote above, you can find it in `arch/x86/boot/pmjump.S`. The first parameter will be in the `eax` register and the second one is in `edx`. Let's look inside `protected_mode_jump`. As I wrote above, you can find it in `arch/x86/boot/pmjump.S`. The first parameter will be in the `eax` register and the second one is in `edx`.
First of all, we put the address of `boot_params` in the `esi` register and the address of the code segment register `cs` in `bx`. After this, we shift `bx` by 4 bits and add it to the memory location labeled `2` (which is `(cs << 4) + in_pm32`, the physical address to jump after transitioned to 32-bit mode) and jump to label `1`. So after this `in_pm32` in label `2` will be overwritten with `(cs << 4) + in_pm32`. First of all, we put the address of `boot_params` in the `esi` register and the address of the code segment register `cs` in `bx`.
```assembly
GLOBAL(protected_mode_jump)
movl %edx, %esi # Pointer to boot_params table
xorl %ebx, %ebx
movw %cs, %bx
```
After this, we shift `bx` by 4 bits and add it to the memory location labeled `2` (which is `(cs << 4) + in_pm32`, the physical address to jump after transitioned to 32-bit mode) and jump to label `1`.
```assembly
shll $4, %ebx
addl %ebx, 2f # Add %ebx to the value stored at label 2
jmp 1f # Short jump to serialize on 386/486
```
So after this `in_pm32` in label `2` will be overwritten with `(cs << 4) + in_pm32`.
Next we put the data segment and the task state segment in the `cx` and `di` registers with: Next we put the data segment and the task state segment in the `cx` and `di` registers with:

Loading…
Cancel
Save