Yes, exactly.
>
> So you have to fill the file. Seek to one byte before the last in your
> range, and write a single byte. Holes should not bus error, but access
> beyond the end of the file does bus error.
OK.
>
> What is odd is that you are able to access even the first page. IMO
> that should bus error too.
yes.
>
> > Maybe filling
> > it up does the trick - however then the process will get a private copy
> > of all pages in this 1Meg - even the ones that are not touched by the BIOS.
> > This will give me a 1Meg footprint for each real mode image.
>
> Create the file and fill it using lseek/write. Then only 1 page is
> actually allocated in the filesystem and process image. (You can play
> with ftruncate() to get 0 pages -- make the file a bit longer, then
> ftruncate it to remove block allocated by the write).
OK, I'll try this.
>
> When you mmap a file, no memory is actually used until someone touches
> the pages. For a file that's all hole, no disk space is used either so
> this is quite efficient.
>
> It would be nice if reading an mmaped hole would map the zero page, but
> I had a quick look at the path through filemap_no_page and
> block_read_full_page, and it doesn't seem to do that. Since the BIOS
> will probably write to every page it touches that's not such a big deal.
>
OK, thanks. I'll try it out.
Regards,
Egbert.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/