2014-05-15 17:45:52 +02:00
|
|
|
/*
|
2015-09-27 18:58:30 +02:00
|
|
|
* Copyright (C) 2013, 2014 Ludwig Knüpfer <ludwig.knuepfer@fu-berlin.de>
|
2014-08-29 18:30:37 +02:00
|
|
|
* Copyright (C) 2014 Thomas Eichinger <thomas.eichinger1@gmail.com>
|
2014-05-15 17:45:52 +02:00
|
|
|
*
|
2014-07-31 19:45:27 +02:00
|
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
|
|
* directory for more details.
|
2014-05-15 17:45:52 +02:00
|
|
|
*/
|
|
|
|
|
2013-05-14 18:31:47 +02:00
|
|
|
.text
|
|
|
|
|
2022-12-19 18:25:29 +01:00
|
|
|
#ifdef __arm__
|
2014-08-29 18:30:37 +02:00
|
|
|
|
|
|
|
.globl _native_sig_leave_tramp
|
|
|
|
_native_sig_leave_tramp:
|
|
|
|
/* save _native_saved_eip and registers */
|
|
|
|
stmdb sp!, {r0}
|
|
|
|
ldr r0, =_native_saved_eip
|
|
|
|
ldr r0, [r0]
|
|
|
|
stmdb sp!, {r0-r12}
|
|
|
|
stmdb sp!, {lr}
|
|
|
|
|
|
|
|
/* exchange r0 and _native_saved_eip */
|
|
|
|
ldr r0, [sp,#56]
|
|
|
|
ldr r1, [sp,#4 ]
|
|
|
|
str r0, [sp,#4 ]
|
|
|
|
str r1, [sp,#56]
|
|
|
|
|
|
|
|
/* call swapcontext ( _native_cur_ctx, _native_isr_ctx ) */
|
|
|
|
ldr r2, =_native_cur_ctx
|
|
|
|
ldr r0, [r2]
|
|
|
|
ldr r2, =_native_isr_ctx
|
|
|
|
ldr r1, [r2]
|
|
|
|
bl swapcontext
|
|
|
|
|
|
|
|
/* reeanble interrupts */
|
2016-03-19 09:25:47 +01:00
|
|
|
bl irq_enable
|
2014-08-29 18:30:37 +02:00
|
|
|
|
|
|
|
/* _native_in_isr = 0 */
|
|
|
|
eor r0, r0, r0
|
|
|
|
ldr r2, =_native_in_isr
|
|
|
|
str r0, [r2]
|
|
|
|
|
|
|
|
/* restore registers, jump to (saved) _native_saved_eip */
|
|
|
|
ldmia sp!, {lr}
|
|
|
|
ldmia sp!, {r0-r12}
|
|
|
|
ldmia sp!, {pc}
|
|
|
|
|
2014-11-28 12:14:54 +01:00
|
|
|
.globl _native_sig_leave_handler
|
|
|
|
_native_sig_leave_handler:
|
|
|
|
stmdb sp!, {r0}
|
|
|
|
ldr r0, =_native_saved_eip
|
|
|
|
ldr r0, [r0]
|
|
|
|
stmdb sp!, {r0-r12}
|
|
|
|
stmdb sp!, {lr}
|
|
|
|
/* exchange r0 and _native_saved_eip */
|
|
|
|
ldr r0, [sp,#56]
|
|
|
|
ldr r1, [sp,#4 ]
|
|
|
|
str r0, [sp,#4 ]
|
|
|
|
str r1, [sp,#56]
|
|
|
|
/* _native_in_isr = 0 */
|
|
|
|
eor r0, r0, r0
|
|
|
|
ldr r1, =_native_in_isr
|
|
|
|
str r0, [r1]
|
|
|
|
ldmia sp!, {lr}
|
|
|
|
ldmia sp!, {r0-r12}
|
|
|
|
ldmia sp!, {pc}
|
|
|
|
|
2013-05-15 17:45:43 +02:00
|
|
|
#else
|
2013-05-14 18:31:47 +02:00
|
|
|
.globl _native_sig_leave_tramp
|
|
|
|
|
2023-12-08 11:22:32 +01:00
|
|
|
#ifdef __x86_64__
|
|
|
|
_native_sig_leave_tramp:
|
|
|
|
pushq _native_saved_eip(%rip)
|
|
|
|
pushfq
|
|
|
|
|
|
|
|
pushq %rax
|
|
|
|
pushq %rcx
|
|
|
|
pushq %rdx
|
|
|
|
pushq %rbx
|
|
|
|
pushq %rbp
|
|
|
|
pushq %rsi
|
|
|
|
pushq %rdi
|
|
|
|
pushq %r8
|
|
|
|
pushq %r9
|
|
|
|
pushq %r10
|
|
|
|
pushq %r11
|
|
|
|
pushq %r12
|
|
|
|
pushq %r13
|
|
|
|
pushq %r14
|
|
|
|
pushq %r15
|
|
|
|
|
|
|
|
mov _native_isr_ctx(%rip), %rsi
|
|
|
|
mov _native_cur_ctx(%rip), %rdi
|
|
|
|
|
|
|
|
call swapcontext
|
|
|
|
|
|
|
|
call irq_enable
|
|
|
|
|
|
|
|
movl $0x0, _native_in_isr(%rip)
|
|
|
|
popq %r15
|
|
|
|
popq %r14
|
|
|
|
popq %r13
|
|
|
|
popq %r12
|
|
|
|
popq %r11
|
|
|
|
popq %r10
|
|
|
|
popq %r9
|
|
|
|
popq %r8
|
|
|
|
popq %rdi
|
|
|
|
popq %rsi
|
|
|
|
popq %rbp
|
|
|
|
popq %rbx
|
|
|
|
popq %rdx
|
|
|
|
popq %rcx
|
|
|
|
popq %rax
|
|
|
|
|
|
|
|
popfq
|
|
|
|
ret
|
|
|
|
#else
|
2013-05-14 18:31:47 +02:00
|
|
|
_native_sig_leave_tramp:
|
2014-01-20 22:25:52 +01:00
|
|
|
pushl _native_saved_eip
|
|
|
|
pushfl
|
|
|
|
pushal
|
2013-05-14 18:31:47 +02:00
|
|
|
|
2013-10-16 15:33:04 +02:00
|
|
|
pushl _native_isr_ctx
|
|
|
|
pushl _native_cur_ctx
|
2013-05-14 18:31:47 +02:00
|
|
|
call swapcontext
|
2013-10-16 15:33:04 +02:00
|
|
|
addl $8, %esp
|
2013-05-14 18:31:47 +02:00
|
|
|
|
2016-03-19 09:25:47 +01:00
|
|
|
call irq_enable
|
2013-11-08 13:14:44 +01:00
|
|
|
|
2013-10-16 15:33:04 +02:00
|
|
|
movl $0x0, _native_in_isr
|
2014-01-20 22:25:52 +01:00
|
|
|
popal
|
|
|
|
popfl
|
2013-05-14 18:31:47 +02:00
|
|
|
|
2014-05-15 11:34:54 +02:00
|
|
|
ret
|
2023-12-08 11:22:32 +01:00
|
|
|
#endif
|
2014-11-28 12:14:54 +01:00
|
|
|
|
|
|
|
.globl _native_sig_leave_handler
|
|
|
|
_native_sig_leave_handler:
|
2023-12-08 11:22:32 +01:00
|
|
|
#ifdef __x86_64__
|
|
|
|
pushq _native_saved_eip(%rip)
|
|
|
|
movl $0x0, _native_in_isr(%rip)
|
|
|
|
#else
|
2014-11-28 12:14:54 +01:00
|
|
|
pushl _native_saved_eip
|
|
|
|
movl $0x0, _native_in_isr
|
2023-12-08 11:22:32 +01:00
|
|
|
#endif
|
2014-11-28 12:14:54 +01:00
|
|
|
ret
|
2013-05-15 17:45:43 +02:00
|
|
|
#endif
|
2024-01-28 04:43:42 +01:00
|
|
|
|
|
|
|
#if defined(__linux__) && defined(__ELF__)
|
|
|
|
.section .note.GNU-stack,"",%progbits
|
|
|
|
#endif
|