def setUp(self): self.device_name = "/dev/phys_mem" self.device = physmem.Physmem(self.device_name) self.IOCTL_CONFIGURE = 1074547456 self.allowed_sources = physmem.SOURCE_HW_POISON_ANON self.assertEquals(8, sizeof(c_uint64), "unit64 != 8 bytes") x = POINTER(physmem.Phys_mem_frame_request) self.assertEquals( 8, sizeof(x), "pointer == %d bit, should be 64 bit" % (sizeof(x), )) self.assertEquals( 8, sizeof(POINTER(physmem.Phys_mem_frame_request)), "pointer == %d bit, should be 64 bit" % (sizeof(POINTER(physmem.Phys_mem_frame_request)), )) self.assertEquals(16, sizeof(physmem.Phys_mem_frame_request), "Phys_mem_frame_request != 16 bytes") self.assertEquals(56, sizeof(physmem.Phys_mem_frame_status), "Phys_mem_frame_status != 56 bytes") self.assertEquals(24, sizeof(physmem.Phys_mem_request), "Phys_mem_request != 24 bytes") self.assertEquals(16, sizeof(physmem.Mark_page_poison), "Mark_page_poison != 16 bytes")
from kpage import * import physmem if __name__ == '__main__': pass print("Ok") kpageflags.KPageFlags(kpageflags.BUDDY) physmem.Physmem("/dev/physmem")
timestamping = status.TimestampingFacility() pageflags = kpage.FlagsDataSource('flags', "/proc/kpageflags").open() pagecount = kpage.CountDataSource('count', "/proc/kpagecount").open() num_frames = pageflags.num_frames() if "frame-by-frame" == options.strategy: frame_config_class = scheduling.simple.get_frame_config_class() elif "blockwise" == options.strategy: frame_config_class = scheduling.blockwise.get_frame_config_class() cfg = status.FileBasedConfiguration(path, num_frames, frame_config_class) device_name = "/dev/phys_mem" physmem_dev = physmem.Physmem(device_name) allowed_sources = physmem.SOURCE_FREE_BUDDY_PAGE if "linear" == options.algorithm: test = tester.LinearScanner(PrintTestReporting()) elif "quadratic" == options.algorithm: test = tester.QuadraticScanner(PrintTestReporting()) reporting = PrintSchedulerReporting(options.report_every) if "frame-by-frame" == options.strategy: scheduler_factory = scheduling.simple.SimpleSchedulerFactory( physmem_dev, test, pageflags, pagecount, reporting) elif "blockwise" == options.strategy: scheduler_factory = scheduling.blockwise.SimpleBlockwiseSchedulerFactory(