[lttng-dev] [PATCH v2] Fix: alignment problems on targets not supporting unaligned access.
David Goulet
dgoulet at efficios.com
Wed May 28 09:39:49 EDT 2014
Merged!
Thanks
David
On 16 May (09:10:07), rongqing.li at windriver.com wrote:
> From: Fredrik Markström <fredrik.markstrom at gmail.com>
>
> Accessing floats, doubles and 64 bit int at unaligned addresses is not
> supported on all configurations of arm processors and if it is it's
> emulated and slow. This patch replaces direct assignments with memcpy.
>
> Signed-off-by: Fredrik Markström <fredrik.markstrom at gmail.com>
> Signed-off-by: Roy Li <rongqing.li at windriver.com>
> Acked-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 603 bytes
Desc: Digital signature
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20140528/492fd5a4/attachment.sig>
More information about the lttng-dev
mailing list