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 |
}
|