Re:Writing an OS in Rust: Introduction to Paging
by amelius on Monday January 14, 2019 @08:57PM
(#18908291)
Perhaps this problem can be overcome by modifying the concept of a pointer slightly, to make it a "based pointer" (?)
I found an old discussion on this topic here: https://news.ycombinator.com/item?id=13890011
Note that the Microsoft C++ compiler implements based pointers, using the __based keyword.
Re:Writing an OS in Rust: Introduction to Paging
by Zoh0eich on Tuesday January 15, 2019 @06:00AM
(#18910269)
Specialized data structures can be built that contain primitives and other types supporting this kind of thing. But you still can't store arbitrary data because they could contain FFI pointers, handles to native resources, things that need to run destructors etc.
So to do this safely all the types must be whitelisted through a custom trait. Copy is close, but not quite, since references are still Copy.
Just allocating into such a memory region (essentially custom page swapping) will eventually be possible with data structures that can be constructed with custom allocators, but it still wouldn't be ok to reload those.