Revision cb1977d3

b/elf.h
346 346
#define R_MIPS_HIVENDOR		127
347 347

  
348 348

  
349
/* SUN SPARC specific definitions.  */
350

  
351
/* Values for Elf64_Ehdr.e_flags.  */
352

  
353
#define EF_SPARCV9_MM           3
354
#define EF_SPARCV9_TSO          0
355
#define EF_SPARCV9_PSO          1
356
#define EF_SPARCV9_RMO          2
357
#define EF_SPARC_LEDATA         0x800000 /* little endian data */
358
#define EF_SPARC_EXT_MASK       0xFFFF00
359
#define EF_SPARC_32PLUS         0x000100 /* generic V8+ features */
360
#define EF_SPARC_SUN_US1        0x000200 /* Sun UltraSPARC1 extensions */
361
#define EF_SPARC_HAL_R1         0x000400 /* HAL R1 extensions */
362
#define EF_SPARC_SUN_US3        0x000800 /* Sun UltraSPARCIII extensions */
363

  
349 364
/*
350 365
 * Sparc ELF relocation types
351 366
 */
b/tcg/sparc/tcg-target.c
1624 1624
    tcg_regset_set_reg(s->reserved_regs, TCG_REG_O7);
1625 1625
    tcg_add_target_add_op_defs(sparc_op_defs);
1626 1626
}
1627

  
1628
#if TCG_TARGET_REG_BITS == 64
1629
# define ELF_HOST_MACHINE  EM_SPARCV9
1630
#elif defined(__sparc_v8plus__)
1631
# define ELF_HOST_MACHINE  EM_SPARC32PLUS
1632
# define ELF_HOST_FLAGS    EF_SPARC_32PLUS
1633
#else
1634
# define ELF_HOST_MACHINE  EM_SPARC
1635
#endif
1636

  
1637
typedef struct {
1638
    uint32_t len __attribute__((aligned((sizeof(void *)))));
1639
    uint32_t id;
1640
    uint8_t version;
1641
    char augmentation[1];
1642
    uint8_t code_align;
1643
    uint8_t data_align;
1644
    uint8_t return_column;
1645
} DebugFrameCIE;
1646

  
1647
typedef struct {
1648
    uint32_t len __attribute__((aligned((sizeof(void *)))));
1649
    uint32_t cie_offset;
1650
    tcg_target_long func_start __attribute__((packed));
1651
    tcg_target_long func_len __attribute__((packed));
1652
    uint8_t def_cfa[TCG_TARGET_REG_BITS == 64 ? 4 : 2];
1653
    uint8_t win_save;
1654
    uint8_t ret_save[3];
1655
} DebugFrameFDE;
1656

  
1657
typedef struct {
1658
    DebugFrameCIE cie;
1659
    DebugFrameFDE fde;
1660
} DebugFrame;
1661

  
1662
static DebugFrame debug_frame = {
1663
    .cie.len = sizeof(DebugFrameCIE)-4, /* length after .len member */
1664
    .cie.id = -1,
1665
    .cie.version = 1,
1666
    .cie.code_align = 1,
1667
    .cie.data_align = -sizeof(void *) & 0x7f,
1668
    .cie.return_column = 15,            /* o7 */
1669

  
1670
    .fde.len = sizeof(DebugFrameFDE)-4, /* length after .len member */
1671
    .fde.def_cfa = {
1672
#if TCG_TARGET_REG_BITS == 64
1673
        12, 30,                         /* DW_CFA_def_cfa i6, 2047 */
1674
        (2047 & 0x7f) | 0x80, (2047 >> 7)
1675
#else
1676
        13, 30                          /* DW_CFA_def_cfa_register i6 */
1677
#endif
1678
    },
1679
    .fde.win_save = 0x2d,               /* DW_CFA_GNU_window_save */
1680
    .fde.ret_save = { 9, 15, 31 },      /* DW_CFA_register o7, i7 */
1681
};
1682

  
1683
void tcg_register_jit(void *buf, size_t buf_size)
1684
{
1685
    debug_frame.fde.func_start = (tcg_target_long) buf;
1686
    debug_frame.fde.func_len = buf_size;
1687

  
1688
    tcg_register_jit_int(buf, buf_size, &debug_frame, sizeof(debug_frame));
1689
}

Also available in: Unified diff