fd = open("12-donn_beach.exe", O_RDONLY); for (int i = 0; sections[i].size; i++) { Section sec = sections[i]; void* r = mmap((void*)sec.vma, roundup(sec.size), // めんどくさいので全部フラグ立てる PROT_READ | PROT_WRITE | PROT_EXEC, MAP_ANONYMOUS | MAP_FIXED | MAP_PRIVATE, -1, 0); lseek(fd, sec.off, SEEK_SET); read(fd, (void*)sec.vma, sec.size); }