mirror of
https://github.com/0xAX/linux-insides.git
synced 2024-12-22 14:48:08 +00:00
Merge pull request #808 from renaudgermain/copyedit-booting
copyedit: booting chapter
This commit is contained in:
commit
56b6fb3951
@ -46,7 +46,7 @@ This function takes five parameters:
|
|||||||
* `input`;
|
* `input`;
|
||||||
* `input_size`;
|
* `input_size`;
|
||||||
* `output`;
|
* `output`;
|
||||||
* `output_isze`;
|
* `output_size`;
|
||||||
* `virt_addr`.
|
* `virt_addr`.
|
||||||
|
|
||||||
Let's try to understand what these parameters are. The first parameter, `input` is just the `input_data` parameter of the `extract_kernel` function from the [arch/x86/boot/compressed/misc.c](https://github.com/torvalds/linux/blob/v4.16/arch/x86/boot/compressed/misc.c) source code file, cast to `unsigned long`:
|
Let's try to understand what these parameters are. The first parameter, `input` is just the `input_data` parameter of the `extract_kernel` function from the [arch/x86/boot/compressed/misc.c](https://github.com/torvalds/linux/blob/v4.16/arch/x86/boot/compressed/misc.c) source code file, cast to `unsigned long`:
|
||||||
@ -146,7 +146,7 @@ Now, we call another function:
|
|||||||
initialize_identity_maps();
|
initialize_identity_maps();
|
||||||
```
|
```
|
||||||
|
|
||||||
The `initialize_identity_maps` function is defined in the [arch/x86/boot/compressed/kaslr_64.c](https://github.com/torvalds/linux/blob/master/arch/x86/boot/compressed/kaslr_64.c) source code file. This function starts by initialising an instance of the `x86_mapping_info` structure called `mapping_info`:
|
The `initialize_identity_maps` function is defined in the [arch/x86/boot/compressed/kaslr_64.c](https://github.com/torvalds/linux/blob/master/arch/x86/boot/compressed/kaslr_64.c) source code file. This function starts by initializing an instance of the `x86_mapping_info` structure called `mapping_info`:
|
||||||
|
|
||||||
```C
|
```C
|
||||||
mapping_info.alloc_pgt_page = alloc_pgt_page;
|
mapping_info.alloc_pgt_page = alloc_pgt_page;
|
||||||
@ -254,7 +254,7 @@ add_identity_map(mem_avoid[MEM_AVOID_ZO_RANGE].start,
|
|||||||
mem_avoid[MEM_AVOID_ZO_RANGE].size);
|
mem_avoid[MEM_AVOID_ZO_RANGE].size);
|
||||||
```
|
```
|
||||||
|
|
||||||
THe `mem_avoid_init` function first tries to avoid memory regions currently used to decompress the kernel. We fill an entry from the `mem_avoid` array with the start address and the size of the relevant region and call the `add_identity_map` function, which builds the identity mapped pages for this region. The `add_identity_map` function is defined in the [arch/x86/boot/compressed/kaslr_64.c](https://github.com/torvalds/linux/blob/v4.16/arch/x86/boot/compressed/kaslr_64.c) source code file and looks like this:
|
The `mem_avoid_init` function first tries to avoid memory regions currently used to decompress the kernel. We fill an entry from the `mem_avoid` array with the start address and the size of the relevant region and call the `add_identity_map` function, which builds the identity mapped pages for this region. The `add_identity_map` function is defined in the [arch/x86/boot/compressed/kaslr_64.c](https://github.com/torvalds/linux/blob/v4.16/arch/x86/boot/compressed/kaslr_64.c) source code file and looks like this:
|
||||||
|
|
||||||
```C
|
```C
|
||||||
void add_identity_map(unsigned long start, unsigned long size)
|
void add_identity_map(unsigned long start, unsigned long size)
|
||||||
|
Loading…
Reference in New Issue
Block a user