[PATCH] xaudio2_7: Also preserve %ebx in call_on_voice_processing_pass_start().
It is tested that EBX register is not preserved by IXAudio2VoiceCallback_OnVoiceProcessingPassStart callback in League of Legends. It doesn't lead to crash in the present xaudio, while it might still be a potential issue. Details are in https://bugs.winehq.org/show_bug.cgi?id=46870, while that bug is not dedicated to this specific issue. Signed-off-by: Paul Gofman <gofmanp(a)gmail.com> --- dlls/xaudio2_7/xaudio_dll.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c index 18306a1603..da34e480c1 100644 --- a/dlls/xaudio2_7/xaudio_dll.c +++ b/dlls/xaudio2_7/xaudio_dll.c @@ -41,7 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(xaudio2); #if XAUDIO2_VER != 0 && defined(__i386__) -/* EVE Online uses an OnVoiceProcessingPassStart callback which corrupts %esi. */ +/* EVE Online uses an OnVoiceProcessingPassStart callback which corrupts %esi; + * League of Legends uses a callback which corrupts %ebx. */ #define IXAudio2VoiceCallback_OnVoiceProcessingPassStart(a, b) call_on_voice_processing_pass_start(a, b) extern void call_on_voice_processing_pass_start(IXAudio2VoiceCallback *This, UINT32 BytesRequired); __ASM_GLOBAL_FUNC( call_on_voice_processing_pass_start, @@ -54,13 +55,17 @@ __ASM_GLOBAL_FUNC( call_on_voice_processing_pass_start, __ASM_CFI(".cfi_rel_offset %esi,-4\n\t") "pushl %edi\n\t" __ASM_CFI(".cfi_rel_offset %edi,-8\n\t") + "pushl %ebx\n\t" + __ASM_CFI(".cfi_rel_offset %ebx,-12\n\t") "subl $8,%esp\n\t" "pushl 12(%ebp)\n\t" /* BytesRequired */ "pushl 8(%ebp)\n\t" /* This */ "movl 8(%ebp),%eax\n\t" "movl 0(%eax),%eax\n\t" "call *0(%eax)\n\t" /* This->lpVtbl->OnVoiceProcessingPassStart */ - "leal -8(%ebp),%esp\n\t" + "leal -12(%ebp),%esp\n\t" + "popl %ebx\n\t" + __ASM_CFI(".cfi_same_value %ebx\n\t") "popl %edi\n\t" __ASM_CFI(".cfi_same_value %edi\n\t") "popl %esi\n\t" -- 2.20.1
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=50843 Your paranoid android. === debian9 (32 bit report) === Report errors: The report seems to have been truncated === debian9 (32 bit WoW report) === Report errors: The report seems to have been truncated
I'm not the right person to review the assembly, but the concept seems fine and it doesn't break the build or tests for me. Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> On Thu, Apr 11, 2019 at 11:30:50AM +0300, Paul Gofman wrote:
It is tested that EBX register is not preserved by IXAudio2VoiceCallback_OnVoiceProcessingPassStart callback in League of Legends. It doesn't lead to crash in the present xaudio, while it might still be a potential issue.
Details are in https://bugs.winehq.org/show_bug.cgi?id=46870, while that bug is not dedicated to this specific issue.
Signed-off-by: Paul Gofman <gofmanp(a)gmail.com> --- dlls/xaudio2_7/xaudio_dll.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c index 18306a1603..da34e480c1 100644 --- a/dlls/xaudio2_7/xaudio_dll.c +++ b/dlls/xaudio2_7/xaudio_dll.c @@ -41,7 +41,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(xaudio2);
#if XAUDIO2_VER != 0 && defined(__i386__) -/* EVE Online uses an OnVoiceProcessingPassStart callback which corrupts %esi. */ +/* EVE Online uses an OnVoiceProcessingPassStart callback which corrupts %esi; + * League of Legends uses a callback which corrupts %ebx. */ #define IXAudio2VoiceCallback_OnVoiceProcessingPassStart(a, b) call_on_voice_processing_pass_start(a, b) extern void call_on_voice_processing_pass_start(IXAudio2VoiceCallback *This, UINT32 BytesRequired); __ASM_GLOBAL_FUNC( call_on_voice_processing_pass_start, @@ -54,13 +55,17 @@ __ASM_GLOBAL_FUNC( call_on_voice_processing_pass_start, __ASM_CFI(".cfi_rel_offset %esi,-4\n\t") "pushl %edi\n\t" __ASM_CFI(".cfi_rel_offset %edi,-8\n\t") + "pushl %ebx\n\t" + __ASM_CFI(".cfi_rel_offset %ebx,-12\n\t") "subl $8,%esp\n\t" "pushl 12(%ebp)\n\t" /* BytesRequired */ "pushl 8(%ebp)\n\t" /* This */ "movl 8(%ebp),%eax\n\t" "movl 0(%eax),%eax\n\t" "call *0(%eax)\n\t" /* This->lpVtbl->OnVoiceProcessingPassStart */ - "leal -8(%ebp),%esp\n\t" + "leal -12(%ebp),%esp\n\t" + "popl %ebx\n\t" + __ASM_CFI(".cfi_same_value %ebx\n\t") "popl %edi\n\t" __ASM_CFI(".cfi_same_value %edi\n\t") "popl %esi\n\t" -- 2.20.1
participants (3)
-
Andrew Eikum -
Marvin -
Paul Gofman