#ifdef HAVE_CONFIG_H # include <config.h> #endif #include <dwarf.h> #define BACKEND x86_64_ #include "libebl_CPU.h" int x86_64_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info) { static const uint8_t abi_cfi[] = { /* Call-saved regs. */ DW_CFA_same_value, ULEB128_7 (0), /* %rbx */ DW_CFA_same_value, ULEB128_7 (6), /* %rbp */ DW_CFA_same_value, ULEB128_7 (12), /* %r12 */ DW_CFA_same_value, ULEB128_7 (13), /* %r13 */ DW_CFA_same_value, ULEB128_7 (14), /* %r14 */ DW_CFA_same_value, ULEB128_7 (15), /* %r15 */ DW_CFA_same_value, ULEB128_7 (16), /* %r16 */ /* The CFA is the SP. */ DW_CFA_val_offset, ULEB128_7 (7), ULEB128_7 (0), }; abi_info->initial_instructions = abi_cfi; abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi]; abi_info->data_alignment_factor = 8;
#include <dwarf.h> #define BACKEND ppc_ #include "libebl_CPU.h" int ppc_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info) { static const uint8_t abi_cfi[] = { /* This instruction is provided in every CIE. It is not repeated here: DW_CFA_def_cfa, ULEB128_7 (1), ULEB128_7 (0) */ /* r1 is assumed to be restored from cfa adress, r1 acts as a stack frame pointer. */ DW_CFA_val_offset, ULEB128_7 (1), ULEB128_7 (0), /* lr is not callee-saved but it needs to be preserved as it is pre-set by the caller. */ DW_CFA_same_value, ULEB128_7 (65), /* lr */ /* Callee-saved regs. */ #define SV(n) DW_CFA_same_value, ULEB128_7 (n) SV (2), /* r2 is TOC pointer. */ SV (13), /* Reserved as system thread id (is it for CFI?). */ /* r14-r31 are non-volatile registers. */ SV (14), SV (15), SV (16), SV (17), SV (18), SV (19), SV (20), SV (21), SV (22), SV (23), SV (24), SV (25), SV (26), SV (27), SV (28), SV (29), SV (30), SV (31) /* VMX registers v20-v31 and vrsave are non-volatile but they are assigned DWARF registers 1144-1156 (v20-v31) which is outside of the CFI supported range. */
"DWARF for the ARM Architecture ABI r2.09" http://infocenter.arm.com/help/topic/com.arm.doc.ihi0040b/IHI0040B_aadwarf.pdf "Procedure Call Standard for the ARM Architecture ABI r2.09" http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042e/IHI0042E_aapcs.pdf */ int arm_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info) { static const uint8_t abi_cfi[] = { /* The initial Canonical Frame Address is the value of the Stack Pointer (r13) as setup in the previous frame. */ DW_CFA_def_cfa, ULEB128_7 (13), ULEB128_7 (0), /* The Stack Pointer (r13) is restored from CFA address by default. */ DW_CFA_val_offset, ULEB128_7 (13), ULEB128_7 (0), #define SV(n) DW_CFA_same_value, ULEB128_7 (n) /* Callee-saved regs r4-r8, r10, r11. */ SV (4), SV (5), SV (6), SV (7), SV (8), SV (10), SV (11), /* The link register contains the return address setup by caller. */ SV (14), DW_CFA_register, ULEB128_7 (15), ULEB128_7 (14), /* pc = lr */ #undef SV /* VFP S16-S31/D8-D15/Q4-Q7 are callee saved. And uleb128 encoded with two bytes. */