Skip to content

Commit

Permalink
Minor grammar fixes (#894)
Browse files Browse the repository at this point in the history
2 small fixes 

"we don't have implemented" -> "we haven't implemented"  

and 

"We use lazy_static again, because Rust's const evaluator is not powerful enough yet" -> "As before, we use lazy_static again." 

just to remove what has already been said a few paragraphs up. 

Thank you for this amazing resource!
  • Loading branch information
delta1 committed Dec 31, 2020
1 parent b6ff79a commit ceb52ac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions blog/content/edition-2/posts/06-double-faults/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ lazy_static! {

We use `lazy_static` because Rust's const evaluator is not yet powerful enough to do this initialization at compile time. We define that the 0th IST entry is the double fault stack (any other IST index would work too). Then we write the top address of a double fault stack to the 0th entry. We write the top address because stacks on x86 grow downwards, i.e. from high addresses to low addresses.

We don't have implemented memory management yet, so we don't have a proper way to allocate a new stack. Instead, we use a `static mut` array as stack storage for now. The `unsafe` is required because the compiler can't guarantee race freedom when mutable statics are accessed. It is important that it is a `static mut` and not an immutable `static`, because otherwise the bootloader will map it to a read-only page. We will replace this with a proper stack allocation in a later post, then the `unsafe` will be no longer needed at this place.
We haven't implemented memory management yet, so we don't have a proper way to allocate a new stack. Instead, we use a `static mut` array as stack storage for now. The `unsafe` is required because the compiler can't guarantee race freedom when mutable statics are accessed. It is important that it is a `static mut` and not an immutable `static`, because otherwise the bootloader will map it to a read-only page. We will replace this with a proper stack allocation in a later post, then the `unsafe` will be no longer needed at this place.

Note that this double fault stack has no guard page that protects against stack overflow. This means that we should not do anything stack intensive in our double fault handler because a stack overflow might corrupt the memory below the stack.

Expand Down Expand Up @@ -301,7 +301,7 @@ lazy_static! {
}
```

We use `lazy_static` again, because Rust's const evaluator is not powerful enough yet. We create a new GDT with a code segment and a TSS segment.
As before, we use `lazy_static` again. We create a new GDT with a code segment and a TSS segment.

#### Loading the GDT

Expand Down

0 comments on commit ceb52ac

Please sign in to comment.