diff options
author | Ian Moffett <ian@osmora.org> | 2024-04-18 15:06:22 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-04-18 15:06:22 -0400 |
commit | 0e24592cb32f61bb59caad30ea9acc524974c6dd (patch) | |
tree | f229e71727d51d0a21bf9da0e7111c2376f745a7 /sys/vm/vm_pager.c | |
parent | 691302ee1f22a5458c4dab3d5f85cc3de9332bb5 (diff) |
kernel: vm: Add device pager
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/vm/vm_pager.c')
-rw-r--r-- | sys/vm/vm_pager.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/sys/vm/vm_pager.c b/sys/vm/vm_pager.c index b82a9e1..0046e9c 100644 --- a/sys/vm/vm_pager.c +++ b/sys/vm/vm_pager.c @@ -45,3 +45,24 @@ vm_pager_get(struct vm_object *obj, off_t off, size_t len, struct vm_page *pg) return pgops->get(obj, off, len, pg); } + +/* + * Get physical address. + * + * TODO: Remove this and add demanding paging. + */ +int +vm_pager_paddr(struct vm_object *obj, paddr_t *paddr, vm_prot_t prot) +{ + struct vm_pagerops *pgops = obj->pgops; + + if (obj->is_anon) { + return -1; + } + + if (pgops->get_paddr == NULL) { + return 0; + } + + return pgops->get_paddr(obj, paddr, prot); +} |