[lttng-dev] [PATCH] Fixed alignment problems on targets not supporting unaligned access.

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu May 15 13:43:33 EDT 2014


----- Original Message -----
> From: "rongqing li" <rongqing.li at windriver.com>
> To: lttng-dev at lists.lttng.org
> Sent: Thursday, May 15, 2014 4:50:49 AM
> Subject: [lttng-dev] [PATCH] Fixed alignment problems on targets not	supporting unaligned access.
> 
> From: Fredrik Markström <fredrik.markstrom at gmail.com>
> 
> Accessing floats, doubles and 64 bit int at unalign addresses is not
> supported on all configurations of arm processors and if it is it's
> emualted and slow. This patch replaces direct assignments with memcpy.

Nits:
- change "Fixed" for "Fix:" in the title.
- at unalign addresses -> at unaligned addresses
- emualted -> emulated


> 
> Signed-off-by: Fredrik Markstr枚m <fredrik.markstrom at gmail.com>

The "o" here prints as a chinese character. Not sure this is
intended.

other than that:

Acked-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>

Thanks,

Mathieu

> Signed-off-by: Li RongQing <rongqing.li at windriver.com>
> ---
>  src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c
> b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c
> index 762d604..8c6dc96 100644
> --- a/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c
> +++ b/src/lib/lttng-ctl/filter/filter-visitor-generate-bytecode.c
> @@ -222,7 +222,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct
> ir_op *node)
>  		if (!insn)
>  			return -ENOMEM;
>  		insn->op = FILTER_OP_LOAD_S64;
> -		*(int64_t *) insn->data = node->u.load.u.num;
> +		memcpy(insn->data, &node->u.load.u.num, sizeof(int64_t));
>  		ret = bytecode_push(&ctx->bytecode, insn, 1, insn_len);
>  		free(insn);
>  		return ret;
> @@ -237,7 +237,7 @@ int visit_node_load(struct filter_parser_ctx *ctx, struct
> ir_op *node)
>  		if (!insn)
>  			return -ENOMEM;
>  		insn->op = FILTER_OP_LOAD_DOUBLE;
> -		*(double *) insn->data = node->u.load.u.flt;
> +		memcpy(insn->data, &node->u.load.u.flt, sizeof(double));
>  		ret = bytecode_push(&ctx->bytecode, insn, 1, insn_len);
>  		free(insn);
>  		return ret;
> --
> 1.7.10.4
> 
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
> 

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list