The VM can now ask the platform dependent part if it supports a specified protection.
create_area() and friends should fail if it's not supported. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12248 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2004, Axel Dörfler, [email protected].
|
||||
* Copyright 2002-2005, Axel Dörfler, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
||||
@@ -21,6 +21,7 @@ status_t arch_vm_init(struct kernel_args *args);
|
||||
status_t arch_vm_init_post_area(struct kernel_args *args);
|
||||
status_t arch_vm_init_end(struct kernel_args *args);
|
||||
void arch_vm_aspace_swap(vm_address_space *aspace);
|
||||
bool arch_vm_supports_protection(uint32 protection);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2004, Axel Dörfler, [email protected].
|
||||
* Copyright 2002-2005, Axel Dörfler, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Copyright 2001, Travis Geiselbrecht. All rights reserved.
|
||||
@@ -77,3 +77,18 @@ arch_vm_aspace_swap(vm_address_space *aspace)
|
||||
i386_swap_pgdir((addr_t)i386_translation_map_get_pgdir(&aspace->translation_map));
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
arch_vm_supports_protection(uint32 protection)
|
||||
{
|
||||
// x86 always has the same read/write properties for userland and the kernel.
|
||||
// That's why we do not support user-read/kernel-write access. While the
|
||||
// other way around is not supported either, we don't care in this case
|
||||
// and give the kernel full access.
|
||||
if ((protection & (B_READ_AREA | B_WRITE_AREA)) == B_READ_AREA
|
||||
&& protection & B_KERNEL_WRITE_AREA)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user