Home | History | Annotate | Download | only in backends
      1 /* i386 ABI-specified defaults for DWARF CFI.
      2    Copyright (C) 2009 Red Hat, Inc.
      3    This file is part of Red Hat elfutils.
      4 
      5    Red Hat elfutils is free software; you can redistribute it and/or modify
      6    it under the terms of the GNU General Public License as published by the
      7    Free Software Foundation; version 2 of the License.
      8 
      9    Red Hat elfutils is distributed in the hope that it will be useful, but
     10    WITHOUT ANY WARRANTY; without even the implied warranty of
     11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12    General Public License for more details.
     13 
     14    You should have received a copy of the GNU General Public License along
     15    with Red Hat elfutils; if not, write to the Free Software Foundation,
     16    Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
     17 
     18    Red Hat elfutils is an included package of the Open Invention Network.
     19    An included package of the Open Invention Network is a package for which
     20    Open Invention Network licensees cross-license their patents.  No patent
     21    license is granted, either expressly or impliedly, by designation as an
     22    included package.  Should you wish to participate in the Open Invention
     23    Network licensing program, please visit www.openinventionnetwork.com
     24    <http://www.openinventionnetwork.com>.  */
     25 
     26 #ifdef HAVE_CONFIG_H
     27 # include <config.h>
     28 #endif
     29 
     30 #include <dwarf.h>
     31 
     32 #define BACKEND i386_
     33 #include "libebl_CPU.h"
     34 
     35 int
     36 i386_abi_cfi (Ebl *ebl __attribute__ ((unused)), Dwarf_CIE *abi_info)
     37 {
     38   static const uint8_t abi_cfi[] =
     39     {
     40       /* Call-saved regs.  */
     41       DW_CFA_same_value, ULEB128_7 (3), /* %ebx */
     42       DW_CFA_same_value, ULEB128_7 (5), /* %ebp */
     43       DW_CFA_same_value, ULEB128_7 (6), /* %esi */
     44       DW_CFA_same_value, ULEB128_7 (7), /* %edi */
     45 
     46       /* The CFA is the SP.  */
     47       DW_CFA_val_offset, ULEB128_7 (4), ULEB128_7 (0),
     48 
     49       /* Segment registers are call-saved if ever used at all.  */
     50       DW_CFA_same_value, ULEB128_7 (40), /* %es */
     51       DW_CFA_same_value, ULEB128_7 (41), /* %cs */
     52       DW_CFA_same_value, ULEB128_7 (42), /* %ss */
     53       DW_CFA_same_value, ULEB128_7 (43), /* %ds */
     54       DW_CFA_same_value, ULEB128_7 (44), /* %fs */
     55       DW_CFA_same_value, ULEB128_7 (45), /* %gs */
     56     };
     57 
     58   abi_info->initial_instructions = abi_cfi;
     59   abi_info->initial_instructions_end = &abi_cfi[sizeof abi_cfi];
     60   abi_info->data_alignment_factor = 4;
     61 
     62   abi_info->return_address_register = 8; /* %eip */
     63 
     64   return 0;
     65 }
     66