Commit 56411971 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 323df0d2
...@@ -96,7 +96,7 @@ LINKC = $(LINK.c) $< $(LOADLIBES) $(LDLIBS) -o $@ ...@@ -96,7 +96,7 @@ LINKC = $(LINK.c) $< $(LOADLIBES) $(LDLIBS) -o $@
# tests without instrumentation # tests without instrumentation
test.t : $(TESTS:%=%.trun) test.t : $(TESTS:%=%.trun)
%.trun : %.t %.trun : %.t
$(XRUN<) gdb -q -ex run -ex backtrace -ex quit $(XRUN<)
%.t : %.c $(ccan_config) %.t : %.c $(ccan_config)
$(LINKC) $(LINKC)
......
...@@ -223,6 +223,8 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen) ...@@ -223,6 +223,8 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
void *addr; void *addr;
size_t len = pglen * fileh->ramh->ram->pagesize; size_t len = pglen * fileh->ramh->ram->pagesize;
int err = 0; int err = 0;
BigFile *file = fileh->file;
const bigfile_ops *fops = file->file_ops;
sigset_t save_sigset; sigset_t save_sigset;
sigsegv_block(&save_sigset); sigsegv_block(&save_sigset);
...@@ -235,11 +237,22 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen) ...@@ -235,11 +237,22 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
if (!vma->page_ismappedv) if (!vma->page_ismappedv)
goto fail; goto fail;
/* allocate address space somewhere */ // XXX hardcoded - allow user choise?
// XXX overlay: -> mmap(base, READ) + mmap(fileh->dirty_pages) vma->mmap_overlay = (fops->mmap_setup_read != NULL);
addr = mem_valloc(NULL, len);
if (!addr) if (vma->mmap_overlay) {
goto fail; TODO (file->blksize != fileh->ramh->ram->pagesize);
addr = fops->mmap_setup_read(file, pgoffset, pglen, vma);
if (!addr)
goto fail;
// XXX + mmap(fileh->dirty_pages)
} else {
/* allocate address space somewhere */
addr = mem_valloc(NULL, len);
if (!addr)
goto fail;
}
/* everything allocated - link it up */ /* everything allocated - link it up */
vma->addr_start = (uintptr_t)addr; vma->addr_start = (uintptr_t)addr;
......
...@@ -96,6 +96,6 @@ struct bigfile_ops { ...@@ -96,6 +96,6 @@ struct bigfile_ops {
*/ */
void (*release) (BigFile *file); void (*release) (BigFile *file);
}; };
typedef struct bigfile_ops bigfile_ops;
#endif #endif
...@@ -137,6 +137,9 @@ struct VMA { ...@@ -137,6 +137,9 @@ struct VMA {
/* whether corresponding to pgoffset-f_offset page is mapped in this VMA */ /* whether corresponding to pgoffset-f_offset page is mapped in this VMA */
bitmap *page_ismappedv; /* len ~ Δaddr / pagesize */ bitmap *page_ismappedv; /* len ~ Δaddr / pagesize */
// XXX name
unsigned mmap_overlay : 1; /* whether base data are taken as file mmap XXX */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment