util/m5/m5.c: ensure readfile() buffer pages are in page table

(and marked dirty, in case that matters) by touching them beforehand
This commit is contained in:
Joel Hestness 2010-08-12 17:16:04 -07:00
parent 53c241fc16
commit 73d9a51835

View 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;