Fix _exit_with_stack_teardown for x86.
Change-Id: Ife8f9c538c86f7c0017143015d5ee849a99b625b
This commit is contained in:
		| @@ -3,12 +3,13 @@ | |||||||
|  |  | ||||||
| // void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status) | // void _exit_with_stack_teardown(void* stackBase, size_t stackSize, int status) | ||||||
| ENTRY(_exit_with_stack_teardown) | ENTRY(_exit_with_stack_teardown) | ||||||
|     // We can trash %ebx here since this call should never return. |     // We can trash registers because this function never returns. | ||||||
|     // We can also take advantage of the fact that the linux syscall trap |     // We can also take advantage of the fact that the linux syscall trap | ||||||
|     // handler saves all the registers, so we don't need a stack to keep |     // handler saves all the registers, so we don't need a stack to keep | ||||||
|     // the status argument for exit while doing the munmap. |     // the status argument for exit while doing the munmap. | ||||||
|     mov     4(%esp), %ebx             // stackBase |     mov     4(%esp), %ebx             // stackBase | ||||||
|     mov     8(%esp), %ecx             // stackSize |     mov     8(%esp), %ecx             // stackSize | ||||||
|  |     mov     12(%esp), %edx            // Also copy 'status' off the stack we're about to unmap. | ||||||
|     mov     $__NR_munmap, %eax |     mov     $__NR_munmap, %eax | ||||||
|     int     $0x80 |     int     $0x80 | ||||||
|     // If munmap failed, we ignore the failure and exit anyway. |     // If munmap failed, we ignore the failure and exit anyway. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Elliott Hughes
					Elliott Hughes