sigreturn.S 4.7 KB
Newer Older
R
Roland McGrath 已提交
1
#include <linux/linkage.h>
2
#include <asm/unistd_32.h>
3
#include <asm/asm-offsets.h>
L
Linus Torvalds 已提交
4

5 6 7
#ifndef SYSCALL_ENTER_KERNEL
#define	SYSCALL_ENTER_KERNEL	int $0x80
#endif
L
Linus Torvalds 已提交
8 9 10 11

	.text
	.globl __kernel_sigreturn
	.type __kernel_sigreturn,@function
J
Jiri Slaby 已提交
12
	nop /* this guy is needed for .LSTARTFDEDLSI1 below (watch for HACK) */
R
Roland McGrath 已提交
13
	ALIGN
L
Linus Torvalds 已提交
14 15 16 17
__kernel_sigreturn:
.LSTART_sigreturn:
	popl %eax		/* XXX does this mean it needs unwind info? */
	movl $__NR_sigreturn, %eax
18
	SYSCALL_ENTER_KERNEL
L
Linus Torvalds 已提交
19
.LEND_sigreturn:
R
Roland McGrath 已提交
20
	nop
L
Linus Torvalds 已提交
21 22 23 24
	.size __kernel_sigreturn,.-.LSTART_sigreturn

	.globl __kernel_rt_sigreturn
	.type __kernel_rt_sigreturn,@function
R
Roland McGrath 已提交
25
	ALIGN
L
Linus Torvalds 已提交
26 27 28
__kernel_rt_sigreturn:
.LSTART_rt_sigreturn:
	movl $__NR_rt_sigreturn, %eax
29
	SYSCALL_ENTER_KERNEL
L
Linus Torvalds 已提交
30
.LEND_rt_sigreturn:
R
Roland McGrath 已提交
31
	nop
L
Linus Torvalds 已提交
32 33 34 35 36 37 38 39 40
	.size __kernel_rt_sigreturn,.-.LSTART_rt_sigreturn
	.previous

	.section .eh_frame,"a",@progbits
.LSTARTFRAMEDLSI1:
	.long .LENDCIEDLSI1-.LSTARTCIEDLSI1
.LSTARTCIEDLSI1:
	.long 0			/* CIE ID */
	.byte 1			/* Version number */
41
	.string "zRS"		/* NUL-terminated augmentation string */
L
Linus Torvalds 已提交
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
	.uleb128 1		/* Code alignment factor */
	.sleb128 -4		/* Data alignment factor */
	.byte 8			/* Return address register column */
	.uleb128 1		/* Augmentation value length */
	.byte 0x1b		/* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */
	.byte 0			/* DW_CFA_nop */
	.align 4
.LENDCIEDLSI1:
	.long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */
.LSTARTFDEDLSI1:
	.long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */
	/* HACK: The dwarf2 unwind routines will subtract 1 from the
	   return address to get an address in the middle of the
	   presumed call instruction.  Since we didn't get here via
	   a call, we need to include the nop before the real start
	   to make up for it.  */
	.long .LSTART_sigreturn-1-.	/* PC-relative start address */
	.long .LEND_sigreturn-.LSTART_sigreturn+1
	.uleb128 0			/* Augmentation */
	/* What follows are the instructions for the table generation.
	   We record the locations of each register saved.  This is
	   complicated by the fact that the "CFA" is always assumed to
	   be the value of the stack pointer in the caller.  This means
	   that we must define the CFA of this body of code to be the
	   saved value of the stack pointer in the sigcontext.  Which
R
Roland McGrath 已提交
67
	   also means that there is no fixed relation to the other
L
Linus Torvalds 已提交
68
	   saved registers, which means that we must use DW_CFA_expression
R
Roland McGrath 已提交
69
	   to compute their addresses.  It also means that when we
L
Linus Torvalds 已提交
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
	   adjust the stack with the popl, we have to do it all over again.  */

#define do_cfa_expr(offset)						\
	.byte 0x0f;			/* DW_CFA_def_cfa_expression */	\
	.uleb128 1f-0f;			/*   length */			\
0:	.byte 0x74;			/*     DW_OP_breg4 */		\
	.sleb128 offset;		/*      offset */		\
	.byte 0x06;			/*     DW_OP_deref */		\
1:

#define do_expr(regno, offset)						\
	.byte 0x10;			/* DW_CFA_expression */		\
	.uleb128 regno;			/*   regno */			\
	.uleb128 1f-0f;			/*   length */			\
0:	.byte 0x74;			/*     DW_OP_breg4 */		\
	.sleb128 offset;		/*       offset */		\
1:

88 89 90 91 92 93 94 95 96
	do_cfa_expr(IA32_SIGCONTEXT_sp+4)
	do_expr(0, IA32_SIGCONTEXT_ax+4)
	do_expr(1, IA32_SIGCONTEXT_cx+4)
	do_expr(2, IA32_SIGCONTEXT_dx+4)
	do_expr(3, IA32_SIGCONTEXT_bx+4)
	do_expr(5, IA32_SIGCONTEXT_bp+4)
	do_expr(6, IA32_SIGCONTEXT_si+4)
	do_expr(7, IA32_SIGCONTEXT_di+4)
	do_expr(8, IA32_SIGCONTEXT_ip+4)
L
Linus Torvalds 已提交
97 98 99

	.byte 0x42	/* DW_CFA_advance_loc 2 -- nop; popl eax. */

100 101 102 103 104 105 106 107 108
	do_cfa_expr(IA32_SIGCONTEXT_sp)
	do_expr(0, IA32_SIGCONTEXT_ax)
	do_expr(1, IA32_SIGCONTEXT_cx)
	do_expr(2, IA32_SIGCONTEXT_dx)
	do_expr(3, IA32_SIGCONTEXT_bx)
	do_expr(5, IA32_SIGCONTEXT_bp)
	do_expr(6, IA32_SIGCONTEXT_si)
	do_expr(7, IA32_SIGCONTEXT_di)
	do_expr(8, IA32_SIGCONTEXT_ip)
L
Linus Torvalds 已提交
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124

	.align 4
.LENDFDEDLSI1:

	.long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */
.LSTARTFDEDLSI2:
	.long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */
	/* HACK: See above wrt unwind library assumptions.  */
	.long .LSTART_rt_sigreturn-1-.	/* PC-relative start address */
	.long .LEND_rt_sigreturn-.LSTART_rt_sigreturn+1
	.uleb128 0			/* Augmentation */
	/* What follows are the instructions for the table generation.
	   We record the locations of each register saved.  This is
	   slightly less complicated than the above, since we don't
	   modify the stack pointer in the process.  */

125 126 127 128 129 130 131 132 133
	do_cfa_expr(IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_sp)
	do_expr(0, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ax)
	do_expr(1, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_cx)
	do_expr(2, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_dx)
	do_expr(3, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_bx)
	do_expr(5, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_bp)
	do_expr(6, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_si)
	do_expr(7, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_di)
	do_expr(8, IA32_RT_SIGFRAME_sigcontext-4 + IA32_SIGCONTEXT_ip)
L
Linus Torvalds 已提交
134 135 136 137

	.align 4
.LENDFDEDLSI2:
	.previous