qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] tcg-arm: Implement tcg_register_jit


From: li guang
Subject: Re: [Qemu-devel] [PATCH 1/2] tcg-arm: Implement tcg_register_jit
Date: Wed, 05 Jun 2013 09:56:20 +0800

Hi, Richard,

在 2013-05-24五的 14:20 -0700,Richard Henderson写道:
> Allows unwinding past the code_gen_buffer.
> 
> Signed-off-by: Richard Henderson <address@hidden>
> ---
>  tcg/arm/tcg-target.c | 91 
> ++++++++++++++++++++++++++++++++++++++++++++++------
>  1 file changed, 82 insertions(+), 9 deletions(-)
> 
> diff --git a/tcg/arm/tcg-target.c b/tcg/arm/tcg-target.c
> index 3d43412..4a691b1 100644
> --- a/tcg/arm/tcg-target.c
> +++ b/tcg/arm/tcg-target.c
> @@ -2100,23 +2100,31 @@ static inline void tcg_out_movi(TCGContext *s, 
> TCGType type,
>      tcg_out_movi32(s, COND_AL, ret, arg);
>  }
>  
> +
> +typedef struct {
> +    uint32_t len __attribute__((aligned((sizeof(void *)))));
> +    uint32_t cie_offset;
> +    tcg_target_long func_start __attribute__((packed));
> +    tcg_target_long func_len __attribute__((packed));

suspicious usage of packed attribute here,
since tcg_targe_long is either 32 or 64 bits,
not a struct or union.

Thanks!

> +    uint8_t def_cfa[4];
> +    uint8_t reg_ofs[18];
> +} DebugFrameFDE;
> +
> +typedef struct {
> +    DebugFrameCIE cie;
> +    DebugFrameFDE fde;
> +} DebugFrame;
> +
> +#define ELF_HOST_MACHINE EM_ARM
> +
> +static DebugFrame debug_frame = {
> +    .cie.len = sizeof(DebugFrameCIE)-4, /* length after .len member */
> +    .cie.id = -1,
> +    .cie.version = 1,
> +    .cie.code_align = 1,
> +    .cie.data_align = 0x7c,             /* sleb128 -4 */
> +    .cie.return_column = 14,
> +
> +    .fde.len = sizeof(DebugFrameFDE)-4, /* length after .len member */
> +    .fde.def_cfa = {
> +        12, 13,                         /* DW_CFA_def_cfa sp, ... */
> +        (FRAME_SIZE & 0x7f) | 0x80,     /* ... uleb128 FRAME_SIZE */
> +        (FRAME_SIZE >> 7)
> +    },
> +    .fde.reg_ofs = {
> +        /* The following must match the stmdb in the prologue.  */
> +        0x8e, 1,                        /* DW_CFA_offset, lr, -4 */
> +        0x8b, 2,                        /* DW_CFA_offset, r11, -8 */
> +        0x8a, 3,                        /* DW_CFA_offset, r10, -12 */
> +        0x89, 4,                        /* DW_CFA_offset, r9, -16 */
> +        0x88, 5,                        /* DW_CFA_offset, r8, -20 */
> +        0x87, 6,                        /* DW_CFA_offset, r7, -24 */
> +        0x86, 7,                        /* DW_CFA_offset, r6, -28 */
> +        0x85, 8,                        /* DW_CFA_offset, r5, -32 */
> +        0x84, 9,                        /* DW_CFA_offset, r4, -36 */
> +    }
> +};
> +
> +void tcg_register_jit(void *buf, size_t buf_size)
> +{
> +    /* We're expecting a 2 byte uleb128 encoded value.  */
> +    assert(FRAME_SIZE >> 14 == 0);
> +
> +    debug_frame.fde.func_start = (tcg_target_long) buf;
> +    debug_frame.fde.func_len = buf_size;
> +
> +    tcg_register_jit_int(buf, buf_size, &debug_frame, sizeof(debug_frame));
> +}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]