Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // base::mac::CallWithEHFrame(void () block_pointer) | |
| 6 #define CALL_WITH_EH_FRAME __ZN4base3mac15CallWithEHFrameEU13block_pointerFvvE | |
| 7 | |
| 8 .section __TEXT,__text,regular,pure_instructions | |
| 9 #if !defined(COMPONENT_BUILD) | |
| 10 .private_extern CALL_WITH_EH_FRAME | |
| 11 #endif | |
| 12 .globl CALL_WITH_EH_FRAME | |
| 13 CALL_WITH_EH_FRAME: | |
| 14 | |
|
Nico
2015/07/09 20:43:11
do you need any stack alignment here?
Robert Sesek
2015/07/10 16:56:08
Yeah, 16-byte alignment. Done.
| |
| 15 .cfi_startproc | |
|
Nico
2015/07/09 19:36:22
After starting at this for a bit, isn't this moral
Robert Sesek
2015/07/09 20:16:43
It's close, but no. That would cause a crash with
| |
| 16 | |
| 17 // Configure the C++ exception handler personality routine. Normally the | |
| 18 // compiler would emit ___gxx_personality_v0 here. The purpose of this | |
| 19 // function is to use a custom personality routine. | |
| 20 .cfi_personality 155, __ZN4base3mac21CxxPersonalityRoutineEi14_Unwind_ActionyP 17_Unwind_ExceptionP15_Unwind_Context | |
| 21 .cfi_lsda 16, CallWithEHFrame_exception_table | |
| 22 | |
| 23 Lfunction_start: | |
| 24 pushq %rbp | |
| 25 .cfi_def_cfa_offset 16 | |
| 26 .cfi_offset %rbp, -16 | |
| 27 movq %rsp, %rbp | |
| 28 .cfi_def_cfa_register %rbp | |
| 29 | |
| 30 // Load the function pointer from the block descriptor. | |
| 31 movq 16(%rdi), %rax | |
| 32 | |
| 33 // Execute the block in the context of a C++ try{}. | |
| 34 Ltry_start: | |
| 35 callq *%rax | |
| 36 Ltry_end: | |
| 37 popq %rbp | |
| 38 ret | |
| 39 | |
| 40 // Landing pad for the exception handler. This should never be called, since | |
|
Nico
2015/07/09 20:43:11
As it's never called, maybe just an ud2 is enough?
Robert Sesek
2015/07/10 16:56:08
ud2 would definitely "be enough", but the ABI is p
| |
| 41 // the personality routine will stop the search for an exception handler, | |
| 42 // which will cause the runtime to invoke the default terminate handler. | |
| 43 Lcatch: | |
| 44 movq %rax, %rdi | |
| 45 callq ___cxa_begin_catch // The ABI requires a call to the catch handler. | |
| 46 ud2 // In the event this is called, make it fatal. | |
| 47 | |
| 48 Lfunction_end: | |
| 49 .cfi_endproc | |
| 50 | |
| 51 // The C++ exception table that is used to identify this frame as an | |
| 52 // exception handler. See http://llvm.org/docs/ExceptionHandling.html and | |
| 53 // http://mentorembedded.github.io/cxx-abi/exceptions.pdf. | |
| 54 .section __TEXT,__gcc_except_tab | |
| 55 .align 2 | |
| 56 CallWithEHFrame_exception_table: | |
| 57 .byte 255 // DW_EH_PE_omit | |
| 58 .byte 155 // DW_EH_PE_indirect | DW_EH_PE_pcrel | DW_EH_PE_sdata4 | |
| 59 .asciz "\242\200\200" // LE int128 for the number of bytes in this table. | |
| 60 .byte 3 // DW_EH_PE_udata4 | |
| 61 .byte 26 // Callsite table length. | |
| 62 | |
| 63 // First callsite. | |
| 64 CS1_begin = Ltry_start - Lfunction_start | |
| 65 .long CS1_begin | |
| 66 CS1_end = Ltry_end - Ltry_start | |
| 67 .long CS1_end | |
| 68 | |
| 69 // First landing pad. | |
| 70 LP1 = Lcatch - Lfunction_start | |
| 71 .long LP1 | |
| 72 .byte 1 // Action record. | |
| 73 | |
| 74 // Second callsite. | |
| 75 CS2_begin = Ltry_end - Lfunction_start | |
| 76 .long CS2_begin | |
| 77 CS2_end = Lfunction_end - Ltry_end | |
| 78 .long CS2_end | |
| 79 | |
| 80 // Second landing pad (none). | |
| 81 .long 0 | |
| 82 .byte 0 // No action. | |
| 83 | |
| 84 // Action table. | |
| 85 .byte 1 // Action record 1. | |
| 86 .byte 0 // No further action to take. | |
| 87 .long 0 // No type filter for this catch(){} clause. | |
| 88 .align 2 | |
| OLD | NEW |