Discontinuous view section support
This PR extends the pattern language's concept of sections to be more polymorphic. A section is defined as a (not necessarily contiguous!) area of address space which can be read/written with chunked IO operations, and can provide additional information about the chunks of data it contains.
This generalisation allows the implementation of "view sections". These sections don't host chunks themselves, instead they are a view over spans of already existing sections, such as the ones that can be created with std::mem::create_section, or the main section itself.
This allows parsing patterns over discontinuous area of the main section as-if the data was laid out linearly. For example:
auto view = builtin::std::mem::create_view_section("view");
for (u8 j = 0, j < sizeof(data), j = j + 4) {
builtin::std::mem::append_view_section_span(view, 0 /* main section */, j, 2);
}
u128 value @ 0x00 in view;
This PR includes API breakage! The pattern language no longer exposes custom sections as std::vector<u8>, but provides api::Sections instead, which can be easily read to obtain their data.
Additionally, sections now may contain discontinuous data which requires additional care when rendering their contents, as trying to read unmapped areas of a section will result in an IOError being returned.
To support this usecase sections provide an API which may be used to iterate over their chunks' attributes.
Commit-by-commit review is highly advised!