Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * thunks.S - assembly helpers for mixed-bitness code
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Copyright (c) 2015 Andrew Lutomirski
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * These are little helpers that make it easier to switch bitness on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * the fly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 	.text
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 	.global call32_from_64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	.type call32_from_64, @function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) call32_from_64:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	// rdi: stack to use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 	// esi: function to call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 	// Save registers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 	pushq %rbx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	pushq %rbp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 	pushq %r12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	pushq %r13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	pushq %r14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	pushq %r15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 	pushfq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	// Switch stacks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	mov %rsp,(%rdi)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	mov %rdi,%rsp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	// Switch to compatibility mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	pushq $0x23  /* USER32_CS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	pushq $1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	lretq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	.code32
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	// Call the function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	call *%esi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	// Switch back to long mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 	jmp $0x33,$1f
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	.code64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 	// Restore the stack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	mov (%rsp),%rsp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	// Restore registers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	popfq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	popq %r15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	popq %r14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	popq %r13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	popq %r12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	popq %rbp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	popq %rbx
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	ret
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) .size call32_from_64, .-call32_from_64