diff --git a/Booting/linux-bootstrap-1.md b/Booting/linux-bootstrap-1.md index d60496e..31930c5 100644 --- a/Booting/linux-bootstrap-1.md +++ b/Booting/linux-bootstrap-1.md @@ -432,7 +432,7 @@ Field name: loadflags functionality will be disabled. ``` -If the `CAN_USE_HEAP` bit is set, we put `heap_end_ptr` into `dx` (which points to `_end`) and add `STACK_SIZE` (minimum stack size, `512` bytes) to it. After this, if `dx` is not carried (it will not be carried, `dx = _end + 512`), jump to label `2` (as in the previous case) and make a correct stack. +If the `CAN_USE_HEAP` bit is set, we put `heap_end_ptr` into `dx` (which points to `_end`) and add `STACK_SIZE` (minimum stack size, `1024` bytes) to it. After this, if `dx` is not carried (it will not be carried, `dx = _end + 1024`), jump to label `2` (as in the previous case) and make a correct stack. ![stack](http://oi62.tinypic.com/dr7b5w.jpg) diff --git a/Booting/linux-bootstrap-2.md b/Booting/linux-bootstrap-2.md index b4bc0b3..e82c4f2 100644 --- a/Booting/linux-bootstrap-2.md +++ b/Booting/linux-bootstrap-2.md @@ -329,10 +329,12 @@ First of all `init_heap` checks the [`CAN_USE_HEAP`](https://github.com/torvalds or in other words `stack_end = esp - STACK_SIZE`. Then there is the `heap_end` calculation: -```c - heap_end = (char *)((size_t)boot_params.hdr.heap_end_ptr + 0x200); + +```C + heap_end = (char *)((size_t)boot_params.hdr.heap_end_ptr + 0x200); ``` -which means `heap_end_ptr` or `_end` + `512`(`0x200h`). The last check is whether `heap_end` is greater than `stack_end`. If it is then `stack_end` is assigned to `heap_end` to make them equal. + +which means `heap_end_ptr` or `_end` + `512` (`0x200h`). The last check is whether `heap_end` is greater than `stack_end`. If it is then `stack_end` is assigned to `heap_end` to make them equal. Now the heap is initialized and we can use it using the `GET_HEAP` method. We will see how it is used, how to use it and how it is implemented in the next posts.