Alexandre Julliard : ntdll: Use the map_view() function to allocate
TEBs, now that it supports an arbitrary granularity.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jul 14 10:50:22 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: bb63a325d727339c7afc1d4fb8c7556ebe875117
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=bb63a325d727339c7afc1d4fb8c7556ebe875117
Author: Alexandre Julliard <julliard at winehq.org>
Date: Thu Jul 13 20:38:31 2006 +0200
ntdll: Use the map_view() function to allocate TEBs, now that it supports an arbitrary granularity.
---
dlls/ntdll/virtual.c | 24 +++---------------------
1 files changed, 3 insertions(+), 21 deletions(-)
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
index e00acfb..cd0beab 100644
--- a/dlls/ntdll/virtual.c
+++ b/dlls/ntdll/virtual.c
@@ -1156,11 +1156,9 @@ #endif /* page_mask */
*/
NTSTATUS VIRTUAL_alloc_teb( void **ret, size_t size, BOOL first )
{
- void *ptr;
NTSTATUS status;
struct file_view *view;
size_t align_size;
- BYTE vprot = VPROT_READ | VPROT_WRITE | VPROT_COMMITTED;
if (first) virtual_init();
@@ -1169,31 +1167,15 @@ NTSTATUS VIRTUAL_alloc_teb( void **ret,
align_size = page_size;
while (align_size < size) align_size *= 2;
- for (;;)
- {
- if ((ptr = wine_anon_mmap( NULL, 2 * align_size, VIRTUAL_GetUnixProt(vprot), 0 )) == (void *)-1)
- {
- if (errno == ENOMEM) return STATUS_NO_MEMORY;
- return STATUS_INVALID_PARAMETER;
- }
- if (!is_beyond_limit( ptr, 2 * align_size, user_space_limit ))
- {
- ptr = unmap_extra_space( ptr, 2 * align_size, align_size, align_size - 1 );
- break;
- }
- /* if we got something beyond the user limit, unmap it and retry */
- add_reserved_area( ptr, 2 * align_size );
- }
-
if (!first) RtlEnterCriticalSection( &csVirtual );
- status = create_view( &view, ptr, size, vprot );
+ status = map_view( &view, NULL, align_size, align_size - 1,
+ VPROT_READ | VPROT_WRITE | VPROT_COMMITTED );
if (status == STATUS_SUCCESS)
{
view->flags |= VFLAG_VALLOC;
- *ret = ptr;
+ *ret = view->base;
}
- else unmap_area( ptr, size );
if (!first) RtlLeaveCriticalSection( &csVirtual );
More information about the wine-cvs
mailing list