Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/xcl/src/hle/d3d12x/cpu_writes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ pub(super) fn writable(va: usize, bytes: usize) -> bool {
if crate::gpu::uma::get().is_some_and(|u| u.in_committed_window(va, bytes)) {
return true;
}
crate::hle::kernelx::lazy::ensure(va, bytes);
// (held while the protection is asked: a view of a physical page is not guarded again meanwhile)
let _open = crate::hle::kernelx::lazy::ensure(va, bytes);
use windows_sys::Win32::System::Memory::{VirtualQuery, MEMORY_BASIC_INFORMATION, MEM_COMMIT, PAGE_EXECUTE_READWRITE, PAGE_READWRITE};
let mut m: MEMORY_BASIC_INFORMATION = unsafe { std::mem::zeroed() };
let found = unsafe { VirtualQuery(va as *const c_void, &mut m, std::mem::size_of_val(&m)) } != 0;
Expand Down
4 changes: 3 additions & 1 deletion crates/xcl/src/hle/dstorage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,9 @@ unsafe fn read_own(at: usize, out: *mut u8, len: usize) -> bool {
/// Whether `n` bytes at `p` are committed, writable memory.
fn writable(p: usize, n: usize) -> bool {
let Some(end) = p.checked_add(n) else { return false };
crate::hle::kernelx::lazy::ensure(p, n);
// (held while the protection is asked: a view of a physical page is not guarded again
// meanwhile; the copy that follows faults into the guard if one is)
let _open = crate::hle::kernelx::lazy::ensure(p, n);
if crate::gpu::uma::get().is_some_and(|u| u.in_committed_window(p, n)) {
return true;
}
Expand Down
4 changes: 4 additions & 0 deletions crates/xcl/src/hle/kernelx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ pub fn exports() -> Vec<(&'static str, usize)> {
pub const MEM_GRAPHICS: u32 = 0x1000_0000;
mod placeholders;
pub mod lazy;
#[allow(dead_code)] // used once physical pages alias (`XCL_PAGE_ALIAS`)
pub mod sections;
#[allow(dead_code)] // `watch` / `take_dirty` used once physical pages alias (`XCL_PAGE_ALIAS`)
pub mod guards;
pub const MEM_TITLE: u32 = 0x4000_0000;
const STD_ALLOC_MASK: u32 = 0x1000 | 0x2000 | 0x8_0000 | 0x10_0000 | 0x20_0000 | 0x100_0000;
const STD_PROTECT_MASK: u32 = 0xFF | 0x100 | 0x200 | 0x400;
Expand Down
Loading
Loading