Paging Implementation (zh-CN) #1205
Replies: 3 comments
-
|
Nice Content |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
boot process is complex , using too much crates makes it's ... |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Encountered an Error at Error[E0283]: type annotations needed for `x86_64::structures::paging::Page<_>`
--> src/main.rs:27:9
|
27 | let page = Page::containing_address(VirtAddr::new(0xdeadbeaf000));
| ^^^^ ---- type must be known at this point
|
= note: cannot satisfy `_: PageSize
help: the following types implement trait `PageSize`
--> /Users/pxy/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/x86_64-0.14.13/src/structures/paging/page.rs:38:1
|
38 | impl PageSize for Size4KiB {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `x86_64::structures::paging::Size4KiB`
...
45 | impl PageSize for Size2MiB {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `x86_64::structures::paging::Size2MiB`
...
52 | impl PageSize for Size1GiB {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ `x86_64::structures::paging::Size1GiB`
note: required by a bound in `x86_64::structures::paging::Page`
--> /Users/pxy/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/x86_64-0.14.13/src/structures/paging/page.rs:60:20
|
60 | pub struct Page<S: PageSize = Size4KiB> {
| ^^^^^^^^ required by this bound in `Page`
help: consider giving `page` an explicit type, where the type for type parameter `S` is
|
27 | let page: x86_64::structures::paging::Page<S> = Page::containing_address(VirtAddr::new(0xdeadbeaf000));According to the suggestion and annotating the type of page, the problem was solved. (This may be caused by a newer version of Rust?) Solution: fn kernel_main(boot_info: &'static BootInfo) -> ! {
use x86_64::structures::paging::Size4KiB;
[…]
let page: x86_64::structures::paging::Page<Size4KiB> =
Page::containing_address(VirtAddr::new(0xdeadbeaf000));
[…]
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Paging Implementation (zh-CN)
这篇文章展示了如何在我们的内核中实现分页支持。它首先探讨了使物理页表帧能够被内核访问的不同技术,并讨论了它们各自的优点和缺点。然后,它实现了一个地址转换功能和一个创建新映射的功能。
https://os.phil-opp.com/zh-CN/paging-implementation/
Beta Was this translation helpful? Give feedback.
All reactions