From 4eaf08ab83e02be46999a927dfb2dd0f8db250b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 18 Nov 2004 14:33:13 +0000 Subject: [PATCH] Added B_STACK_AREA and B_KERNEL_STACK_AREA protection values. vm_store::fault() now returns a status_t. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10004 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/kernel/vm_types.h | 40 +++++++++++++++++++------------ 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/headers/private/kernel/vm_types.h b/headers/private/kernel/vm_types.h index 2642635d5e..5336905f6c 100644 --- a/headers/private/kernel/vm_types.h +++ b/headers/private/kernel/vm_types.h @@ -1,7 +1,10 @@ -/* -** Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ +/* + * Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de. + * Distributed under the terms of the MIT License. + * + * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ #ifndef _KERNEL_VM_TYPES_H #define _KERNEL_VM_TYPES_H @@ -138,7 +141,7 @@ typedef struct vm_store_ops { bool (*has_page)(struct vm_store *backing_store, off_t offset); status_t (*read)(struct vm_store *backing_store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes); status_t (*write)(struct vm_store *backing_store, off_t offset, const iovec *vecs, size_t count, size_t *_numBytes); - int (*fault)(struct vm_store *backing_store, struct vm_address_space *aspace, off_t offset); + status_t (*fault)(struct vm_store *backing_store, struct vm_address_space *aspace, off_t offset); void (*acquire_ref)(struct vm_store *backing_store); void (*release_ref)(struct vm_store *backing_store); } vm_store_ops; @@ -152,8 +155,8 @@ enum { enum { // ToDo: these are here only temporarily - it's a private - // addition to the BeOS create_area() flags - B_ALREADY_WIRED = 6 + // addition to the BeOS create_area() lock flags + B_ALREADY_WIRED = 6, }; enum { @@ -166,14 +169,21 @@ enum { // 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 - // "execute" protection is not available on x86 - but defining it - // doesn't hurt too much, either :-) - // (but don't use it right now, it's not yet supported at all) -#define B_KERNEL_READ_AREA 8 -#define B_KERNEL_WRITE_AREA 16 -#define B_KERNEL_EXECUTE_AREA 32 +#define B_STACK_AREA 8 + // "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_USER_PROTECTION (B_READ_AREA | B_WRITE_AREA | B_EXECUTE_AREA) -#define B_KERNEL_PROTECTION (B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_KERNEL_EXECUTE_AREA) +#define B_KERNEL_READ_AREA 16 +#define B_KERNEL_WRITE_AREA 32 +#define B_KERNEL_EXECUTE_AREA 64 +#define B_KERNEL_STACK_AREA 128 + +#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) #endif /* _KERNEL_VM_TYPES_H */