Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d5b22ae0
Commit
d5b22ae0
authored
Jun 07, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Support adding overlapping ranges in mmap_add_reserved_area().
parent
1dd6ea70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
virtual.c
dlls/ntdll/unix/virtual.c
+23
-22
No files found.
dlls/ntdll/unix/virtual.c
View file @
d5b22ae0
...
...
@@ -244,42 +244,43 @@ void *anon_mmap_alloc( size_t size, int prot )
static
void
mmap_add_reserved_area
(
void
*
addr
,
SIZE_T
size
)
{
struct
reserved_area
*
area
;
struct
list
*
ptr
;
struct
list
*
ptr
,
*
next
;
void
*
end
,
*
area_end
;
if
(
!
((
intptr_t
)
addr
+
size
))
size
--
;
/* avoid wrap-around */
end
=
(
char
*
)
addr
+
size
;
LIST_FOR_EACH
(
ptr
,
&
reserved_areas
)
{
area
=
LIST_ENTRY
(
ptr
,
struct
reserved_area
,
entry
);
area_end
=
(
char
*
)
area
->
base
+
area
->
size
;
if
(
area
->
base
>
end
)
break
;
if
(
area_end
<
addr
)
continue
;
if
(
area
->
base
>
addr
)
{
/* try to merge with the next one */
if
((
char
*
)
addr
+
size
==
(
char
*
)
area
->
base
)
{
area
->
base
=
addr
;
area
->
size
+=
size
;
return
;
}
break
;
area
->
size
+=
(
char
*
)
area
->
base
-
(
char
*
)
addr
;
area
->
base
=
addr
;
}
else
if
((
char
*
)
area
->
base
+
area
->
size
==
(
char
*
)
addr
)
if
(
area_end
>=
end
)
return
;
/* try to merge with the following ones */
while
((
next
=
list_next
(
&
reserved_areas
,
ptr
)))
{
/* merge with the previous one */
area
->
size
+=
size
;
struct
reserved_area
*
area_next
=
LIST_ENTRY
(
next
,
struct
reserved_area
,
entry
);
void
*
next_end
=
(
char
*
)
area_next
->
base
+
area_next
->
size
;
/* try to merge with the next one too */
if
((
ptr
=
list_next
(
&
reserved_areas
,
ptr
)))
if
(
area_next
->
base
>
end
)
break
;
list_remove
(
next
);
free
(
area_next
);
if
(
next_end
>=
end
)
{
struct
reserved_area
*
next
=
LIST_ENTRY
(
ptr
,
struct
reserved_area
,
entry
);
if
((
char
*
)
addr
+
size
==
(
char
*
)
next
->
base
)
{
area
->
size
+=
next
->
size
;
list_remove
(
&
next
->
entry
);
free
(
next
);
}
end
=
next_end
;
break
;
}
return
;
}
area
->
size
=
(
char
*
)
end
-
(
char
*
)
area
->
base
;
return
;
}
if
((
area
=
malloc
(
sizeof
(
*
area
)
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment