boot: STACK_SIZE is 1024 now

since d594aa0277 (diff-0af1468d3dc7f373d70011eda7be1592)
pull/517/head
Alexander Kuleshov 7 years ago
parent 96afdad6f4
commit 220d3378f7

@ -432,7 +432,7 @@ Field name: loadflags
functionality will be disabled. 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) ![stack](http://oi62.tinypic.com/dr7b5w.jpg)

@ -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`. or in other words `stack_end = esp - STACK_SIZE`.
Then there is the `heap_end` calculation: 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. 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.

Loading…
Cancel
Save