From 9f90fa0e3a3cab3b8f035d83ac795d39a4d4ccaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 30 Mar 2005 06:34:17 +0000 Subject: [PATCH] Introduced new B_KERNEL_AREA_FLAGS and B_USER_AREA_FLAGS that can be used instead B_KERNEL_PROTECTION and B_USER_PROTECTION. Unlike before, B_USER_CLONEABLE_AREA is now only in B_KERNEL_AREA_FLAGS, but no longer in B_KERNEL_PROTECTION. This fixes a couple of problems when B_USER_CLONEABLE_AREA was defined without specifing read/write access. PAGE_PRESENT|MODIFIED|ACCESSED are in the same "namespace" as the protection flags, and therefore, shouldn't overlap. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12154 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/vm_priv.h | 6 +++--- headers/private/kernel/vm_types.h | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/headers/private/kernel/vm_priv.h b/headers/private/kernel/vm_priv.h index c489f47a92..73f166f41d 100644 --- a/headers/private/kernel/vm_priv.h +++ b/headers/private/kernel/vm_priv.h @@ -32,9 +32,9 @@ #define RESERVED_REGION_ID -1 // page attributes (in addition to B_READ_AREA etc.) -#define PAGE_MODIFIED 64 -#define PAGE_ACCESSED 128 -#define PAGE_PRESENT 256 +#define PAGE_MODIFIED 0x1000 +#define PAGE_ACCESSED 0x2000 +#define PAGE_PRESENT 0x4000 // Should only be used by vm internals status_t vm_page_fault(addr_t address, addr_t faultAddress, bool isWrite, bool isUser, addr_t *newip); diff --git a/headers/private/kernel/vm_types.h b/headers/private/kernel/vm_types.h index 954a5b6a4b..4a95d3e203 100644 --- a/headers/private/kernel/vm_types.h +++ b/headers/private/kernel/vm_types.h @@ -170,21 +170,24 @@ enum { // Note: the VM probably won't support all combinations - it will try // its best, but create_area() will fail if it has to. // Of course, the exact behaviour will be documented somewhere... -#define B_EXECUTE_AREA 4 -#define B_STACK_AREA 8 +#define B_EXECUTE_AREA 0x04 +#define B_STACK_AREA 0x08 // "stack" protection is not available on most platforms - it's used // to only commit memory as needed, and have guard pages at the // bottom of the stack. // "execute" protection is currently ignored, but nevertheless, you // should use it if you require to execute code in that area. -#define B_KERNEL_EXECUTE_AREA 64 -#define B_KERNEL_STACK_AREA 128 +#define B_KERNEL_EXECUTE_AREA 0x40 +#define B_KERNEL_STACK_AREA 0x80 #define B_USER_PROTECTION \ (B_READ_AREA | B_WRITE_AREA | B_EXECUTE_AREA | B_STACK_AREA) #define B_KERNEL_PROTECTION \ (B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_KERNEL_EXECUTE_AREA \ - | B_KERNEL_STACK_AREA | B_USER_CLONEABLE_AREA) + | B_KERNEL_STACK_AREA) + +#define B_USER_AREA_FLAGS (B_USER_PROTECTION) +#define B_KERNEL_AREA_FLAGS (B_KERNEL_PROTECTION | B_USER_CLONEABLE_AREA) #endif /* _KERNEL_VM_TYPES_H */