Skip to content

Commit d66de64

Browse files
committed
Fix stack alignment for sysv_386
1 parent 42fbc46 commit d66de64

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

lib/sysv_i386/libstackman.a

4 Bytes
Binary file not shown.

src/platforms/switch_x86_gcc.S

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ stackman_switch:
3030
movl 8(%ebp), %eax
3131
movl 12(%ebp), %edx
3232
#APP
33-
# 50 "switch_x86_gcc.h" 1
34-
subl $0x1a, %esp
33+
# 50 "../platforms/switch_x86_gcc.h" 1
34+
subl $0x1c, %esp
3535
movl %eax, %esi
3636
movl %edx, %edi
3737
leal 0x10(%esp), %ebx
@@ -48,7 +48,7 @@ movl $1, 4(%esp)
4848
movl %edi, 0(%esp)
4949
call *%esi
5050
movl %eax, %eax
51-
addl $0x1a, %esp
51+
addl $0x1c, %esp
5252

5353
# 0 "" 2
5454
#NO_APP
@@ -79,19 +79,19 @@ stackman_call:
7979
subl $8, %esp
8080
.cfi_offset 3, -12
8181
#APP
82-
# 108 "switch_x86_gcc.h" 1
82+
# 108 "../platforms/switch_x86_gcc.h" 1
8383
movl %esp, %ebx
8484
# 0 "" 2
85-
# 110 "switch_x86_gcc.h" 1
85+
# 110 "../platforms/switch_x86_gcc.h" 1
8686
leal 4(%esp), %eax
8787
# 0 "" 2
8888
#NO_APP
8989
movl 16(%ebp), %edx
9090
#APP
91-
# 113 "switch_x86_gcc.h" 1
91+
# 113 "../platforms/switch_x86_gcc.h" 1
9292
movl %edx, %esp
9393
# 0 "" 2
94-
# 115 "switch_x86_gcc.h" 1
94+
# 115 "../platforms/switch_x86_gcc.h" 1
9595
subl $4, %esp
9696
# 0 "" 2
9797
#NO_APP
@@ -100,7 +100,7 @@ stackman_call:
100100
pushl 12(%ebp)
101101
call *8(%ebp)
102102
#APP
103-
# 119 "switch_x86_gcc.h" 1
103+
# 119 "../platforms/switch_x86_gcc.h" 1
104104
movl %ebx, %esp
105105
# 0 "" 2
106106
#NO_APP

src/platforms/switch_x86_gcc.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ void *result;
5252
/* adjust stack pointer to be 16 byte (4 quad) aligned with
5353
* room for call args
5454
* since the call instruction, 5 quads have
55-
* been pushed (ip, bp, bx, si, di), need extra 3 quads (0xa)
55+
* been pushed (ip, bp, bx, si, di), need extra 3 quads (0xc)
5656
* for alignment, which fits our three quad call args.
5757
* Add another 16 (0x10) bytes, so that we can pass to the callbacks
5858
* a 16 byte boundary that lies above the pushed arguments
5959
* so that the call arguments of the functions aren't clobbered
6060
* by memory transfer.
6161
*/
62-
"subl $0x1a, %%esp\n"
62+
"subl $0x1c, %%esp\n"
6363
"movl %[cb], %%esi\n" /* save 'callback' for later */
6464
"movl %[ctx], %%edi\n" /* save 'context' for later */
6565

@@ -86,7 +86,7 @@ void *result;
8686

8787
"movl %%eax, %[result]\n"
8888

89-
"addl $0x1a, %%esp\n"
89+
"addl $0x1c, %%esp\n"
9090
: [result] "=r" (result) /* output variables */
9191
: [cb] "r" (callback), /* input variables */
9292
[ctx] "r" (context)

0 commit comments

Comments
 (0)