winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
June 2023
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
1 participants
633 discussions
Start a n
N
ew thread
Davide Beatrici : winecoreaudio: Use mmdevapi's AudioClient's SetEventHandle, Reset, Stop.
by Alexandre Julliard
07 Jun '23
07 Jun '23
Module: wine Branch: master Commit: cc3362ec6c593ed577f4b683108c89a49c30ccd8 URL:
https://gitlab.winehq.org/wine/wine/-/commit/cc3362ec6c593ed577f4b683108c89…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Wed Jun 7 00:28:20 2023 +0200 winecoreaudio: Use mmdevapi's AudioClient's SetEventHandle, Reset, Stop. --- dlls/winecoreaudio.drv/mmdevdrv.c | 57 +++++---------------------------------- 1 file changed, 7 insertions(+), 50 deletions(-) diff --git a/dlls/winecoreaudio.drv/mmdevdrv.c b/dlls/winecoreaudio.drv/mmdevdrv.c index dcd712c7c7a..3c3d9b0b1ac 100644 --- a/dlls/winecoreaudio.drv/mmdevdrv.c +++ b/dlls/winecoreaudio.drv/mmdevdrv.c @@ -811,55 +811,12 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) return S_OK; } -static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct stop_params params; - - TRACE("(%p)\n", This); - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - UNIX_CALL(stop, ¶ms); - return params.result; -} - -static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct reset_params params; - - TRACE("(%p)\n", This); - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - UNIX_CALL(reset, ¶ms); - return params.result; -} - -static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface, - HANDLE event) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct set_event_handle_params params; +extern HRESULT WINAPI client_Stop(IAudioClient3 *iface); - TRACE("(%p)->(%p)\n", This, event); +extern HRESULT WINAPI client_Reset(IAudioClient3 *iface); - if(!event) - return E_INVALIDARG; - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - params.event = event; - UNIX_CALL(set_event_handle, ¶ms); - return params.result; -} +extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, + HANDLE event); extern HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid, void **ppv); @@ -898,9 +855,9 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_GetMixFormat, AudioClient_GetDevicePeriod, AudioClient_Start, - AudioClient_Stop, - AudioClient_Reset, - AudioClient_SetEventHandle, + client_Stop, + client_Reset, + client_SetEventHandle, client_GetService, client_IsOffloadCapable, client_SetClientProperties,
1
0
0
0
Davide Beatrici : winealsa: Use mmdevapi's AudioClient's SetEventHandle, Reset, Stop.
by Alexandre Julliard
07 Jun '23
07 Jun '23
Module: wine Branch: master Commit: f626aa2ab321c14e307054c28b35e5a6c8c0ed0d URL:
https://gitlab.winehq.org/wine/wine/-/commit/f626aa2ab321c14e307054c28b35e5…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Wed Jun 7 00:27:13 2023 +0200 winealsa: Use mmdevapi's AudioClient's SetEventHandle, Reset, Stop. --- dlls/winealsa.drv/mmdevdrv.c | 63 +++++--------------------------------------- 1 file changed, 7 insertions(+), 56 deletions(-) diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c index b96eba1e0fe..7c2a3d2d9d3 100644 --- a/dlls/winealsa.drv/mmdevdrv.c +++ b/dlls/winealsa.drv/mmdevdrv.c @@ -839,61 +839,12 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) return params.result; } -static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct stop_params params; - - TRACE("(%p)\n", This); - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - - ALSA_CALL(stop, ¶ms); - - return params.result; -} - -static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct reset_params params; - - TRACE("(%p)\n", This); - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - - ALSA_CALL(reset, ¶ms); - - return params.result; -} - -static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface, - HANDLE event) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct set_event_handle_params params; +extern HRESULT WINAPI client_Stop(IAudioClient3 *iface); - TRACE("(%p)->(%p)\n", This, event); +extern HRESULT WINAPI client_Reset(IAudioClient3 *iface); - if(!event) - return E_INVALIDARG; - - if(!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - params.event = event; - - ALSA_CALL(set_event_handle, ¶ms); - - return params.result; -} +extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, + HANDLE event); extern HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid, void **ppv); @@ -932,9 +883,9 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_GetMixFormat, AudioClient_GetDevicePeriod, AudioClient_Start, - AudioClient_Stop, - AudioClient_Reset, - AudioClient_SetEventHandle, + client_Stop, + client_Reset, + client_SetEventHandle, client_GetService, client_IsOffloadCapable, client_SetClientProperties,
1
0
0
0
Davide Beatrici : winepulse: Move AudioClient's SetEventHandle, Reset, Stop into mmdevapi.
by Alexandre Julliard
07 Jun '23
07 Jun '23
Module: wine Branch: master Commit: 13f3d59275c8fde8d2e1f2c6f37e382185c0124d URL:
https://gitlab.winehq.org/wine/wine/-/commit/13f3d59275c8fde8d2e1f2c6f37e38…
Author: Davide Beatrici <git(a)davidebeatrici.dev> Date: Wed Jun 7 00:25:01 2023 +0200 winepulse: Move AudioClient's SetEventHandle, Reset, Stop into mmdevapi. --- dlls/mmdevapi/client.c | 55 ++++++++++++++++++++++++++++++++++++++++++ dlls/winepulse.drv/mmdevdrv.c | 56 ++++++------------------------------------- 2 files changed, 62 insertions(+), 49 deletions(-) diff --git a/dlls/mmdevapi/client.c b/dlls/mmdevapi/client.c index d2d4939bc73..e30e459c6c5 100644 --- a/dlls/mmdevapi/client.c +++ b/dlls/mmdevapi/client.c @@ -196,6 +196,61 @@ const IAudioCaptureClientVtbl AudioCaptureClient_Vtbl = capture_GetNextPacketSize }; +HRESULT WINAPI client_Stop(IAudioClient3 *iface) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + struct stop_params params; + + TRACE("(%p)\n", This); + + if (!This->stream) + return AUDCLNT_E_NOT_INITIALIZED; + + params.stream = This->stream; + + WINE_UNIX_CALL(stop, ¶ms); + + return params.result; +} + +HRESULT WINAPI client_Reset(IAudioClient3 *iface) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + struct reset_params params; + + TRACE("(%p)\n", This); + + if (!This->stream) + return AUDCLNT_E_NOT_INITIALIZED; + + params.stream = This->stream; + + WINE_UNIX_CALL(reset, ¶ms); + + return params.result; +} + +HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, HANDLE event) +{ + struct audio_client *This = impl_from_IAudioClient3(iface); + struct set_event_handle_params params; + + TRACE("(%p)->(%p)\n", This, event); + + if (!event) + return E_INVALIDARG; + + if (!This->stream) + return AUDCLNT_E_NOT_INITIALIZED; + + params.stream = This->stream; + params.event = event; + + WINE_UNIX_CALL(set_event_handle, ¶ms); + + return params.result; +} + HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid, void **ppv) { struct audio_client *This = impl_from_IAudioClient3(iface); diff --git a/dlls/winepulse.drv/mmdevdrv.c b/dlls/winepulse.drv/mmdevdrv.c index 19d4bd41c7a..64b399f2a2b 100644 --- a/dlls/winepulse.drv/mmdevdrv.c +++ b/dlls/winepulse.drv/mmdevdrv.c @@ -972,54 +972,12 @@ static HRESULT WINAPI AudioClient_Start(IAudioClient3 *iface) return S_OK; } -static HRESULT WINAPI AudioClient_Stop(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct stop_params params; +extern HRESULT WINAPI client_Stop(IAudioClient3 *iface); - TRACE("(%p)\n", This); +extern HRESULT WINAPI client_Reset(IAudioClient3 *iface); - if (!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - pulse_call(stop, ¶ms); - return params.result; -} - -static HRESULT WINAPI AudioClient_Reset(IAudioClient3 *iface) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct reset_params params; - - TRACE("(%p)\n", This); - - if (!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - pulse_call(reset, ¶ms); - return params.result; -} - -static HRESULT WINAPI AudioClient_SetEventHandle(IAudioClient3 *iface, - HANDLE event) -{ - ACImpl *This = impl_from_IAudioClient3(iface); - struct set_event_handle_params params; - - TRACE("(%p)->(%p)\n", This, event); - - if (!event) - return E_INVALIDARG; - if (!This->stream) - return AUDCLNT_E_NOT_INITIALIZED; - - params.stream = This->stream; - params.event = event; - pulse_call(set_event_handle, ¶ms); - return params.result; -} +extern HRESULT WINAPI client_SetEventHandle(IAudioClient3 *iface, + HANDLE event); extern HRESULT WINAPI client_GetService(IAudioClient3 *iface, REFIID riid, void **ppv); @@ -1058,9 +1016,9 @@ static const IAudioClient3Vtbl AudioClient3_Vtbl = AudioClient_GetMixFormat, AudioClient_GetDevicePeriod, AudioClient_Start, - AudioClient_Stop, - AudioClient_Reset, - AudioClient_SetEventHandle, + client_Stop, + client_Reset, + client_SetEventHandle, client_GetService, client_IsOffloadCapable, client_SetClientProperties,
1
0
0
0
Alexandre Julliard : ntdll: Reimplement allocation inside a reserved area without using a callback.
by Alexandre Julliard
07 Jun '23
07 Jun '23
Module: wine Branch: master Commit: 47404fb36cc2db312fcf4b7fdddfdedbd75b78b5 URL:
https://gitlab.winehq.org/wine/wine/-/commit/47404fb36cc2db312fcf4b7fdddfde…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jun 7 12:12:02 2023 +0200 ntdll: Reimplement allocation inside a reserved area without using a callback. And make the allocation limits more explicit. --- dlls/ntdll/unix/virtual.c | 118 +++++++++++++++++++++++++++++----------------- 1 file changed, 74 insertions(+), 44 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index f3362a8b6ef..0de7619ff86 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -1390,7 +1390,7 @@ static void *map_free_area( void *base, void *end, size_t size, int top_down, in * * Find a free area between views inside the specified range. * virtual_mutex must be held by caller. - * The range must be inside the preloader reserved range. + * The range must be inside a reserved area. */ static void *find_reserved_free_area( void *base, void *end, size_t size, int top_down, size_t align_mask ) { @@ -1831,52 +1831,88 @@ static inline void *unmap_extra_space( void *ptr, size_t total_size, size_t want } -struct alloc_area -{ - size_t size; - int top_down; - void *limit; - void *result; - size_t align_mask; -}; - /*********************************************************************** - * alloc_reserved_area_callback + * find_reserved_free_area_outside_preloader * - * Try to map some space inside a reserved area. Callback for mmap_enum_reserved_areas. + * Find a free area inside a reserved area, skipping the preloader reserved range. + * virtual_mutex must be held by caller. */ -static int alloc_reserved_area_callback( void *start, SIZE_T size, void *arg ) +static void *find_reserved_free_area_outside_preloader( void *start, void *end, size_t size, + int top_down, size_t align_mask ) { - struct alloc_area *alloc = arg; - void *end = (char *)start + size; - - if (start < address_space_start) start = address_space_start; - if (is_beyond_limit( start, size, alloc->limit )) end = alloc->limit; - if (start >= end) return 0; + void *ret; - /* make sure we don't touch the preloader reserved range */ - if (preload_reserve_end >= start) + if (preload_reserve_end >= end) + { + if (preload_reserve_start <= start) return NULL; /* no space in that area */ + if (preload_reserve_start < end) end = preload_reserve_start; + } + else if (preload_reserve_start <= start) { - if (preload_reserve_end >= end) + if (preload_reserve_end > start) start = preload_reserve_end; + } + else /* range is split in two by the preloader reservation, try both parts */ + { + if (top_down) { - if (preload_reserve_start <= start) return 0; /* no space in that area */ - if (preload_reserve_start < end) end = preload_reserve_start; + ret = find_reserved_free_area( preload_reserve_end, end, size, top_down, align_mask ); + if (ret) return ret; + end = preload_reserve_start; } - else if (preload_reserve_start <= start) start = preload_reserve_end; else { - /* range is split in two by the preloader reservation, try first part */ - if ((alloc->result = find_reserved_free_area( start, preload_reserve_start, alloc->size, - alloc->top_down, alloc->align_mask ))) - return 1; - /* then fall through to try second part */ + ret = find_reserved_free_area( start, preload_reserve_start, size, top_down, align_mask ); + if (ret) return ret; start = preload_reserve_end; } } - if ((alloc->result = find_reserved_free_area( start, end, alloc->size, alloc->top_down, alloc->align_mask ))) - return 1; + return find_reserved_free_area( start, end, size, top_down, align_mask ); +} - return 0; +/*********************************************************************** + * map_reserved_area + * + * Try to map some space inside a reserved area. + * virtual_mutex must be held by caller. + */ +static void *map_reserved_area( void *limit_low, void *limit_high, size_t size, int top_down, + int unix_prot, size_t align_mask ) +{ + void *ptr = NULL; + struct reserved_area *area = LIST_ENTRY( ptr, struct reserved_area, entry ); + + if (top_down) + { + LIST_FOR_EACH_ENTRY_REV( area, &reserved_areas, struct reserved_area, entry ) + { + void *start = area->base; + void *end = (char *)start + area->size; + + if (start >= limit_high) continue; + if (end <= limit_low) return NULL; + if (start < limit_low) start = limit_low; + if (end > limit_high) end = limit_high; + ptr = find_reserved_free_area_outside_preloader( start, end, size, top_down, align_mask ); + if (ptr) break; + } + } + else + { + LIST_FOR_EACH_ENTRY( area, &reserved_areas, struct reserved_area, entry ) + { + void *start = area->base; + void *end = (char *)start + area->size; + + if (start >= limit_high) return NULL; + if (end <= limit_low) continue; + if (start < limit_low) start = limit_low; + if (end > limit_high) end = limit_high; + ptr = find_reserved_free_area_outside_preloader( start, end, size, top_down, align_mask ); + if (ptr) break; + } + } + if (ptr && anon_mmap_fixed( ptr, size, unix_prot, 0 ) != ptr) ptr = NULL; + return ptr; } /*********************************************************************** @@ -1966,30 +2002,24 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, } else { - struct alloc_area alloc; + void *start = address_space_start; + void *end = user_space_limit; size_t view_size, unmap_size; if (!align_mask) align_mask = granularity_mask; view_size = size + align_mask + 1; - alloc.size = size; - alloc.top_down = top_down; - alloc.limit = limit ? min( (void *)(limit + 1), user_space_limit ) : user_space_limit; - alloc.align_mask = align_mask; + if (limit && (void *)limit < end) end = (char *)limit + 1; - if (mmap_enum_reserved_areas( alloc_reserved_area_callback, &alloc, top_down )) + if ((ptr = map_reserved_area( start, end, size, top_down, get_unix_prot(vprot), align_mask ))) { - ptr = alloc.result; TRACE( "got mem in reserved area %p-%p\n", ptr, (char *)ptr + size ); - if (anon_mmap_fixed( ptr, size, get_unix_prot(vprot), 0 ) != ptr) - return STATUS_INVALID_PARAMETER; goto done; } if (limit) { - if (!(ptr = map_free_area( address_space_start, alloc.limit, size, - top_down, get_unix_prot(vprot), align_mask ))) + if (!(ptr = map_free_area( start, end, size, top_down, get_unix_prot(vprot), align_mask ))) return STATUS_NO_MEMORY; TRACE( "got mem with map_free_area %p-%p\n", ptr, (char *)ptr + size ); goto done;
1
0
0
0
Alexandre Julliard : ntdll: Reimplement map_fixed_area() to avoid recursion and callbacks.
by Alexandre Julliard
07 Jun '23
07 Jun '23
Module: wine Branch: master Commit: 33240c54651ca849e91e8de649c0c779db01d064 URL:
https://gitlab.winehq.org/wine/wine/-/commit/33240c54651ca849e91e8de649c0c7…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jun 7 12:00:14 2023 +0200 ntdll: Reimplement map_fixed_area() to avoid recursion and callbacks. --- dlls/ntdll/unix/virtual.c | 110 ++++++++++++++-------------------------------- 1 file changed, 34 insertions(+), 76 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 074fe7a4559..f3362a8b6ef 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -1463,42 +1463,6 @@ static void remove_reserved_area( void *addr, size_t size ) } -struct area_boundary -{ - void *base; - size_t size; - void *boundary; -}; - -/*********************************************************************** - * get_area_boundary_callback - * - * Get lowest boundary address between reserved area and non-reserved area - * in the specified region. If no boundaries are found, result is NULL. - * virtual_mutex must be held by caller. - */ -static int get_area_boundary_callback( void *start, SIZE_T size, void *arg ) -{ - struct area_boundary *area = arg; - void *end = (char *)start + size; - - area->boundary = NULL; - if (area->base >= end) return 0; - if ((char *)start >= (char *)area->base + area->size) return 1; - if (area->base >= start) - { - if ((char *)area->base + area->size > (char *)end) - { - area->boundary = end; - return 1; - } - return 0; - } - area->boundary = start; - return 1; -} - - /*********************************************************************** * unmap_area * @@ -1918,52 +1882,48 @@ static int alloc_reserved_area_callback( void *start, SIZE_T size, void *arg ) /*********************************************************************** * map_fixed_area * - * mmap the fixed memory area. + * Map a memory area at a fixed address. * virtual_mutex must be held by caller. */ static NTSTATUS map_fixed_area( void *base, size_t size, unsigned int vprot ) { - void *ptr; + int unix_prot = get_unix_prot(vprot); + struct reserved_area *area; + NTSTATUS status; + char *start = base, *end = (char *)base + size; - switch (mmap_is_in_reserved_area( base, size )) - { - case -1: /* partially in a reserved area */ + if (find_view_range( base, size )) return STATUS_CONFLICTING_ADDRESSES; + + LIST_FOR_EACH_ENTRY( area, &reserved_areas, struct reserved_area, entry ) { - NTSTATUS status; - struct area_boundary area; - size_t lower_size; - area.base = base; - area.size = size; - mmap_enum_reserved_areas( get_area_boundary_callback, &area, 0 ); - assert( area.boundary ); - lower_size = (char *)area.boundary - (char *)base; - status = map_fixed_area( base, lower_size, vprot ); - if (status == STATUS_SUCCESS) + char *area_start = area->base; + char *area_end = area_start + area->size; + + if (area_start >= end) break; + if (area_end <= start) continue; + if (area_start > start) { - status = map_fixed_area( area.boundary, size - lower_size, vprot); - if (status != STATUS_SUCCESS) unmap_area( base, lower_size ); + if (anon_mmap_tryfixed( start, area_start - start, unix_prot, 0 ) == MAP_FAILED) goto failed; + start = area_start; } - return status; - } - case 0: /* not in a reserved area, do a normal allocation */ - if ((ptr = anon_mmap_tryfixed( base, size, get_unix_prot(vprot), 0 )) == MAP_FAILED) + if (area_end >= end) { - if (errno == ENOMEM) return STATUS_NO_MEMORY; - if (errno == EEXIST) return STATUS_CONFLICTING_ADDRESSES; - return STATUS_INVALID_PARAMETER; + if (anon_mmap_fixed( start, end - start, unix_prot, 0 ) == MAP_FAILED) goto failed; + return STATUS_SUCCESS; } - break; - - default: - case 1: /* in a reserved area, make sure the address is available */ - if (find_view_range( base, size )) return STATUS_CONFLICTING_ADDRESSES; - /* replace the reserved area by our mapping */ - if ((ptr = anon_mmap_fixed( base, size, get_unix_prot(vprot), 0 )) != base) - return STATUS_INVALID_PARAMETER; - break; + if (anon_mmap_fixed( start, area_end - start, unix_prot, 0 ) == MAP_FAILED) goto failed; + start = area_end; } - if (is_beyond_limit( ptr, size, working_set_limit )) working_set_limit = address_space_limit; + + if (anon_mmap_tryfixed( start, end - start, unix_prot, 0 ) == MAP_FAILED) goto failed; return STATUS_SUCCESS; + +failed: + if (errno == ENOMEM) status = STATUS_NO_MEMORY; + else if (errno == EEXIST) status = STATUS_CONFLICTING_ADDRESSES; + else status = STATUS_INVALID_PARAMETER; + unmap_area( base, start - (char *)base ); + return status; } /*********************************************************************** @@ -1998,12 +1958,10 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, if (base) { - if (is_beyond_limit( base, size, address_space_limit )) - return STATUS_WORKING_SET_LIMIT_RANGE; - if (limit && is_beyond_limit( base, size, (void *)limit )) - return STATUS_CONFLICTING_ADDRESSES; - status = map_fixed_area( base, size, vprot ); - if (status != STATUS_SUCCESS) return status; + if (is_beyond_limit( base, size, address_space_limit )) return STATUS_WORKING_SET_LIMIT_RANGE; + if (limit && is_beyond_limit( base, size, (void *)limit )) return STATUS_CONFLICTING_ADDRESSES; + if ((status = map_fixed_area( base, size, vprot ))) return status; + if (is_beyond_limit( base, size, working_set_limit )) working_set_limit = address_space_limit; ptr = base; } else
1
0
0
0
Alexandre Julliard : ntdll: Reimplement unmap_area() to avoid recursion and callbacks.
by Alexandre Julliard
07 Jun '23
07 Jun '23
Module: wine Branch: master Commit: 4cdc2f75f71eb6d09aaa13e206c3ed405a12ea4e URL:
https://gitlab.winehq.org/wine/wine/-/commit/4cdc2f75f71eb6d09aaa13e206c3ed…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jun 7 11:50:05 2023 +0200 ntdll: Reimplement unmap_area() to avoid recursion and callbacks. --- dlls/ntdll/unix/virtual.c | 76 +++++++++++++++++------------------------------ 1 file changed, 27 insertions(+), 49 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index fb5a9a0291a..074fe7a4559 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -1436,30 +1436,6 @@ static void *find_reserved_free_area( void *base, void *end, size_t size, int to } -/*********************************************************************** - * add_reserved_area - * - * Add a reserved area to the list maintained by libwine. - * virtual_mutex must be held by caller. - */ -static void add_reserved_area( void *addr, size_t size ) -{ - TRACE( "adding %p-%p\n", addr, (char *)addr + size ); - - if (addr < user_space_limit) - { - /* unmap the part of the area that is below the limit */ - assert( (char *)addr + size > (char *)user_space_limit ); - munmap( addr, (char *)user_space_limit - (char *)addr ); - size -= (char *)user_space_limit - (char *)addr; - addr = user_space_limit; - } - /* blow away existing mappings */ - anon_mmap_fixed( addr, size, PROT_NONE, MAP_NORESERVE ); - mmap_add_reserved_area( addr, size ); -} - - /*********************************************************************** * remove_reserved_area * @@ -1529,34 +1505,36 @@ static int get_area_boundary_callback( void *start, SIZE_T size, void *arg ) * Unmap an area, or simply replace it by an empty mapping if it is * in a reserved area. virtual_mutex must be held by caller. */ -static inline void unmap_area( void *addr, size_t size ) +static void unmap_area( void *start, size_t size ) { - switch (mmap_is_in_reserved_area( addr, size )) - { - case -1: /* partially in a reserved area */ + struct reserved_area *area; + void *end; + + if (!(size = unmap_area_above_user_limit( start, size ))) return; + + end = (char *)start + size; + + LIST_FOR_EACH_ENTRY( area, &reserved_areas, struct reserved_area, entry ) { - struct area_boundary area; - size_t lower_size; - area.base = addr; - area.size = size; - mmap_enum_reserved_areas( get_area_boundary_callback, &area, 0 ); - assert( area.boundary ); - lower_size = (char *)area.boundary - (char *)addr; - unmap_area( addr, lower_size ); - unmap_area( area.boundary, size - lower_size ); - break; - } - case 1: /* in a reserved area */ - anon_mmap_fixed( addr, size, PROT_NONE, MAP_NORESERVE ); - break; - default: - case 0: /* not in a reserved area */ - if (is_beyond_limit( addr, size, user_space_limit )) - add_reserved_area( addr, size ); - else - munmap( addr, size ); - break; + void *area_start = area->base; + void *area_end = (char *)area_start + area->size; + + if (area_start >= end) break; + if (area_end <= start) continue; + if (area_start > start) + { + munmap( start, (char *)area_start - (char *)start ); + start = area_start; + } + if (area_end >= end) + { + anon_mmap_fixed( start, (char *)end - (char *)start, PROT_NONE, MAP_NORESERVE ); + return; + } + anon_mmap_fixed( start, (char *)area_end - (char *)start, PROT_NONE, MAP_NORESERVE ); + start = area_end; } + munmap( start, (char *)end - (char *)start ); }
1
0
0
0
Alexandre Julliard : ntdll: Add a helper function to unmap memory above the user space limit.
by Alexandre Julliard
07 Jun '23
07 Jun '23
Module: wine Branch: master Commit: 4c827cefbc83990f368b62c75993c89b4e8242d0 URL:
https://gitlab.winehq.org/wine/wine/-/commit/4c827cefbc83990f368b62c75993c8…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jun 7 11:47:25 2023 +0200 ntdll: Add a helper function to unmap memory above the user space limit. --- dlls/ntdll/unix/virtual.c | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index 0ccb8cdfbfa..fb5a9a0291a 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -393,6 +393,30 @@ static int mmap_enum_reserved_areas( int (*enum_func)(void *base, SIZE_T size, v return ret; } + +/*********************************************************************** + * unmap_area_above_user_limit + * + * Unmap memory that's above the user space limit, by replacing it with an empty mapping, + * and return the remaining size below the limit. virtual_mutex must be held by caller. + */ +static size_t unmap_area_above_user_limit( void *addr, size_t size ) +{ + size_t ret = 0; + + if (addr < user_space_limit) + { + ret = (char *)user_space_limit - (char *)addr; + if (ret >= size) return size; /* nothing is above limit */ + size -= ret; + addr = user_space_limit; + } + anon_mmap_fixed( addr, size, PROT_NONE, MAP_NORESERVE ); + mmap_add_reserved_area( addr, size ); + return ret; +} + + static void *anon_mmap_tryfixed( void *start, size_t size, int prot, int flags ) { void *ptr; @@ -424,12 +448,8 @@ static void *anon_mmap_tryfixed( void *start, size_t size, int prot, int flags ) #endif if (ptr != MAP_FAILED && ptr != start) { - if (is_beyond_limit( ptr, size, user_space_limit )) - { - anon_mmap_fixed( ptr, size, PROT_NONE, MAP_NORESERVE ); - mmap_add_reserved_area( ptr, size ); - } - else munmap( ptr, size ); + size = unmap_area_above_user_limit( ptr, size ); + if (size) munmap( ptr, size ); ptr = MAP_FAILED; errno = EEXIST; } @@ -2011,7 +2031,7 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, else { struct alloc_area alloc; - size_t view_size; + size_t view_size, unmap_size; if (!align_mask) align_mask = granularity_mask; view_size = size + align_mask + 1; @@ -2048,8 +2068,9 @@ static NTSTATUS map_view( struct file_view **view_ret, void *base, size_t size, } TRACE( "got mem with anon mmap %p-%p\n", ptr, (char *)ptr + size ); /* if we got something beyond the user limit, unmap it and retry */ - if (is_beyond_limit( ptr, view_size, user_space_limit )) add_reserved_area( ptr, view_size ); - else break; + if (!is_beyond_limit( ptr, view_size, user_space_limit )) break; + unmap_size = unmap_area_above_user_limit( ptr, view_size ); + if (unmap_size) munmap( ptr, unmap_size ); } ptr = unmap_extra_space( ptr, view_size, size, align_mask ); }
1
0
0
0
Alexandre Julliard : ntdll: Support adding overlapping ranges in mmap_add_reserved_area().
by Alexandre Julliard
07 Jun '23
07 Jun '23
Module: wine Branch: master Commit: d5b22ae0853ddd3ea32b7e71f425b140d6864dd4 URL:
https://gitlab.winehq.org/wine/wine/-/commit/d5b22ae0853ddd3ea32b7e71f425b1…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jun 7 11:46:21 2023 +0200 ntdll: Support adding overlapping ranges in mmap_add_reserved_area(). --- dlls/ntdll/unix/virtual.c | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c index b208d7d8e9b..0ccb8cdfbfa 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -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) )))
1
0
0
0
Alexandre Julliard : wininet/tests: Update expected WineHQ certificate.
by Alexandre Julliard
07 Jun '23
07 Jun '23
Module: wine Branch: master Commit: 1dd6ea7049f857f0d4e7a78ec8314c3bac71625b URL:
https://gitlab.winehq.org/wine/wine/-/commit/1dd6ea7049f857f0d4e7a78ec8314c…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Wed Jun 7 16:12:02 2023 +0200 wininet/tests: Update expected WineHQ certificate. --- dlls/wininet/tests/http.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index eeb4a28da4b..6edab2141ae 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -6666,9 +6666,7 @@ typedef struct { static const cert_struct_test_t test_winehq_org_cert = { "US\r\n" "Minnesota\r\n" - "Saint Paul\r\n" - "\"CodeWeavers, Inc.\"\r\n" - "IT\r\n" + "CodeWeavers\r\n" "*.winehq.org", "US\r\n"
1
0
0
0
Alex Henrie : vbscript: Fix memory leak on error path in alloc_vbscode (scan-build).
by Alexandre Julliard
07 Jun '23
07 Jun '23
Module: wine Branch: master Commit: 50df20b9ece2c6cd8e8c43f29ce1b51121590ae2 URL:
https://gitlab.winehq.org/wine/wine/-/commit/50df20b9ece2c6cd8e8c43f29ce1b5…
Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Tue Jun 6 23:52:16 2023 -0600 vbscript: Fix memory leak on error path in alloc_vbscode (scan-build). release_vbscode doesn't do anything if ref is 0. --- dlls/vbscript/compile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/vbscript/compile.c b/dlls/vbscript/compile.c index 1012f6af469..f86ecfded91 100644 --- a/dlls/vbscript/compile.c +++ b/dlls/vbscript/compile.c @@ -1951,6 +1951,7 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source, DWORD_P memcpy(ret->source, source, len * sizeof(WCHAR)); ret->source[len] = 0; + ret->ref = 1; ret->cookie = cookie; ret->start_line = start_line; @@ -1966,7 +1967,6 @@ static vbscode_t *alloc_vbscode(compile_ctx_t *ctx, const WCHAR *source, DWORD_P ret->main_code.type = FUNC_GLOBAL; ret->main_code.code_ctx = ret; - ret->ref = 1; list_init(&ret->entry); return ret;
1
0
0
0
← Newer
1
...
48
49
50
51
52
53
54
...
64
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Results per page:
10
25
50
100
200