diff --git a/headers/private/kernel/arch/vm.h b/headers/private/kernel/arch/vm.h index 841f405ab6..7ba70e2d68 100644 --- a/headers/private/kernel/arch/vm.h +++ b/headers/private/kernel/arch/vm.h @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. * 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 } diff --git a/src/kernel/core/arch/x86/arch_vm.c b/src/kernel/core/arch/x86/arch_vm.c index d679a5d326..0c7b4fece6 100644 --- a/src/kernel/core/arch/x86/arch_vm.c +++ b/src/kernel/core/arch/x86/arch_vm.c @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2002-2005, Axel Dörfler, axeld@pinc-software.de. * 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; +} +