Working (it seems), write remaining userspace next
This commit is contained in:
parent
20891fd58e
commit
ae288941d5
1 changed files with 7 additions and 3 deletions
|
|
@ -1,6 +1,4 @@
|
|||
// [TODO] Clean up headers...
|
||||
// #include <asm/cacheflush.h>
|
||||
#include "linux/atomic/atomic-long.h"
|
||||
#include <linux/device.h>
|
||||
#include "linux/gfp.h"
|
||||
#include "linux/mutex.h"
|
||||
|
|
@ -100,7 +98,11 @@ static vm_fault_t my_shmem_vmops_fault(struct vm_fault *vmf)
|
|||
}
|
||||
|
||||
/* Otherwise, allocate the new page(s) */
|
||||
for (int i = 0; i <= nr_pages_from_vm_start - my_shmem_page_count; i++)
|
||||
ulong nr_pages_to_alloc =
|
||||
nr_pages_from_vm_start - my_shmem_page_count + 1;
|
||||
pr_info("[%s] Not enough remappable pages, allocating %ld more...\n",
|
||||
__func__, nr_pages_to_alloc);
|
||||
for (; nr_pages_to_alloc > 0; nr_pages_to_alloc--)
|
||||
{
|
||||
// Allocate page handle in kernel
|
||||
struct my_shmem_page *new_page = kzalloc(
|
||||
|
|
@ -125,6 +127,8 @@ static vm_fault_t my_shmem_vmops_fault(struct vm_fault *vmf)
|
|||
my_shmem_page_count++;
|
||||
|
||||
// Fill in allocated page entry
|
||||
// Bad for performance, but guarantees to be the last page entry
|
||||
// on out.
|
||||
vmf->page = new_page->page;
|
||||
_dbg_phys = page_to_phys(new_page->page);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue