Revision e7bd6300

b/tcg/hppa/tcg-target.c
336 336
#define INSN_COMIBF     (INSN_OP(0x23))
337 337

  
338 338
/* supplied by libgcc */
339
extern void *__canonicalize_funcptr_for_compare(void *);
339
extern void *__canonicalize_funcptr_for_compare(const void *);
340 340

  
341 341
static void tcg_out_mov(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg)
342 342
{
......
628 628
    tcg_out_shd(s, ret, arg, temp, 8);    /* ret =  DCBA */
629 629
}
630 630

  
631
static void tcg_out_call(TCGContext *s, void *func)
631
static void tcg_out_call(TCGContext *s, const void *func)
632 632
{
633 633
    tcg_target_long val, hi, lo, disp;
634 634

  
......
1661 1661
    TCG_REG_R18
1662 1662
};
1663 1663

  
1664
#define FRAME_SIZE ((-TCG_TARGET_CALL_STACK_OFFSET \
1665
                     + TCG_TARGET_STATIC_CALL_ARGS_SIZE \
1666
                     + ARRAY_SIZE(tcg_target_callee_save_regs) * 4 \
1667
                     + CPU_TEMP_BUF_NLONGS * sizeof(long) \
1668
                     + TCG_TARGET_STACK_ALIGN - 1) \
1669
                    & -TCG_TARGET_STACK_ALIGN)
1670

  
1664 1671
static void tcg_target_qemu_prologue(TCGContext *s)
1665 1672
{
1666 1673
    int frame_size, i;
1667 1674

  
1668
    /* Allocate space for the fixed frame marker.  */
1669
    frame_size = -TCG_TARGET_CALL_STACK_OFFSET;
1670
    frame_size += TCG_TARGET_STATIC_CALL_ARGS_SIZE;
1671

  
1672
    /* Allocate space for the saved registers.  */
1673
    frame_size += ARRAY_SIZE(tcg_target_callee_save_regs) * 4;
1674

  
1675
    /* Allocate space for the TCG temps. */
1676
    frame_size += CPU_TEMP_BUF_NLONGS * sizeof(long);
1677

  
1678
    /* Align the allocated space.  */
1679
    frame_size = ((frame_size + TCG_TARGET_STACK_ALIGN - 1)
1680
                  & -TCG_TARGET_STACK_ALIGN);
1675
    frame_size = FRAME_SIZE;
1681 1676

  
1682 1677
    /* The return address is stored in the caller's frame.  */
1683 1678
    tcg_out_st(s, TCG_TYPE_PTR, TCG_REG_RP, TCG_REG_CALL_STACK, -20);
......
1752 1747

  
1753 1748
    tcg_add_target_add_op_defs(hppa_op_defs);
1754 1749
}
1750

  
1751
typedef struct {
1752
    uint32_t len __attribute__((aligned((sizeof(void *)))));
1753
    uint32_t id;
1754
    uint8_t version;
1755
    char augmentation[1];
1756
    uint8_t code_align;
1757
    uint8_t data_align;
1758
    uint8_t return_column;
1759
} DebugFrameCIE;
1760

  
1761
typedef struct {
1762
    uint32_t len __attribute__((aligned((sizeof(void *)))));
1763
    uint32_t cie_offset;
1764
    tcg_target_long func_start __attribute__((packed));
1765
    tcg_target_long func_len __attribute__((packed));
1766
    uint8_t def_cfa[4];
1767
    uint8_t ret_ofs[3];
1768
    uint8_t reg_ofs[ARRAY_SIZE(tcg_target_callee_save_regs) * 2];
1769
} DebugFrameFDE;
1770

  
1771
typedef struct {
1772
    DebugFrameCIE cie;
1773
    DebugFrameFDE fde;
1774
} DebugFrame;
1775

  
1776
#define ELF_HOST_MACHINE  EM_PARISC
1777
#define ELF_HOST_FLAGS    EFA_PARISC_1_1
1778

  
1779
/* ??? BFD (and thus GDB) wants very much to distinguish between HPUX
1780
   and other extensions.  We don't really care, but if we don't set this
1781
   to *something* then the object file won't be properly matched.  */
1782
#define ELF_OSABI         ELFOSABI_LINUX
1783

  
1784
static DebugFrame debug_frame = {
1785
    .cie.len = sizeof(DebugFrameCIE)-4, /* length after .len member */
1786
    .cie.id = -1,
1787
    .cie.version = 1,
1788
    .cie.code_align = 1,
1789
    .cie.data_align = 1,
1790
    .cie.return_column = 2,
1791

  
1792
    .fde.len = sizeof(DebugFrameFDE)-4, /* length after .len member */
1793
    .fde.def_cfa = {
1794
        0x12, 30,                       /* DW_CFA_def_cfa_sf sp, ... */
1795
        (-FRAME_SIZE & 0x7f) | 0x80,     /* ... sleb128 -FRAME_SIZE */
1796
        (-FRAME_SIZE >> 7) & 0x7f
1797
    },
1798
    .fde.ret_ofs = {
1799
        0x11, 2, (-20 / 4) & 0x7f       /* DW_CFA_offset_extended_sf r2, 20 */
1800
    },
1801
    .fde.reg_ofs = {
1802
        /* This must match the ordering in tcg_target_callee_save_regs.  */
1803
        0x80 + 4, 0,                    /* DW_CFA_offset r4, 0 */
1804
        0x80 + 5, 4,                    /* DW_CFA_offset r5, 4 */
1805
        0x80 + 6, 8,                    /* DW_CFA_offset r6, 8 */
1806
        0x80 + 7, 12,                    /* ... */
1807
        0x80 + 8, 16,
1808
        0x80 + 9, 20,
1809
        0x80 + 10, 24,
1810
        0x80 + 11, 28,
1811
        0x80 + 12, 32,
1812
        0x80 + 13, 36,
1813
        0x80 + 14, 40,
1814
        0x80 + 15, 44,
1815
        0x80 + 16, 48,
1816
        0x80 + 17, 52,
1817
        0x80 + 18, 56,
1818
    }
1819
};
1820

  
1821
void tcg_register_jit(void *buf, size_t buf_size)
1822
{
1823
    debug_frame.fde.func_start = (tcg_target_long) buf;
1824
    debug_frame.fde.func_len = buf_size;
1825

  
1826
    tcg_register_jit_int(buf, buf_size, &debug_frame, sizeof(debug_frame));
1827
}

Also available in: Unified diff