| ... | @@ -429,11 +429,7 @@ pub const StackIterator = struct { | ... | @@ -429,11 +429,7 @@ pub const StackIterator = struct { |
| 429 | if (native_os == .freestanding) return true; | 429 | if (native_os == .freestanding) return true; |
| 430 | | 430 | |
| 431 | const aligned_address = address & ~@intCast(usize, (mem.page_size - 1)); | 431 | const aligned_address = address & ~@intCast(usize, (mem.page_size - 1)); |
| 432 | | 432 | const aligned_memory = @intToPtr([*]align(mem.page_size) u8, aligned_address)[0..mem.page_size]; |
| 433 | // If the address does not span 2 pages, query only the first one | | |
| 434 | const length: usize = if (aligned_address == address) mem.page_size else 2 * mem.page_size; | | |
| 435 | | | |
| 436 | const aligned_memory = @intToPtr([*]align(mem.page_size) u8, aligned_address)[0..length]; | | |
| 437 | | 433 | |
| 438 | if (native_os != .windows) { | 434 | if (native_os != .windows) { |
| 439 | if (native_os != .wasi) { | 435 | if (native_os != .wasi) { |
| ... | @@ -451,11 +447,10 @@ pub const StackIterator = struct { | ... | @@ -451,11 +447,10 @@ pub const StackIterator = struct { |
| 451 | } else { | 447 | } else { |
| 452 | const w = os.windows; | 448 | const w = os.windows; |
| 453 | var memory_info: w.MEMORY_BASIC_INFORMATION = undefined; | 449 | var memory_info: w.MEMORY_BASIC_INFORMATION = undefined; |
| 454 | //const memory_info_ptr = @ptrCast(w.PMEMORY_BASIC_INFORMATION, buffer); | | |
| 455 | | 450 | |
| 456 | // The only error this function can throw is ERROR_INVALID_PARAMETER. | 451 | // The only error this function can throw is ERROR_INVALID_PARAMETER. |
| 457 | // supply an address that invalid i'll be thrown. | 452 | // supply an address that invalid i'll be thrown. |
| 458 | const rc = w.VirtualQuery(aligned_memory.ptr, &memory_info, aligned_memory.len) catch { | 453 | const rc = w.VirtualQuery(aligned_memory, &memory_info, aligned_memory.len) catch { |
| 459 | return false; | 454 | return false; |
| 460 | }; | 455 | }; |
| 461 | | 456 | |