blob: 43aba7fee90ccde61e944c3f5739273ae731337f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <iostream>
#include <unistd.h>
#include <sys/mman.h>
#include <string>
#define GIG (1024*1024*1024ul)
#define VOLUME (2ul*GIG)
// Real values is in the ~65536, only use half of it to be safe
// sysctl vm.max_map_count
#define MAXMMAPS 32768
int main(int argc, char **argv) {
auto page_size = sysconf(_SC_PAGESIZE);
std::cout << "The system have a page size of " << page_size << std::endl;
auto dst = (long*)malloc(VOLUME);
// Src is using anonymous mapping
long nmaps = std::stoi(argv[1]);
if (GIG % (page_size * nmaps) != 0) {
std::cout << "nmaps is not perfect multiple" << std::endl;
nmaps = GIG / (page_size * nmaps);
}
std::cout << argv[1] << std::endl;
uint8_t *hint = (uint8_t*)0x600000000000UL;
mmap(hint);
auto src =
return 0;
}
|