1/* SPDX-License-Identifier: GPL-2.0 */ 2#include <linux/linkage.h> 3#include <asm/unistd_32.h> 4#include <asm/asm-offsets.h> 5 6#ifndef SYSCALL_ENTER_KERNEL 7#define SYSCALL_ENTER_KERNEL int $0x80 8#endif 9 10 .text 11 .globl __kernel_sigreturn 12 .type __kernel_sigreturn,@function 13 nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */ 14 ALIGN 15__kernel_sigreturn: 16.LSTART_sigreturn: 17 popl %eax /* XXX does this mean it needs unwind info? */ 18 movl $__NR_sigreturn, %eax 19 SYSCALL_ENTER_KERNEL 20.LEND_sigreturn: 21 nop 22 .size __kernel_sigreturn,.-.LSTART_sigreturn 23 24 .globl __kernel_rt_sigreturn 25 .type __kernel_rt_sigreturn,@function 26 ALIGN 27__kernel_rt_sigreturn: 28.LSTART_rt_sigreturn: 29 movl $__NR_rt_sigreturn, %eax 30 SYSCALL_ENTER_KERNEL 31.LEND_rt_sigreturn: 32 nop 33 .size __kernel_rt_sigreturn,.-.LSTART_rt_sigreturn 34 .previous 35 36 .section .eh_frame,"a",@progbits 37.LSTARTFRAMEDLSI1: 38 .long .LENDCIEDLSI1-.LSTARTCIEDLSI1 39.LSTARTCIEDLSI1: 40 .long 0 /* CIE ID */ 41 .byte 1 /* Version number */ 42 .string "zRS" /* NUL-terminated augmentation string */ 43 .uleb128 1 /* Code alignment factor */ 44 .sleb128 -4 /* Data alignment factor */ 45 .byte 8 /* Return address register column */ 46 .uleb128 1 /* Augmentation value length */ 47 .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ 48 .byte 0 /* DW_CFA_nop */ 49 .align 4 50.LENDCIEDLSI1: 51 .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */ 52.LSTARTFDEDLSI1: 53 .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */ 54 /* HACK: The dwarf2 unwind routines will subtract 1 from the 55 return address to get an address in the middle of the 56 presumed call instruction. Since we didn't get here via 57 a call, we need to include the nop before the real start 58 to make up for it. */ 59 .long .LSTART_sigreturn-1-. /* PC-relative start address */ 60 .long .LEND_sigreturn-.LSTART_sigreturn+1 61 .uleb128 0 /* Augmentation */ 62 /* What follows are the instructions for the table generation. 63 We record the locations of each register saved. This is 64 complicated by the fact that the "CFA" is always assumed to 65 be the value of the stack pointer in the caller. This means 66 that we must define the CFA of this body of code to be the 67 saved value of the stack pointer in the sigcontext. Which 68 also means that there is no fixed relation to the other 69 saved registers, which means that we must use DW_CFA_expression 70 to compute their addresses. It also means that when we 71 adjust the stack with the popl, we have to do it all over again. */ 72 73#define do_cfa_expr(offset) \ 74 .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ 75 .uleb128 1f-0f; /* length */ \ 760: .byte 0x74; /* DW_OP_breg4 */ \ 77 .sleb128 offset; /* offset */ \ 78 .byte 0x06; /* DW_OP_deref */ \ 791: 80 81#define do_expr(regno, offset) \ 82 .byte 0x10; /* DW_CFA_expression */ \ 83 .uleb128 regno; /* regno */ \ 84 .uleb128 1f-0f; /* length */ \ 850: .byte 0x74; /* DW_OP_breg4 */ \ 86 .sleb128 offset; /* offset */ \ 871: 88 89 do_cfa_expr(IA32_SIGCONTEXT_sp+4) 90 do_expr(0, IA32_SIGCONTEXT_ax+4) 91 do_expr(1, IA32_SIGCONTEXT_cx+4) 92 do_expr(2, IA32_SIGCONTEXT_dx+4) 93 do_expr(3, IA32_SIGCONTEXT_bx+4) 94 do_expr(5, IA32_SIGCONTEXT_bp+4) 95 do_expr(6, IA32_SIGCONTEXT_si+4) 96 do_expr(7, IA32_SIGCONTEXT_di+4) 97 do_expr(8, IA32_SIGCONTEXT_ip+4) 98 99 .byte 0x42 /* DW_CFA_advance_loc 2 -- nop; popl eax. */ 100 101 do_cfa_expr(IA32_SIGCONTEXT_sp) 102 do_expr(0, IA32_SIGCONTEXT_ax) 103 do_expr(1, IA32_SIGCONTEXT_cx) 104 do_expr(2, IA32_SIGCONTEXT_dx) 105 do_expr(3, IA32_SIGCONTEXT_bx) 106 do_expr(5, IA32_SIGCONTEXT_bp) 107 do_expr(6, IA32_SIGCONTEXT_si) 108 do_expr(7, IA32_SIGCONTEXT_di) 109 do_expr(8, IA32_SIGCONTEXT_ip) 110 111 .align 4 112.LENDFDEDLSI1: 113 114 .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */ 115.LSTARTFDEDLSI2: 116 .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */ 117 /* HACK: See above wrt unwind library assumptions. */ 118 .long .LSTART_rt_sigreturn-1-. /* PC-relative start address */ 119 .long .LEND_rt_sigreturn-.LSTART_rt_sigreturn+1 120 .uleb128 0 /* Augmentation */ 121 /* What follows are the instructions for the table generation. 122 We record the locations of each register saved. This is 123 slightly less complicated than the above, since we don't 124 modify the stack pointer in the process. */ 125 126 do_cfa_expr(IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_sp) 127 do_expr(0, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ax) 128 do_expr(1, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_cx) 129 do_expr(2, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_dx) 130 do_expr(3, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_bx) 131 do_expr(5, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_bp) 132 do_expr(6, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_si) 133 do_expr(7, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_di) 134 do_expr(8, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ip) 135 136 .align 4 137.LENDFDEDLSI2: 138 .previous 139