()
| 223 | #[trusted] |
| 224 | #[ensures(valid_linmem(result))] |
| 225 | fn wave_alloc_linmem() -> usize { |
| 226 | let linmem_ptr = mmap( |
| 227 | 0, // let the kernel place the region anywhere |
| 228 | EIGHT_GB, // Linmem + guard page = 8GB |
| 229 | bitwise_or(PROT_READ, PROT_WRITE), // its read/write |
| 230 | bitwise_or(MAP_PRIVATE, MAP_ANONYMOUS), // should not be shared or backed-up to a file |
| 231 | -1, // no file descrptor since we aren't backing to a file |
| 232 | 0, // this arg doesn't matter since we aren't backing to a file |
| 233 | ); |
| 234 | // let x: [u8; 4] = [0,1,2,3]; |
| 235 | // assert!( cool_ptr((&x).as_ptr()) ); |
| 236 | mprotect(linmem_ptr + FOUR_GB, FOUR_GB, PROT_NONE); // Make second 4GB of linear memory a guard page |
| 237 | memset(linmem_ptr, 0, FOUR_GB); // memzero |
| 238 | linmem_ptr |
| 239 | } |
no test coverage detected