You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think having the semantic differentiation between a PhysicalAddress and a VirtualAddress type provides a lot of value for OS development. What I think would be even better, is to have a [Physical|Virtual]Address type that is coherent across multiple crates AND across different architectures. This could simplify the reuse of code and the compatibility between projects.
Currently, the situation looks as follows:
x86_64 has type definitions for this, but this can only be used on x86_64. These types are apparently widely used in rust-osdev projects (and I use them in our hypervisor as well).
I have copycat-ed this into our aarch64 crate to have a compatible type for aarch64. However, riscv64 etc. is still not supported. (And that crate did really not receive the required love to be adopted elsewhere (yet)).
rust-vmm has a similar approach with their Address Trait. They are using it for GuestAddress'es, which is a use-case for address types I have as well.
In the Hermit OS, we are actually using the x86PAddr and VAddr types for x86, the types from the aforementioned aarch64 crate for the ARM architecture and a custom type for RISC-V
So I was thinking of moving the addresses into a separate crate that is not x86_64 specific anymore. The types from that crate could be used and re-exported in the x86_64 crate without changing any interfaces. I guess it is possible to make it compatible with the x86 crate's types as well. And as I'm on it, I could also implement rust-vmm's traits and add a guest physical address type as well.
However, this only makes sense if there is interest in adopting this approach. Otherwise, we'll just end up with a XKCD927 situation. So, what are your thoughts?
The text was updated successfully, but these errors were encountered:
Hi,
I think having the semantic differentiation between a
PhysicalAddress
and aVirtualAddress
type provides a lot of value for OS development. What I think would be even better, is to have a[Physical|Virtual]Address
type that is coherent across multiple crates AND across different architectures. This could simplify the reuse of code and the compatibility between projects.Currently, the situation looks as follows:
x86_64
has type definitions for this, but this can only be used onx86_64
. These types are apparently widely used in rust-osdev projects (and I use them in our hypervisor as well).aarch64
crate to have a compatible type foraarch64
. However,riscv64
etc. is still not supported. (And that crate did really not receive the required love to be adopted elsewhere (yet)).Address
Trait. They are using it forGuestAddress
'es, which is a use-case for address types I have as well.x86
PAddr
andVAddr
types forx86
, the types from the aforementionedaarch64
crate for the ARM architecture and a custom type for RISC-VSo I was thinking of moving the addresses into a separate crate that is not
x86_64
specific anymore. The types from that crate could be used and re-exported in thex86_64
crate without changing any interfaces. I guess it is possible to make it compatible with thex86
crate's types as well. And as I'm on it, I could also implement rust-vmm's traits and add a guest physical address type as well.However, this only makes sense if there is interest in adopting this approach. Otherwise, we'll just end up with a XKCD927 situation. So, what are your thoughts?
The text was updated successfully, but these errors were encountered: