Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/src/linux_page.c
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | |||||
#include <linux/preempt.h> | #include <linux/preempt.h> | ||||
#include <linux/fs.h> | #include <linux/fs.h> | ||||
#include <linux/shmem_fs.h> | #include <linux/shmem_fs.h> | ||||
void | void | ||||
si_meminfo(struct sysinfo *si) | si_meminfo(struct sysinfo *si) | ||||
{ | { | ||||
si->totalram = physmem; | si->totalram = physmem; | ||||
si->totalhigh = 0; | si->totalhigh = 0; | ||||
bz: Is this PMAP_HAS_DMAP now? | |||||
Done Inline ActionsLooks like that wulf: Looks like that | |||||
si->mem_unit = PAGE_SIZE; | si->mem_unit = PAGE_SIZE; | ||||
} | } | ||||
void * | void * | ||||
linux_page_address(struct page *page) | linux_page_address(struct page *page) | ||||
{ | { | ||||
if (page->object != kernel_object) { | if (page->object != kernel_object) { | ||||
▲ Show 20 Lines • Show All 249 Lines • ▼ Show 20 Lines | if (page == NULL) { | ||||
} | } | ||||
vm_page_valid(page); | vm_page_valid(page); | ||||
} | } | ||||
pmap_page_set_memattr(page, pgprot2cachemode(prot)); | pmap_page_set_memattr(page, pgprot2cachemode(prot)); | ||||
vma->vm_pfn_count++; | vma->vm_pfn_count++; | ||||
return (VM_FAULT_NOPAGE); | return (VM_FAULT_NOPAGE); | ||||
} | } | ||||
/* | |||||
* Although FreeBSD version of unmap_mapping_range has semantics and types of | |||||
* parameters compatible with Linux version, the values passed in are different | |||||
* @obj should match to vm_private_data field of vm_area_struct returned by | |||||
* mmap file operation handler, see linux_file_mmap_single() sources | |||||
* @holelen should match to size of area to be munmapped. | |||||
*/ | |||||
void | |||||
lkpi_unmap_mapping_range(void *obj, loff_t const holebegin __unused, | |||||
loff_t const holelen, int even_cows __unused) | |||||
{ | |||||
vm_object_t devobj; | |||||
vm_page_t page; | |||||
int i, page_count; | |||||
Not Done Inline ActionsWe always start at pindex 0, so holebegin is ignored. I understand that this may provide the desired semantics (or is it a bug?) but it looks wrong and deserves a comment IMHO. markj: We always start at pindex 0, so `holebegin` is ignored. I understand that this may provide the… | |||||
devobj = cdev_pager_lookup(obj); | |||||
if (devobj != NULL) { | |||||
page_count = OFF_TO_IDX(holelen); | |||||
VM_OBJECT_WLOCK(devobj); | |||||
retry: | |||||
for (i = 0; i < page_count; i++) { | |||||
page = vm_page_lookup(devobj, i); | |||||
if (page == NULL) | |||||
Not Done Inline ActionsWhich vm_object_reference() call does this pair with? markj: Which vm_object_reference() call does this pair with? | |||||
Done Inline ActionsIt lies in linux_file_mmap_single() in sys/compat/linuxkpi/common/src/linux_compat.c (through cdev_pager_allocate() call). This routine is destructor for it. wulf: It lies in linux_file_mmap_single() in `sys/compat/linuxkpi/common/src/linux_compat.c` (through… | |||||
continue; | |||||
if (!vm_page_busy_acquire(page, VM_ALLOC_WAITFAIL)) | |||||
goto retry; | |||||
cdev_pager_free_page(devobj, page); | |||||
} | |||||
VM_OBJECT_WUNLOCK(devobj); | |||||
vm_object_deallocate(devobj); | |||||
} | |||||
} | |||||
Done Inline ActionsProbably %s: func better here now or rather remove this entirely as we don't have a LINUX_VERBOSE_DEBUG? bz: Probably %s: __func__ better here now or rather remove this entirely as we don't have a… | |||||
Done Inline Actions
debugging stuff removed wulf: > Probably %s: __func__ better here now or rather remove this entirely as we don't have a… |
Is this PMAP_HAS_DMAP now?