The title's writes into guarded blocks go in beside the guard: its memcpy, memmove and memset (VICTORY_COPY_BESIDE=1) and single stores that fault (VICTORY_STORE_BESIDE=1); both off
Most of what faults is the runtime's memcpy (a third by time) and single stores into objects that lie in memory some copy covers: flags, reference counts, links of free lists. The bytes are put in through our own view of the page, the block told as written at every view by a bit that the next asking takes: no protection changes, for the write or for the next taking. Copies: the title's imports are ours and look at the blocks' bits. Stores: the instruction that faulted is decoded and done in the handler. Too many to a block, or code that fills blocks: opened as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
7bc7c0748d
commit
f19e55b8b6
8 files changed
+1229
-16
No files matched your search
@@ -565,6 +565,34 @@ pub(crate) fn beside(at: usize, len: usize) -> Option<usize> {
|
||||
(base != 0).then(|| base + offset as usize)
|
||||
}
|
||||
|
||||
/// Our own address of the 64 KiB page the title sees at `page` ([`beside`]),
|
||||
/// and every address the title sees it at (0: no more); `None` if the page is
|
||||
/// in no view of a section, or in very many. While the caller holds
|
||||
/// `crate::watch::title_memory_reading`.
|
||||
pub(crate) fn beside_page(page: usize) -> Option<(usize, [usize; 8])> {
|
||||
for asked in [false, true] {
|
||||
{
|
||||
let v = views();
|
||||
let (&base, &(bytes, section, offset)) = v.views.range(..=page).next_back()?;
|
||||
let within = page.wrapping_sub(base);
|
||||
if within >= bytes || !within.is_multiple_of(K64) {
|
||||
return None;
|
||||
}
|
||||
let offset = offset + within as u64;
|
||||
if let Some(whole) = v.whole.iter().find(|w| w.0 == section) {
|
||||
let mut shown = [0; 8];
|
||||
let all = v.pages.get(&(section, offset))?;
|
||||
shown.get_mut(..all.len())?.copy_from_slice(all);
|
||||
return (whole.1 != 0).then(|| (whole.1 + offset as usize, shown));
|
||||
}
|
||||
}
|
||||
if asked || beside(page, K64).is_none() {
|
||||
return None;
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Whether `[at, at + len)` is private memory, all committed and
|
||||
/// read-write: what [`From::Part`] takes. One question to Windows (it
|
||||
/// walks the page tables to the end of the pages that share the first
|
||||
|
||||
Reference in new issue
Block a user