|
8 | 8 | #if defined(__APPLE__) || defined(_WIN32)
|
9 | 9 | #define RUST_NEW_STACK _rust_new_stack
|
10 | 10 | #define RUST_DEL_STACK _rust_del_stack
|
| 11 | +#define MORESTACK ___morestack |
11 | 12 | #else
|
12 | 13 | #define RUST_NEW_STACK rust_new_stack
|
13 | 14 | #define RUST_DEL_STACK rust_del_stack
|
| 15 | +#define MORESTACK __morestack |
14 | 16 | #endif
|
15 | 17 |
|
16 | 18 | .globl RUST_NEW_STACK
|
17 | 19 | .globl RUST_DEL_STACK
|
18 | 20 |
|
19 |
| -.globl __morestack |
| 21 | +.globl MORESTACK |
20 | 22 |
|
21 |
| -__morestack: |
22 |
| - pushl %edx // param 2: size of arguments |
23 |
| - leal 8(%esp),%eax |
24 |
| - pushl %eax // param 1: starting addr of arguments |
25 |
| - pushl %ecx // param 0: amount of space needed |
| 23 | +MORESTACK: |
| 24 | + pushl 8(%esp) // argsz > ra stksz argsz x x ra args |
| 25 | + leal 28(%esp),%eax // argsz ra stksz argsz x x ra args |
| 26 | + pushl %eax // argp > argsz ra stksz argsz x x ra args |
| 27 | + pushl 12(%esp) // stksz > argp argsz ra stksz argsz x x ra args |
26 | 28 | calll RUST_NEW_STACK
|
| 29 | + addl $12,%esp // ra stksz argsz x x ra args |
27 | 30 |
|
28 | 31 | movl (%esp),%edx // Grab the return pointer.
|
29 | 32 | incl %edx // Skip past the `ret`.
|
30 | 33 | movl %eax,%esp // Switch to the new stack.
|
31 |
| - calll *%edx // Enter the new function. |
| 34 | + calll *%edx // Re-enter the function that called us. |
32 | 35 |
|
33 | 36 | // Now the function that called us has returned, so we need to delete the
|
34 | 37 | // old stack space.
|
35 | 38 | calll RUST_DEL_STACK
|
36 |
| - movl %eax,%esp // Switch back to the old stack. |
37 |
| - retl |
| 39 | + movl %eax,%esp |
| 40 | + retl $8 // ra stksz argsz x x ra args |
38 | 41 |
|
0 commit comments