1-- The address space: what `virtual_query` says of a region, beside
2-- windows.ldn's `virtual_alloc` and `virtual_free`, which the entry uses
3-- too. Windows reserves address space in units of its allocation
4-- granularity, 64 KiB, and commits it in pages, 4 KiB on x86-64.
5
6fixed if compiler.os == windows then
7 --- The page `virtual_alloc` commits in.
8 public page_bytes: usize = 4096
9
10 --- The unit `virtual_alloc` reserves address space in.
11 public allocation_granularity: usize = 65536
12
13 --- `MEMORY_BASIC_INFORMATION`: the run of pages from `base` alike in
14 --- state and protection, `size` bytes long, and the reservation
15 --- `allocation_base` that holds them.
16 public memory_information: type = struct
17 base: usize
18 allocation_base: usize
19 allocation_protection: u32
20 partition: u16
21 reserved_1: u16
22 size: usize
23 state: u32
24 protection: u32
25 kind: u32
26 reserved_2: u32
27 end memory_information
28
29 --- `MEM_RESERVE`, the state of pages reserved and not committed.
30 public state_reserved: u32 = 0x2000
31
32 --- Describe the pages at `address`, `VirtualQuery`, into `into`: the
33 --- bytes written, or zero with the reason in `last_error`.
34 public extern(c) link(symbol: "VirtualQuery") virtual_query:
35 (address: usize, into: ptr mut memory_information, bytes: usize)
36 -> (written: usize)
37end if