Kernel reads, remapped views, freed memory and lost writes of title memory

- What the kernel is writing (file reads) is not guarded by a refresh before
  the call is done (`kernel_writing`): the read would have failed.
- A title thread that uses a page while the runtime remaps another page of
  the same view waits for that in the fault handler; it faulted on a page
  the title never gave up.
- Blocks being unmapped are not guarded again, memory the title frees leaves
  no notes of its blocks (its VirtualFree is taken over), and other memory at
  an address once guarded or absent keeps its protection.
- The second part of a submission's one asking has a number of its own.
- What shaders wrote waits for a change of mapping instead of being lost;
  what could not be written is counted and said; zeros into title memory
  that went are no fault.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-24 23:10:44 -06:00
1 parent 9f22d574bc
commit 8a475da9cf
9 files changed
+803 -32

No files matched your search

+4 -2
View File
@@ -1035,12 +1035,14 @@ fn into_destination(
) -> Result<(), HRESULT> {
if request.options & PAGE_DESTINATION == 0 {
// Raw reads land through the kernel, which does not fault into the
// GPU side's guard on title buffers; open them first.
victory_gpu::kernel_will_write(request.destination as usize, len);
// GPU side's guard on title buffers; open them first, and until the
// bytes are there.
let writing = victory_gpu::kernel_writing(request.destination as usize, len);
// SAFETY: the title's destination holds `destination_size` bytes, at
// least `len`, and nothing else writes it until completion.
let out = unsafe { std::slice::from_raw_parts_mut(request.destination.cast::<u8>(), len) };
let filled = fill(out).map(drop);
drop(writing);
// Again now that the bytes are there: a texture looked at in between
// was uploaded without them (`xmem::pages_written`).
if super::xmem::stream_notice() {