mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-27 09:44:15 +00:00
Use SDL_DISABLE_ALLOCA instead of HAVE_ALLOCA in SDL_stdinc.h
This commit is contained in:
committed by
Anonymous Maarten
parent
552bee47cb
commit
6127ac0871
@@ -696,8 +696,80 @@ RETZERO:
|
||||
/* *INDENT-ON* */
|
||||
}
|
||||
|
||||
void __declspec(naked) _chkstk(void)
|
||||
{
|
||||
__asm {
|
||||
push ecx
|
||||
mov ecx,esp ; lea ecx,dword ptr [esp]+4
|
||||
add ecx,4
|
||||
sub ecx,eax
|
||||
sbb eax,eax
|
||||
not eax
|
||||
and ecx,eax
|
||||
mov eax,esp
|
||||
and eax,0xfffff000
|
||||
L1:
|
||||
cmp ecx,eax
|
||||
jb short L2
|
||||
mov eax,ecx
|
||||
pop ecx
|
||||
xchg esp,eax
|
||||
mov eax,dword ptr [eax]
|
||||
mov dword ptr [esp],eax
|
||||
ret
|
||||
L2:
|
||||
sub eax,0x1000
|
||||
test dword ptr [eax],eax
|
||||
jmp short L1
|
||||
}
|
||||
}
|
||||
|
||||
void __declspec(naked) _alloca_probe_8(void)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
__asm {
|
||||
push ecx
|
||||
mov ecx,esp ; lea ecx,dword ptr [esp]+8
|
||||
add ecx,8
|
||||
sub ecx,eax
|
||||
and ecx,0x7
|
||||
add eax,ecx
|
||||
sbb ecx,ecx
|
||||
or eax,ecx
|
||||
pop ecx
|
||||
jmp _chkstk
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
}
|
||||
|
||||
void __declspec(naked) _alloca_probe_16(void)
|
||||
{
|
||||
/* *INDENT-OFF* */
|
||||
__asm {
|
||||
push ecx
|
||||
mov ecx,esp ; lea ecx,dword ptr [esp]+8
|
||||
add ecx,8
|
||||
sub ecx,eax
|
||||
and ecx,0xf
|
||||
add eax,ecx
|
||||
sbb ecx,ecx
|
||||
or eax,ecx
|
||||
pop ecx
|
||||
jmp _chkstk
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
}
|
||||
|
||||
#endif /* _M_IX86 */
|
||||
|
||||
#ifdef _M_ARM64
|
||||
|
||||
void __chkstk(void);
|
||||
void __chkstk() {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* MSC_VER */
|
||||
|
||||
#ifdef __ICL
|
||||
|
||||
29
src/stdlib/SDL_mslibc_x64.asm
Normal file
29
src/stdlib/SDL_mslibc_x64.asm
Normal file
@@ -0,0 +1,29 @@
|
||||
include ksamd64.inc
|
||||
|
||||
text SEGMENT EXECUTE
|
||||
|
||||
public __chkstk
|
||||
|
||||
__chkstk:
|
||||
sub rsp,010h
|
||||
mov QWORD PTR [rsp],r10
|
||||
mov QWORD PTR [rsp+08h],r11
|
||||
xor r11,r11
|
||||
lea r10,[rsp+018h]
|
||||
sub r10,rax
|
||||
cmovb r10,r11
|
||||
mov r11,QWORD PTR gs:[TeStackLimit]
|
||||
cmp r10,r11
|
||||
jae chkstk_finish
|
||||
and r10w,0f000h
|
||||
chkstk_loop:
|
||||
lea r11,[r11-PAGE_SIZE]
|
||||
mov BYTE PTR [r11],0h
|
||||
cmp r10,r11
|
||||
jne chkstk_loop
|
||||
chkstk_finish:
|
||||
mov r10,QWORD PTR [rsp]
|
||||
mov r11,QWORD PTR [rsp+08h]
|
||||
add rsp,010h
|
||||
ret
|
||||
end
|
||||
Reference in New Issue
Block a user