vm_store::fault() now returns a status_t.
Some cleanup. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10005 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4eaf08ab83
commit
893e0713fb
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
* Copyright 2004, Axel Dörfler, axeld@pinc-software.de.
|
||||||
** Distributed under the terms of the Haiku License.
|
* Distributed under the terms of the MIT License.
|
||||||
**
|
*
|
||||||
** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||||
** Distributed under the terms of the NewOS License.
|
* Distributed under the terms of the NewOS License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <KernelExport.h>
|
#include <KernelExport.h>
|
||||||
@ -54,7 +54,7 @@ static status_t
|
|||||||
device_write(struct vm_store *store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
device_write(struct vm_store *store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes)
|
||||||
{
|
{
|
||||||
// no place to write, this will cause the page daemon to skip this store
|
// no place to write, this will cause the page daemon to skip this store
|
||||||
return 0;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** this fault handler should take over the page fault routine and map the page in
|
/** this fault handler should take over the page fault routine and map the page in
|
||||||
@ -63,15 +63,13 @@ device_write(struct vm_store *store, off_t offset, const iovec *vecs, size_t cou
|
|||||||
* released after this handler is done
|
* released after this handler is done
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static status_t
|
||||||
device_fault(struct vm_store *_store, struct vm_address_space *aspace, off_t offset)
|
device_fault(struct vm_store *_store, struct vm_address_space *aspace, off_t offset)
|
||||||
{
|
{
|
||||||
struct device_store *store = (struct device_store *)_store;
|
struct device_store *store = (struct device_store *)_store;
|
||||||
vm_cache_ref *cache_ref = store->vm.cache->ref;
|
vm_cache_ref *cache_ref = store->vm.cache->ref;
|
||||||
vm_area *area;
|
vm_area *area;
|
||||||
|
|
||||||
// dprintf("device_fault: offset 0x%x 0x%x + base_addr 0x%x\n", offset, d->base_addr);
|
|
||||||
|
|
||||||
// figure out which page needs to be mapped where
|
// figure out which page needs to be mapped where
|
||||||
mutex_lock(&cache_ref->lock);
|
mutex_lock(&cache_ref->lock);
|
||||||
(*aspace->translation_map.ops->lock)(&aspace->translation_map);
|
(*aspace->translation_map.ops->lock)(&aspace->translation_map);
|
||||||
@ -80,9 +78,6 @@ device_fault(struct vm_store *_store, struct vm_address_space *aspace, off_t off
|
|||||||
for (area = cache_ref->areas; area != NULL; area = area->cache_next) {
|
for (area = cache_ref->areas; area != NULL; area = area->cache_next) {
|
||||||
// make sure this page in the cache that was faulted on is covered in this area
|
// make sure this page in the cache that was faulted on is covered in this area
|
||||||
if (offset >= area->cache_offset && (offset - area->cache_offset) < area->size) {
|
if (offset >= area->cache_offset && (offset - area->cache_offset) < area->size) {
|
||||||
// dprintf("device_fault: mapping paddr 0x%x to vaddr 0x%x\n",
|
|
||||||
// (addr)(d->base_addr + offset),
|
|
||||||
// (addr)(area->base + (offset - area->cache_offset)));
|
|
||||||
(*aspace->translation_map.ops->map)(&aspace->translation_map,
|
(*aspace->translation_map.ops->map)(&aspace->translation_map,
|
||||||
area->base + (offset - area->cache_offset),
|
area->base + (offset - area->cache_offset),
|
||||||
store->base_address + offset, area->protection);
|
store->base_address + offset, area->protection);
|
||||||
@ -92,9 +87,7 @@ device_fault(struct vm_store *_store, struct vm_address_space *aspace, off_t off
|
|||||||
(*aspace->translation_map.ops->unlock)(&aspace->translation_map);
|
(*aspace->translation_map.ops->unlock)(&aspace->translation_map);
|
||||||
mutex_unlock(&cache_ref->lock);
|
mutex_unlock(&cache_ref->lock);
|
||||||
|
|
||||||
// dprintf("device_fault: done\n");
|
return B_OK;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <vm_store_null.h>
|
#include <vm_store_null.h>
|
||||||
#include <kerrors.h>
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
@ -46,11 +44,11 @@ null_write(struct vm_store *store, off_t offset, const iovec *vecs, size_t count
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int
|
static status_t
|
||||||
null_fault(struct vm_store *store, struct vm_address_space *aspace, off_t offset)
|
null_fault(struct vm_store *store, struct vm_address_space *aspace, off_t offset)
|
||||||
{
|
{
|
||||||
/* we can't fault on this region, that's pretty much the point of the null store object */
|
/* we can't fault on this region, that's pretty much the point of the null store object */
|
||||||
return ERR_VM_PF_FATAL;
|
return B_BAD_ADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user