[runtime] Make sure the movaps instruction only accesses 16-byte aligned memory addresses.
This commit is contained in:
Родитель
1f1f6991a3
Коммит
1ef9dfb811
|
@ -23,7 +23,7 @@
|
|||
sall $4,%eax
|
||||
subl %eax,%esp
|
||||
# store the number somewhere so we can restore the stack pointer later
|
||||
movl %eax,-80(%ebp)
|
||||
movl %eax,-16(%ebp)
|
||||
|
||||
# copy arguments from old location in the stack to new location in the stack
|
||||
# %ecx will hold the amount of bytes left to copy
|
||||
|
@ -34,7 +34,7 @@
|
|||
# (arguments smaller than 4 bytes are extended to 4 bytes according to
|
||||
# http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/LowLevelABI/130-IA-32_Function_Calling_Conventions/IA32.html#//apple_ref/doc/uid/TP40002492-SW4)
|
||||
|
||||
movl -80(%ebp),%ecx # ecx = frame_length
|
||||
movl -16(%ebp),%ecx # ecx = frame_length
|
||||
leal 8(%ebp),%esi # esi = address of first argument we got (buffer)
|
||||
movl %esp,%edi # edi = address of the bottom of the stack
|
||||
|
||||
|
@ -47,7 +47,7 @@ L_start:
|
|||
jmp L_start # }
|
||||
L_end:
|
||||
|
||||
movaps -16(%ebp), %xmm0
|
||||
movaps -32(%ebp), %xmm1
|
||||
movaps -48(%ebp), %xmm2
|
||||
movaps -64(%ebp), %xmm3
|
||||
movaps -24(%ebp), %xmm0
|
||||
movaps -40(%ebp), %xmm1
|
||||
movaps -56(%ebp), %xmm2
|
||||
movaps -72(%ebp), %xmm3
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Lafterinvoke:
|
||||
addl -80(%ebp), %esp
|
||||
addl $68, %esp
|
||||
addl -16(%ebp), %esp
|
||||
addl $92, %esp
|
||||
popl %ebx
|
||||
popl %edi
|
||||
popl %esi
|
||||
|
|
|
@ -17,11 +17,11 @@ Lfunc_begin0:
|
|||
pushl %esi # %ebp-4
|
||||
pushl %edi # %ebp-8
|
||||
pushl %ebx # %ebp-12
|
||||
# we need 64 bytes to store xmm0-3
|
||||
# we need 4 bytes to store the result for get_frame_length, which we store in %ebp-80
|
||||
# we need 64 bytes to store xmm0-3, and those 64 bytes need to be 16-byte aligned.
|
||||
# we need 4 bytes to store the result for get_frame_length, which we store in %ebp-16
|
||||
# then 4 more bytes for stack space for the call to get_frame_length (which takes 2 arguments)
|
||||
subl $76, %esp # to store xmm0-3
|
||||
movaps %xmm0, -16(%ebp)
|
||||
movaps %xmm1, -32(%ebp)
|
||||
movaps %xmm2, -48(%ebp)
|
||||
movaps %xmm3, -64(%ebp)
|
||||
subl $92, %esp # to store xmm0-3
|
||||
movaps %xmm0, -24(%ebp)
|
||||
movaps %xmm1, -40(%ebp)
|
||||
movaps %xmm2, -56(%ebp)
|
||||
movaps %xmm3, -72(%ebp)
|
||||
|
|
Загрузка…
Ссылка в новой задаче