Introduction to Paging #1011
Replies: 39 comments 2 replies
-
Great post as always! In the diagrams for the multi-level paging, the level 2 table seems to be set to the 24K block, which is its own, but the level 1 table is set at the 32K block. I suspect this was just a typo. |
Beta Was this translation helpful? Give feedback.
-
Yeah, it was a typo. I fixed it a few minutes ago in f423c06. Thanks for reporting! |
Beta Was this translation helpful? Give feedback.
-
Very clear and thoroughly explained. Keep them coming! |
Beta Was this translation helpful? Give feedback.
-
@FrankvdStam Thanks a lot! The next post is already in progress. |
Beta Was this translation helpful? Give feedback.
-
Amazing. Refreshed my knowledge of memory, read almost the same in low-level-programming book by Igor Zhirkov, but information here is a bit more detailed, love that. Thanks everyone who was involved into writing this. |
Beta Was this translation helpful? Give feedback.
-
You're welcome, great to hear that! |
Beta Was this translation helpful? Give feedback.
-
Nice blog。I should like to thank the author for his time。 |
Beta Was this translation helpful? Give feedback.
-
@phil-opp Are you working alone on it? I had read a few books about writing oses and their internals, I am a linux systems developer, have some knowledge on cpu and hardware.. Actually, it's difficult to mention all of areas I am interested in, I just wanted to say that I could help you writing something and you could review my efforts. Also, this book is somewhat similar to csbu (computer science from the bottom up) online book. I read it and translated first parts of it to russian. :) |
Beta Was this translation helpful? Give feedback.
-
@ruier Thanks! :) @vityafx Yes, I'm working alone on it. Thanks for the offer, I'll keep you in mind if I need help! I didn't know csbu, looks interesting. |
Beta Was this translation helpful? Give feedback.
-
Wow, great post! Found these blog series a week ago and following... It’s great! One thing I am curious: When does the blog post about boot loaders come? Thanks for the post :-) |
Beta Was this translation helpful? Give feedback.
-
@pcr910303 Thanks!
I don't know yet… I want to port most of the assembly code of the bootloader to Rust before I write about it. |
Beta Was this translation helpful? Give feedback.
-
@phil-opp I have a question about integration tests... Can there be a way to run integration tests integrated to cargo by putting integration tests in |
Beta Was this translation helpful? Give feedback.
-
I don't know a way to do this since, as you say, the crate is always compiled for the host platform. |
Beta Was this translation helpful? Give feedback.
-
Ahh… That’s something cargo can do it better :-(
I did fall across to the RFC, looking for that….
Wouldn’t there be any way to integrate `bootimage test` to `cargo test`?
… 2019. 1. 18. 오전 2:11, Philipp Oppermann ***@***.***> 작성:
I don't know a way to do this since, as you say, the crate is always compiled for the host platform. cfg(test) does deliberately not work <https://github.com/rust-lang/rust/pull/38823/files> with integration tests, so we have no way to exclude the duplicate lang items. Maybe the custom test frameworks RFC <rust-lang/rust#50297> will help, but it is still not implemented as far as I know.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#519 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AkOxyi-5SLkNE11Zx2mbAaUwhxHVP8Jnks5vEK7MgaJpZM4Z_vDC>.
|
Beta Was this translation helpful? Give feedback.
-
Not that I know.. I would like to integrate it too. |
Beta Was this translation helpful? Give feedback.
-
I do finish reading your post and a big thanks |
Beta Was this translation helpful? Give feedback.
-
@deleteJ Great to hear that! |
Beta Was this translation helpful? Give feedback.
-
In Example Translation
The hex value should be |
Beta Was this translation helpful? Give feedback.
-
In the description of "problem of a single page table", article says:
My confusion here is why the Page Table cannot use a Hash data structure Is it because:
So only array-like method can be used? (Hash like method is too complex for Hardwares?) |
Beta Was this translation helpful? Give feedback.
-
@mitnk Yes, one reason is that the hardware only supports array lookup. Other reasons are the unpredicability of hash map latency (it's only amortized O(1)), its worse lookup performance (array indexing requires less work than hashing + indexing), and the complexity of memory management (how much memory should be allocated for the hash table? how to grow its size without reallocating?). |
Beta Was this translation helpful? Give feedback.
-
@mitnk @phil-opp |
Beta Was this translation helpful? Give feedback.
-
@anlofw Interesting, I didn't know that! It's probably also worth mentioning that there are also architectures (e.g. MIPS) that allow/require you to implement page translation in software. You get an exception for any virtual address that is not available in the TLB and then have to perform the translation yourself, using a data structure of your choice. |
Beta Was this translation helpful? Give feedback.
-
@phil-opp True, there are a few PowerPCs using that approach too. I'm working with a few of those as well. |
Beta Was this translation helpful? Give feedback.
-
Not really able to test that reading from the code segment works. I think maybe one of my packages has changed since the post was written. Looks like my CS (your value is 8) and SS (your value is 0) aren't ever initialized like they are in your example. When writing, it causes a page fault like you would expect: let ptr = 0xdeadbeef as *mut u32;
unsafe { *ptr = 42; }
But notice how my CS and SS aren't initialized and my IP VirtAddr is pretty high. I tried reading from just the lower 32 bits (0x2a00c7) but that didn't work either. Any thoughts? Right now I'm thinking that maybe there a bug in my |
Beta Was this translation helpful? Give feedback.
-
AHA! I found the issue - and the compiler was telling me what was wrong the whole time!
So it looks like the latest run nightlies broke mutable references to the stack frame. No worries. I updated to
Well of course, that's the entire reason we had to update to v0.14.0 in the first place. So the solution - as the compiler already told me - was to change the first parameter of each interrupt handler from I was also able to test that reading from the code page worked fine (I got the And finally, writing to the code page triggered the proper PAGE FAULT exception also:
|
Beta Was this translation helpful? Give feedback.
-
The page table in this example |
Beta Was this translation helpful? Give feedback.
-
I have a problem that I can't figure out. When I run the OS with the code for accessing the memory outside the kernel, so I even tought I forgot something so I opened all the files but everying was ok. The last thing I did was downloading the entire project for this post and copying all the .rs files and the Cargo.toml in my project, but the result is the same. Can someone explaing what's happening? |
Beta Was this translation helpful? Give feedback.
-
I hated that I saw this series of articles so late!!! |
Beta Was this translation helpful? Give feedback.
-
Amazing! Life changing. I tried to do it in assembly 😭 |
Beta Was this translation helpful? Give feedback.
-
This is a general purpose comment thread for the “Introduction to Paging” post.
Beta Was this translation helpful? Give feedback.
All reactions