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:
Axel Dörfler
2005-04-05 13:50:37 +00:00
parent 0bf4c7c564
commit f05e261fd7
2 changed files with 18 additions and 2 deletions
+2 -1
View File
@@ -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
}
+16 -1
View File
@@ -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;
}