linux32_locore.s revision 293514
1/* $FreeBSD: stable/10/sys/amd64/linux32/linux32_locore.s 293514 2016-01-09 15:44:38Z dchagin $ */ 2 3#include "linux32_assym.h" /* system definitions */ 4#include <machine/asmacros.h> /* miscellaneous asm macros */ 5 6#include <amd64/linux32/linux32_syscall.h> /* system call numbers */ 7 8.text 9.code32 10 11/* 12 * To avoid excess stack frame the signal trampoline code emulates 13 * the 'call' instruction. 14 */ 15NON_GPROF_ENTRY(linux32_sigcode) 16 movl %esp, %ebx /* preserve sigframe */ 17 call .getip0 18.getip0: 19 popl %eax 20 add $.startsigcode-.getip0, %eax /* ret address */ 21 push %eax 22 jmp *LINUX_SIGF_HANDLER(%ebx) 23.startsigcode: 24 popl %eax 25 movl $LINUX_SYS_linux_sigreturn,%eax /* linux_sigreturn() */ 26 int $0x80 /* enter kernel with args */ 27.endsigcode: 280: jmp 0b 29 30NON_GPROF_ENTRY(linux32_rt_sigcode) 31 leal LINUX_RT_SIGF_UC(%esp),%ebx /* linux ucp */ 32 leal LINUX_RT_SIGF_SC(%ebx),%ecx /* linux sigcontext */ 33 movl %esp, %edi 34 call .getip1 35.getip1: 36 popl %eax 37 add $.startrtsigcode-.getip1, %eax /* ret address */ 38 push %eax 39 jmp *LINUX_RT_SIGF_HANDLER(%edi) 40.startrtsigcode: 41 movl $LINUX_SYS_linux_rt_sigreturn,%eax /* linux_rt_sigreturn() */ 42 int $0x80 /* enter kernel with args */ 43.endrtsigcode: 440: jmp 0b 45 46NON_GPROF_ENTRY(linux32_vsyscall) 47.startvsyscall: 48 int $0x80 49 ret 50.endvsyscall: 51 52 53 .section .note.Linux, "a",@note 54 .long 2f - 1f /* namesz */ 55 .balign 4 56 .long 4f - 3f /* descsz */ 57 .long 0 581: 59 .asciz "Linux" 602: 61 .balign 4 623: 63 .long LINUX_VERSION_CODE 644: 65 .balign 4 66 .previous 67 68 69#define do_cfa_expr(offset) \ 70 .byte 0x0f; /* DW_CFA_def_cfa_expression */ \ 71 .uleb128 11f-10f; /* length */ \ 7210: .byte 0x74; /* DW_OP_breg4 */ \ 73 .sleb128 offset; /* offset */ \ 74 .byte 0x06; /* DW_OP_deref */ \ 7511: 76 77 78 /* CIE */ 79 .section .eh_frame,"a",@progbits 80.LSTARTFRAMEDLSI1: 81 .long .LENDCIEDLSI1-.LSTARTCIEDLSI1 82.LSTARTCIEDLSI1: 83 .long 0 /* CIE ID */ 84 .byte 1 /* Version number */ 85 .string "zRS" /* NULL-terminated 86 * augmentation string 87 */ 88 .uleb128 1 /* Code alignment factor */ 89 .sleb128 -4 /* Data alignment factor */ 90 .byte 8 /* Return address 91 * register column 92 */ 93 .uleb128 1 /* Augmentation value length */ 94 .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ 95 .byte 0 /* DW_CFA_nop */ 96 .align 4 97.LENDCIEDLSI1: 98 99 /* FDE */ 100 .long .LENDFDEDLSI1-.LSTARTFDEDLSI1 /* Length FDE */ 101.LSTARTFDEDLSI1: 102 .long .LSTARTFDEDLSI1-.LSTARTFRAMEDLSI1 /* CIE pointer */ 103 .long .startsigcode-. /* PC-relative start address */ 104 .long .endsigcode-.startsigcode 105 .uleb128 0 /* Augmentation */ 106 do_cfa_expr(LINUX_SIGF_SC-8) 107 .align 4 108.LENDFDEDLSI1: 109 110 .long .LENDFDEDLSI2-.LSTARTFDEDLSI2 /* Length FDE */ 111.LSTARTFDEDLSI2: 112 .long .LSTARTFDEDLSI2-.LSTARTFRAMEDLSI1 /* CIE pointer */ 113 .long .startrtsigcode-. /* PC-relative start address */ 114 .long .endrtsigcode-.startrtsigcode 115 .uleb128 0 /* Augmentation */ 116 do_cfa_expr(LINUX_RT_SIGF_SC-4+LINUX_SC_ESP) 117 .align 4 118.LENDFDEDLSI2: 119 .previous 120 121 .section .eh_frame,"a",@progbits 122.LSTARTFRAMEDLSI2: 123 .long .LENDCIEDLSI2-.LSTARTCIEDLSI2 124.LSTARTCIEDLSI2: 125 .long 0 /* CIE ID */ 126 .byte 1 /* Version number */ 127 .string "zR" /* NULL-terminated 128 * augmentation string 129 */ 130 .uleb128 1 /* Code alignment factor */ 131 .sleb128 -4 /* Data alignment factor */ 132 .byte 8 /* Return address register column */ 133 .uleb128 1 /* Augmentation value length */ 134 .byte 0x1b /* DW_EH_PE_pcrel|DW_EH_PE_sdata4. */ 135 .byte 0x0c /* DW_CFA_def_cfa */ 136 .uleb128 4 137 .uleb128 4 138 .byte 0x88 /* DW_CFA_offset, column 0x8 */ 139 .uleb128 1 140 .align 4 141.LENDCIEDLSI2: 142 .long .LENDFDEDLSI3-.LSTARTFDEDLSI3 /* Length FDE */ 143.LSTARTFDEDLSI3: 144 .long .LSTARTFDEDLSI3-.LSTARTFRAMEDLSI2 /* CIE pointer */ 145 .long .startvsyscall-. /* PC-relative start address */ 146 .long .endvsyscall-.startvsyscall 147 .uleb128 0 148 .align 4 149.LENDFDEDLSI3: 150 .previous 151