util/m5/m5.c: ensure readfile() buffer pages are in page table
authorJoel Hestness <hestness@cs.utexas.edu>
Fri, 13 Aug 2010 00:16:04 +0000 (17:16 -0700)
committerJoel Hestness <hestness@cs.utexas.edu>
Fri, 13 Aug 2010 00:16:04 +0000 (17:16 -0700)
(and marked dirty, in case that matters) by touching them beforehand

util/m5/m5.c

index 7747fc0bca8a0707475db74fccb05a3886dbff67..96150f2bbfd595f0f97a9d032d97d93408e94668 100644 (file)
@@ -65,6 +65,11 @@ read_file(int dest_fid)
     int offset = 0;
     int len;
 
+    // Touch all buffer pages to ensure they are mapped in the
+    // page table. This is required in the case of X86_FS, where
+    // Linux does demand paging.
+    memset(buf, 0, sizeof(buf));
+
     while ((len = m5_readfile(buf, sizeof(buf), offset)) > 0) {
         write(dest_fid, buf, len);
         offset += len;