On 8/7/25 14:30, Zhao Liu wrote:
Rust side will use cell::Opaque<> to hide details of C structure, and
this could help avoid the direct operation on C memory from Rust side.
Therefore, it's necessary to wrap a translation binding and make it only
return the pointer to MemoryRegionSection, instead of the copy.
As the first step, make flatview_do_translate return a pointer to
MemoryRegionSection, so that we can build a wrapper based on it.
Independent of Rust, doing the copy as late as possible is good, but
make it return a "const MemoryRegionSection*" so that there's no risk of
overwriting data. Hopefully this does not show a bigger problem!
Paolo
In addtion, add a global variable `unassigned_section` to help get a
pointer to an invalid MemoryRegionSection.