1 2# 3# This is a generic function to test that restoring registers during unwinding work correctly. 4# 5 6 .text 7.globl _unwind_tester 8_unwind_tester: 9LFB3: 10 pushq %rbp 11LCFI45: 12 movq %rsp, %rbp 13LCFI46: 14 movq %rbx, -40(%rbp) 15LCFI47: 16 movq %r12, -32(%rbp) 17LCFI48: 18 movq %r13, -24(%rbp) 19LCFI49: 20 movq %r14, -16(%rbp) 21LCFI50: 22 movq %r15, -8(%rbp) 23LCFI51: 24 subq $48, %rsp 25LCFI52: 26 # load magic values into non-volatile registers 27 movq $0x1234567887654321, %rbx 28 movq $0x02468ACEECA86420, %r12 29 movq $0x13579BDFFDB97531, %r13 30 movq $0x1122334455667788, %r14 31 movq $0x0022446688AACCEE, %r15 32 # call test function which will invoke unwinder which "returns" here 33 call *%rdi 34 # verify that non-volatile registers still contain magic values 35 movq $0x1234567887654321, %rax 36 cmpq %rax, %rbx 37 jne L2 38 movq $0x02468ACEECA86420, %rax 39 cmpq %rax, %r12 40 jne L2 41 movq $0x13579BDFFDB97531, %rax 42 cmpq %rax, %r13 43 jne L2 44 movq $0x1122334455667788, %rax 45 cmpq %rax, %r14 46 jne L2 47 movq $0x0022446688AACCEE, %rax 48 cmpq %rax, %r15 49 jne L2 50 movl $0, %eax 51 jmp L3 52L2: movl $1, %eax 53L3: 54 movq -40(%rbp), %rbx 55 movq -32(%rbp), %r12 56 movq -24(%rbp), %r13 57 movq -16(%rbp), %r14 58 movq -8(%rbp), %r15 59 leave 60 ret 61LFE3: 62 63 64 .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support 65EH_frame1: 66 .set L$set$0,LECIE1-LSCIE1 67 .long L$set$0 # Length of Common Information Entry 68LSCIE1: 69 .long 0x0 # CIE Identifier Tag 70 .byte 0x1 # CIE Version 71 .ascii "zR\0" # CIE Augmentation 72 .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor 73 .byte 0x78 # sleb128 -8; CIE Data Alignment Factor 74 .byte 0x10 # CIE RA Column 75 .byte 0x1 # uleb128 0x1; Augmentation size 76 .byte 0x10 # FDE Encoding (pcrel) 77 .byte 0xc # DW_CFA_def_cfa 78 .byte 0x7 # uleb128 0x7 79 .byte 0x8 # uleb128 0x8 80 .byte 0x90 # DW_CFA_offset, column 0x10 81 .byte 0x1 # uleb128 0x1 82 .align 3 83LECIE1: 84 85.globl _unwind_tester.eh 86_unwind_tester.eh: 87LSFDE23: 88 .set L$set$52,LEFDE23-LASFDE23 89 .long L$set$52 # FDE Length 90LASFDE23: 91 .long LASFDE23-EH_frame1 # FDE CIE offset 92 .quad LFB3-. # FDE initial location 93 .set L$set$53,LFE3-LFB3 94 .quad L$set$53 # FDE address range 95 .byte 0x0 # uleb128 0x0; Augmentation size 96 .byte 0x4 # DW_CFA_advance_loc4 97 .set L$set$54,LCFI45-LFB3 98 .long L$set$54 99 .byte 0xe # DW_CFA_def_cfa_offset 100 .byte 0x10 # uleb128 0x10 101 .byte 0x86 # DW_CFA_offset, column 0x6 102 .byte 0x2 # uleb128 0x2 103 .byte 0x4 # DW_CFA_advance_loc4 104 .set L$set$55,LCFI46-LCFI45 105 .long L$set$55 106 .byte 0xd # DW_CFA_def_cfa_register 107 .byte 0x6 # uleb128 0x6 108 .byte 0x4 # DW_CFA_advance_loc4 109 .set L$set$56,LCFI52-LCFI46 110 .long L$set$56 111 .byte 0x8f # DW_CFA_offset, column 0xf 112 .byte 0x3 # uleb128 0x3 113 .byte 0x8e # DW_CFA_offset, column 0xe 114 .byte 0x4 # uleb128 0x4 115 .byte 0x8d # DW_CFA_offset, column 0xd 116 .byte 0x5 # uleb128 0x5 117 .byte 0x8c # DW_CFA_offset, column 0xc 118 .byte 0x6 # uleb128 0x6 119 .byte 0x83 # DW_CFA_offset, column 0x3 120 .byte 0x7 # uleb128 0x7 121 .align 3 122LEFDE23: 123 124 125 126