^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) # arch/i386/setjmp.S
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) # setjmp/longjmp for the i386 architecture
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) # The jmp_buf is assumed to contain the following, in order:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) # %ebx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) # %esp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) # %ebp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) # %esi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) # %edi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) # <return address>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) .text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) .globl kernel_setjmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) .type kernel_setjmp, @function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) kernel_setjmp:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #ifdef _REGPARM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) movl %eax,%edx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) movl 4(%esp),%edx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) popl %ecx # Return address, and adjust the stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) xorl %eax,%eax # Return value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) movl %ebx,(%edx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) movl %esp,4(%edx) # Post-return %esp!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) pushl %ecx # Make the call/return stack happy
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) movl %ebp,8(%edx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) movl %esi,12(%edx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) movl %edi,16(%edx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) movl %ecx,20(%edx) # Return address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) ret
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) .size kernel_setjmp,.-kernel_setjmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) .text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) .align 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) .globl kernel_longjmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) .type kernel_longjmp, @function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) kernel_longjmp:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #ifdef _REGPARM
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) xchgl %eax,%edx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) movl 4(%esp),%edx # jmp_ptr address
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) movl 8(%esp),%eax # Return value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) movl (%edx),%ebx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) movl 4(%edx),%esp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) movl 8(%edx),%ebp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) movl 12(%edx),%esi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) movl 16(%edx),%edi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) jmp *20(%edx)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .size kernel_longjmp,.-kernel_longjmp